Advertisement
kernel_memory_dump

Kviz in progress

Apr 14th, 2014
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.99 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.TextView;
  17. import android.os.Build;
  18.  
  19. public class MainActivity extends Activity {
  20.  
  21.    
  22.    
  23.     private int trenutnoPitanje;
  24.     private int score;
  25.     private ArrayList<Pitanje> pitanja;
  26.    
  27.     // reference na elemente interfejsa
  28.     private RadioButton rbtnA;
  29.     private RadioButton rbtnB;
  30.     private RadioButton rbtnC;
  31.     private TextView txtPitanje;
  32.  
  33.    
  34.    
  35.    
  36.     @Override
  37.     protected void onCreate(Bundle savedInstanceState) {
  38.         super.onCreate(savedInstanceState);
  39.         setContentView(R.layout.activity_main);
  40.        
  41.         trenutnoPitanje = 0;
  42.         score = 0;
  43.        
  44.         rbtnA = (RadioButton) findViewById(R.id.rbtnOpcijaA);
  45.         rbtnB = (RadioButton) findViewById(R.id.rbtnOpcijaB);
  46.         rbtnC = (RadioButton) findViewById(R.id.rbtnOpcijaC);
  47.         txtPitanje = (TextView) findViewById(R.id.txtPitanje);
  48.        
  49.         pitanja = new ArrayList<Pitanje>();
  50.         pitanja.add(new Pitanje("Koje boje je nebo?", "Plavo", "Zuto", "Zeleno","Plavo"));
  51.         pitanja.add(new Pitanje("Da li je Android Linux?", "Ne", "Da", "Samo koristi Kernel njegov","Samo koristi"
  52.                 + "Kernel njegov"));
  53.         pitanja.add(new Pitanje("Koliko je 2 +2", "4", "2", "9", "4"));
  54.         pitanja.add(new Pitanje("Koje boje je Android maskota", "Zelene", "Plave", "Crvene","Zelene"));
  55.         pitanja.add(new Pitanje(""?", "Plavo", "Zuto", "Zeleno","Plavo"));
  56.        
  57.        
  58.        
  59.        
  60.      
  61.    }
  62.  
  63.  
  64.    @Override
  65.    public boolean onCreateOptionsMenu(Menu menu) {
  66.        
  67.        // Inflate the menu; this adds items to the action bar if it is present.
  68.        getMenuInflater().inflate(R.menu.main, menu);
  69.        return true;
  70.    }
  71.  
  72.    @Override
  73.    public boolean onOptionsItemSelected(MenuItem item) {
  74.        // Handle action bar item clicks here. The action bar will
  75.        // automatically handle clicks on the Home/Up button, so long
  76.        // as you specify a parent activity in AndroidManifest.xml.
  77.        int id = item.getItemId();
  78.        if (id == R.id.action_settings) {
  79.            return true;
  80.        }
  81.        return super.onOptionsItemSelected(item);
  82.    }
  83.  
  84.    /**
  85.     * A placeholder fragment containing a simple view.
  86.     */
  87.    public static class PlaceholderFragment extends Fragment {
  88.  
  89.        public PlaceholderFragment() {
  90.        }
  91.  
  92.        @Override
  93.        public View onCreateView(LayoutInflater inflater, ViewGroup container,
  94.                Bundle savedInstanceState) {
  95.            View rootView = inflater.inflate(R.layout.fragment_main, container, false);
  96.            return rootView;
  97.        }
  98.    }
  99.  
  100. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement