Sabtu, 01 Oktober 2016
SAMYANG MIX BASRENG (Bakso Goreng) Level MACHO With AVS Edit Video
Mulai edit-edit video lagi. kali ini pakek AVS Video Editor. Dan
hasilnya gak terlalu memuaskan, apalagi ada watermark yang ganggu banget
Sabtu, 23 Januari 2016
Music
Adele ~ Someone Like You  Lyric
Adele ~ Don't You Remember Lyric
Maroon 5 ~ Sugar Lyric
Shontelle ~ Impossible Lyric
Selena Gomes ~ Love You Like A Love Song Lyric
Ellie Goulding ~ Love Me Like You Do Lyric
Adele ~ Don't You Remember Lyric
Maroon 5 ~ Sugar Lyric
Shontelle ~ Impossible Lyric
Selena Gomes ~ Love You Like A Love Song Lyric
Ellie Goulding ~ Love Me Like You Do Lyric
Kodding Game Matematika Learning Eclipse Part III
Berikut ini koding game Matematika Learning yang terdiri dari 10 soal dan pada akhir akan menampilkan berapa jumlah benar dan salah kita.
Kodding ini masi berkaitan dengan post sebelumnya ya, coba liat Kodding Submenu dan Button pada Eclipse biar gak bingung 
Berikut kodingnya ...
Tampilan Games 1
      Pada package explorer, pilih Matematika > klik
kanan –New> Android XML File  >
beri nama game.xml
Tuliskan
kode dibawah ini :
<?xml version="1.0"
encoding="utf-8"?>
 <RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
   
android:layout_width="fill_parent"
   
android:layout_height="fill_parent"
   
android:background="#f29292">
    
<TextView 
       android:id="@+id/Soal"
   
android:layout_width="fill_parent"
   
android:layout_height="wrap_content"
   
android:text="Bnar atau salah"
   
android:textColor="#ffffff"
   
android:textSize="15px" />
         
<TextView 
       android:id="@+id/jeda"
   
android:layout_width="fill_parent"
   
android:layout_height="wrap_content"
   
android:text=" "
    android:textColor="#ffffff"
   
android:textSize="10px" />
<TextView 
       android:id="@+id/Pertanyaan1"
   
android:layout_width="fill_parent"
   
android:layout_height="wrap_content"
   
android:layout_below="@+id/jeda"
   
android:text=" Games Matematika?"
    android:textColor="#ffffff"
   
android:textSize="15px" />
<EditText android:text=""
     
android:id="@+id/jawabannya"
     
android:layout_width="fill_parent"
     
android:layout_height="wrap_content"
     
android:layout_below="@+id/GambarSoal"
      android:layout_marginTop="20px">
</EditText>
<Button android:text="JAWAB"
     
android:id="@+id/jawab"
     
android:layout_width="fill_parent"
     
android:layout_height="wrap_content"
     
android:layout_below="@+id/jawabannya">
</Button>
<Button android:text="NEXT"
     
android:id="@+id/next"
     
android:layout_width="fill_parent"
     
android:layout_height="wrap_content"
     
android:layout_below="@+id/jawab">
</Button>
<ImageView
   
android:id="@+id/GambarSoal"
   
android:layout_width="wrap_content"
   
android:layout_height="wrap_content"
   
android:layout_below="@+id/Pertanyaan1"
   
android:layout_centerHorizontal="true"
   
android:layout_marginTop="16dp"
   
android:src="@drawable/tabung" />
</RelativeLayout>
Tampilan Games 2
     Pada package explorer, pilih Matematika >
klik kanan –New> Android XML File 
> beri nama game2.xml
Tuliskan
kode dibawah ini :
<?xml
version="1.0" encoding="utf-8"?>
  <RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
   
android:layout_height="fill_parent"
    android:background="#f29292">
     <TextView 
       android:id="@+id/Soal2"
   
android:layout_width="fill_parent"
   
android:layout_height="wrap_content"
    android:text="Benar atau Salah "
    android:textColor="#ffffff"
    android:textSize="15px" />
          <TextView 
       android:id="@+id/jeda2"
   
android:layout_width="fill_parent"
   
android:layout_height="wrap_content"
    android:text=" "
    android:textColor="#ffffff"
    android:textSize="15px" />
<TextView 
       android:id="@+id/Pertanyaan2"
   
android:layout_width="fill_parent"
   
android:layout_height="wrap_content"
    android:layout_below="@+id/jeda2"
    android:text="Games Matematika"
    android:textColor="#ffffff"
    android:textSize="15px" />
<EditText
android:text=""
      android:id="@+id/jawabannya2"
     
android:layout_width="fill_parent"
     
android:layout_height="wrap_content"
     
android:layout_below="@+id/GambarSoal"
     
android:layout_marginTop="20px">
</EditText>
<Button
android:text="JAWAB"
      android:id="@+id/jawab2"
     
android:layout_width="fill_parent"
     
android:layout_height="wrap_content"
     
android:layout_below="@+id/jawabannya2">
</Button>
<Button
android:text="NEXT"
      android:id="@+id/next1"
     
android:layout_width="fill_parent"
     
android:layout_height="wrap_content"
     
android:layout_below="@+id/jawab2">
</Button>
<ImageView
    android:id="@+id/GambarSoal"
    android:layout_width="wrap_content"
   
android:layout_height="wrap_content"
   
android:layout_below="@+id/Pertanyaan2"
   
android:layout_centerHorizontal="true"
    android:layout_marginTop="16dp"
    android:src="@drawable/ball"
/>
</RelativeLayout>
Tampilan Games 3
      
Pada package explorer, pilih Matematika >
klik kanan –New> Android XML File 
> beri nama game3.xml
Tuliskan
kode dibawah ini :
<?xml
version="1.0" encoding="utf-8"?>
 <RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
   
android:layout_width="fill_parent"
   
android:layout_height="fill_parent"
    android:background="#f29292">
     <TextView 
       android:id="@+id/Pertanyaan"
   
android:layout_width="fill_parent"
   
android:layout_height="wrap_content"
    android:text="Games Matematika"
    android:textColor="#ffffff"
    android:textSize="30px" />
          <TextView 
       android:id="@+id/jeda3"
   
android:layout_width="fill_parent"
   
android:layout_height="wrap_content"
    android:text=" "
    android:textColor="#ffffff"
    android:textSize="30px" />
<EditText
android:text=""
      android:id="@+id/jawabannya3"
     
android:layout_width="fill_parent"
     
android:layout_height="wrap_content"
     
android:layout_below="@+id/GambarSoal"
     
android:layout_marginTop="20px">
</EditText>
<Button
android:text="JAWAB"
      android:id="@+id/jawab3"
     
android:layout_width="fill_parent"
     
android:layout_height="wrap_content"
     
android:layout_below="@+id/jawabannya3">
</Button>
<Button
android:text="NEXT"
      android:id="@+id/next3"
     
android:layout_width="fill_parent"
     
android:layout_height="wrap_content"
     
android:layout_below="@+id/jawab3">
</Button>
<ImageView
    android:id="@+id/GambarSoal"
    android:layout_width="wrap_content"
   
android:layout_height="wrap_content"
    android:layout_below="@+id/jeda3"
   
android:layout_centerHorizontal="true"
    android:layout_marginTop="16dp"
    android:src="@drawable/soal3"
/>
</RelativeLayout>
Tampilan Games 4
  Pada package explorer, pilih Matematika >
klik kanan –New> Android XML File 
> beri nama game4.xml
Tuliskan
kode dibawah ini :
<?xml
version="1.0" encoding="utf-8"?>
 <RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
   
android:layout_width="fill_parent"
   
android:layout_height="fill_parent"
    android:background="#f29292">
     <TextView 
       android:id="@+id/Pertanyaan"
   
android:layout_width="fill_parent"
   
android:layout_height="wrap_content"
    android:text="Games Matematika"
    android:textColor="#ffffff"
    android:textSize="30px" />
          <TextView 
       android:id="@+id/jeda4"
   
android:layout_width="fill_parent"
   
android:layout_height="wrap_content"
    android:text=" "
   
android:layout_below="@+id/Pertanyaan"
    android:textColor="#ffffff"
    android:textSize="30px" />
<EditText
android:text=""
      android:id="@+id/jawabannya4"
     
android:layout_width="fill_parent"
     
android:layout_height="wrap_content"
      android:layout_below="@+id/GambarSoal"
     
android:layout_marginTop="20px">
</EditText>
<Button
android:text="JAWAB"
      android:id="@+id/jawab4"
     
android:layout_width="fill_parent"
     
android:layout_height="wrap_content"
      android:layout_below="@+id/jawabannya4">
</Button>
<Button
android:text="NEXT"
      android:id="@+id/next4"
     
android:layout_width="fill_parent"
     
android:layout_height="wrap_content"
     
android:layout_below="@+id/jawab4">
</Button>
<ImageView
    android:id="@+id/GambarSoal"
   
android:layout_width="wrap_content"
   
android:layout_height="wrap_content"
    android:layout_below="@+id/jeda4"
   
android:layout_centerHorizontal="true"
    android:layout_marginTop="16dp"
    android:src="@drawable/soal4"
/>
</RelativeLayout>
Tampilan Games 5
 
 
1.     
Pada package explorer, pilih Matematika >
klik kanan –New> Android XML File 
> beri nama game5.xml
Tuliskan
kode dibawah ini :
<?xml
version="1.0" encoding="utf-8"?>
 <RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
   
android:layout_width="fill_parent"
   
android:layout_height="fill_parent"
    android:background="#f29292">
     <TextView 
       android:id="@+id/Pertanyaan"
   
android:layout_width="fill_parent"
   
android:layout_height="wrap_content"
    android:text="Games Matematika"
    android:textColor="#ffffff"
    android:textSize="30px" />
          <TextView 
       android:id="@+id/jeda4"
    android:layout_width="fill_parent"
   
android:layout_height="wrap_content"
    android:text=" "
   
android:layout_below="@+id/Pertanyaan"
    android:textColor="#ffffff"
    android:textSize="30px" />
<EditText
android:text=""
      android:id="@+id/jawabannya4"
      android:layout_width="fill_parent"
     
android:layout_height="wrap_content"
     
android:layout_below="@+id/GambarSoal"
     
android:layout_marginTop="20px">
</EditText>
<Button
android:text="JAWAB"
      android:id="@+id/jawab4"
     
android:layout_width="fill_parent"
     
android:layout_height="wrap_content"
     
android:layout_below="@+id/jawabannya4">
</Button>
<Button
android:text="NEXT"
      android:id="@+id/next4"
     
android:layout_width="fill_parent"
      android:layout_height="wrap_content"
     
android:layout_below="@+id/jawab4">
</Button>
<ImageView
    android:id="@+id/GambarSoal"
   
android:layout_width="wrap_content"
   
android:layout_height="wrap_content"
    android:layout_below="@+id/jeda4"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="16dp"
    android:src="@drawable/soal5"
/>
</RelativeLayout>
Dan seterusnya .......
Kemudian  buat Game.Java    
      Pada package explorer, pilih Matematika >
klik kanan –New> Class > beri nama Game.java
     Tuliskan kode
dibawah ini :
    package com.droid.matematika;
  import
android.app.Activity;
  import
android.content.Intent;
  import
android.os.Bundle;
  import
android.view.View;
 import
android.view.View.OnClickListener;
    import
android.widget.Button;
  import
android.widget.EditText;
    import android.widget.ImageView;
  import
android.widget.TextView;
   public class Game
extends Activity implements OnClickListener{
   /** Called when the activity is first
created. */
     Button btn_jwb, btn_next;
     EditText jawabannya;
     TextView salahbenar;
     ImageView soal;
     int benar=0, salah=0, index=0;
     int [] pertanyaan={R.drawable.tabung,
R.drawable.ball, R.drawable.soal3, R.drawable.soal4, R.drawable.soal5,
R.drawable.soal6, R.drawable.soal7, R.drawable.soal8, R.drawable.soal9,
R.drawable.soal10};
     String [] jawaban
={"Tabung","Tidak
Ada","Persegi","16","1.3","200","Bola","A","D","15010.03"};
   @Override
   public void onCreate(Bundle
savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.game);
         btn_jwb =
(Button)findViewById(R.id.jawab);
         btn_jwb.setOnClickListener(this);
         btn_next =
(Button)findViewById(R.id.next);
         btn_next.setOnClickListener(this);
         salahbenar =
(TextView)findViewById(R.id.Soal);
         salahbenar.setText("");
         soal =
(ImageView)findViewById(R.id.GambarSoal);
         soal.setImageResource(pertanyaan[0]);
   }
     @Override
     public void onClick(View v) {
           // TODO Auto-generated method stub
                
salahbenar=(TextView)findViewById(R.id.Soal);
                
jawabannya=(EditText)findViewById(R.id.jawabannya);
           if(v==btn_jwb)
           {
                 String
jawab1=jawabannya.getText().toString();
                
if(jawab1.equalsIgnoreCase(jawaban[index]))
                 {
                      
salahbenar.setText("BENAR");benar++;
                 }
                 else
                 {
                      
salahbenar.setText("SALAH");salah++;
                 }
           }
           else if (v==btn_next)
           {
                
if(index<pertanyaan.length-1)
                 {
                       index++;
                       soal.setImageResource(pertanyaan[index]);
                      
btn_jwb.setEnabled(true);
                      
btn_next.setVisibility(View.VISIBLE);
                      
jawabannya.setText("");
                      
salahbenar.setText("");
           }
                 else{
                       Intent i = new
Intent(Game.this, Hasil.class);
                      
i.putExtra("BENAR", benar);
                      
i.putExtra("SALAH", salah);
                       startActivity(i);
                 }
     }
}
    Tampilan Hasil
       Pada package explorer, pilih Matematika >
klik kanan –New> Android XML File 
> beri nama hasil.xml
    Tuliskan
kode dibawah ini :
<?xml
version="1.0" encoding="utf-8"?>
<RelativeLayout
 
xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
 
android:background="@drawable/hasil"
  android:id="@+id/rel"
  >
<TextView
android:text="Total Jawaban :"
      android:id="@+id/hasil01"
     
android:layout_width="wrap_content"
     
android:layout_height="wrap_content"
      android:textColor="#000000"
      android:textSize="25dp"
     
android:layout_centerInParent="true">
</TextView>
<TextView
android:text="YOUR SKOR"
      android:id="@+id/Slamat"
     
android:layout_width="wrap_content"
     
android:layout_height="wrap_content"
      android:textColor="#000000"
      android:textSize="45dp"
     
android:layout_centerHorizontal="true"
      android:layout_marginTop="60px">
</TextView>
<Button
android:layout_height="wrap_content"
      android:id="@+id/Back"
      android:text="KEMBALI"
     
android:layout_width="wrap_content"
     
android:layout_alignParentBottom="true">
</Button>
</RelativeLayout>
Tuliskan
kode dibawah ini :
   package
com.droid.matematika;
   import
android.app.Activity;
   import
android.content.Intent;
  import
android.os.Bundle; 
  import
android.view.View;
   import
android.view.View.OnClickListener;
   import
android.widget.Button;
   import
android.widget.TextView;
   public class Hasil
extends Activity implements OnClickListener{
     TextView nilai;
     Button back;
     @Override
   public void onCreate(Bundle
savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.hasil);
       int benar =
getIntent().getIntExtra("BENAR", 0);
       int salah =
getIntent().getIntExtra("SALAH", 0);
       nilai =(TextView)findViewById(R.id.hasil01);
       nilai.setText("Jawaban Benar:
"+benar+" Jawaban Salah: "+salah);
       back=(Button)findViewById(R.id.Back);
       back.setOnClickListener(this);
     }
     @Override
     public void onClick(View v) {
           // TODO Auto-generated method stub
           if (v==back)
           {
                 Intent i = new
Intent(Hasil.this, Menu.class);
                 startActivity(i);
           }
     Semoga membantu, kalau masi bingung coa baca dari awal ya
Bila terjadi error atau debug pada saat meRun bisa langsung tanyakan
via email di chlorine.tiara@gmail.com
via ask.fm ask.fm/chtiara
Makasih, Salam Blogger 
 
Langganan:
Komentar (Atom)




 