Advertisement
kernel_memory_dump

Untitled

Apr 14th, 2014
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.71 KB | None | 0 0
  1. package rajak.igre.kviz;
  2.  
  3. import java.util.ArrayList;
  4.  
  5. import rajak.igre.kviz.model.Pitanje;
  6. import android.app.Activity;
  7. import android.app.ActionBar;
  8. import android.app.Fragment;
  9. import android.os.Bundle;
  10. import android.view.LayoutInflater;
  11. import android.view.Menu;
  12. import android.view.MenuItem;
  13. import android.view.View;
  14. import android.view.ViewGroup;
  15. import android.widget.RadioButton;
  16. import android.widget.RadioGroup;
  17. import android.widget.TextView;
  18. import android.os.Build;
  19.  
  20. public class MainActivity extends Activity {
  21.  
  22.    
  23.    
  24.     private int trenutnoPitanje;
  25.     private int score;
  26.     private ArrayList<Pitanje> pitanja;
  27.    
  28.     // reference na elemente interfejsa
  29.     private RadioButton rbtnA;
  30.     private RadioButton rbtnB;
  31.     private RadioButton rbtnC;
  32.     private RadioGroup rgrpOpcije;
  33.     private TextView txtPitanje;
  34.  
  35.    
  36.    
  37.    
  38.     @Override
  39.     protected void onCreate(Bundle savedInstanceState) {
  40.         super.onCreate(savedInstanceState);
  41.         setContentView(R.layout.activity_main);
  42.        
  43.         trenutnoPitanje = 0;
  44.         score = 0;
  45.        
  46.         rbtnA = (RadioButton) findViewById(R.id.rbtnOpcijaA);
  47.         rbtnB = (RadioButton) findViewById(R.id.rbtnOpcijaB);
  48.         rbtnC = (RadioButton) findViewById(R.id.rbtnOpcijaC);
  49.         txtPitanje = (TextView) findViewById(R.id.txtPitanje);
  50.         rgrpOpcije =(RadioGroup)findViewById(R.id.rgrpOpcije);
  51.         //RadioButton answer=(RadioButton)findViewById(grp.getCheckedRadioButtonId());
  52.        
  53.         pitanja = new ArrayList<Pitanje>();
  54.         pitanja.add(new Pitanje("Koje boje je nebo?", "Plavo", "Zuto", "Zeleno","Plavo"));
  55.         pitanja.add(new Pitanje("Da li je Android Linux?", "Ne", "Da", "Samo koristi Kernel njegov","Samo koristi"
  56.                 + "Kernel njegov"));
  57.         pitanja.add(new Pitanje("Koliko je 2 +2", "4", "2", "9", "4"));
  58.         pitanja.add(new Pitanje("Koje boje je Android maskota", "Zelene", "Plave", "Crvene","Zelene"));
  59.         pitanja.add(new Pitanje("?", "Plavo", "Zuto", "Zeleno","Plavo"));
  60.        
  61.        
  62.         // treba podesiti pocetni izgled ekrana
  63.         // iz trenutnog pitanja izvucem opcijeA,B i C
  64.         // i namestim TEXT odgovarajucih radiobutton-a
  65.         rbtnA.setText  (pitanja.get(trenutnoPitanje).getOpcijaA()  );
  66.         rbtnB.setText  (pitanja.get(trenutnoPitanje).getOpcijaB()  );
  67.         rbtnC.setText  (pitanja.get(trenutnoPitanje).getOpcijaC()  );
  68.         txtPitanje.setText(  pitanja.get(trenutnoPitanje).getTxtPitanja());
  69.        
  70.  
  71.    
  72.        
  73.        
  74.     }
  75.    
  76.     public void sledece(View v){
  77.        
  78.     }
  79.  
  80.  
  81.     @Override
  82.     public boolean onCreateOptionsMenu(Menu menu) {
  83.        
  84.         // Inflate the menu; this adds items to the action bar if it is present.
  85.         getMenuInflater().inflate(R.menu.main, menu);
  86.         return true;
  87.     }
  88.  
  89.     @Override
  90.     public boolean onOptionsItemSelected(MenuItem item) {
  91.         // Handle action bar item clicks here. The action bar will
  92.         // automatically handle clicks on the Home/Up button, so long
  93.         // as you specify a parent activity in AndroidManifest.xml.
  94.         int id = item.getItemId();
  95.         if (id == R.id.action_settings) {
  96.             return true;
  97.         }
  98.         return super.onOptionsItemSelected(item);
  99.     }
  100.  
  101.     /**
  102.      * A placeholder fragment containing a simple view.
  103.      */
  104.     public static class PlaceholderFragment extends Fragment {
  105.  
  106.         public PlaceholderFragment() {
  107.         }
  108.  
  109.         @Override
  110.         public View onCreateView(LayoutInflater inflater, ViewGroup container,
  111.                 Bundle savedInstanceState) {
  112.             View rootView = inflater.inflate(R.layout.fragment_main, container, false);
  113.             return rootView;
  114.         }
  115.     }
  116.  
  117. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement