Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package rajak.igre.kviz;
- import java.util.ArrayList;
- import rajak.igre.kviz.model.Pitanje;
- import android.app.Activity;
- import android.app.ActionBar;
- import android.app.Fragment;
- import android.os.Bundle;
- import android.view.LayoutInflater;
- import android.view.Menu;
- import android.view.MenuItem;
- import android.view.View;
- import android.view.ViewGroup;
- import android.widget.RadioButton;
- import android.widget.TextView;
- import android.os.Build;
- public class MainActivity extends Activity {
- private int trenutnoPitanje;
- private int score;
- private ArrayList<Pitanje> pitanja;
- // reference na elemente interfejsa
- private RadioButton rbtnA;
- private RadioButton rbtnB;
- private RadioButton rbtnC;
- private TextView txtPitanje;
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_main);
- trenutnoPitanje = 0;
- score = 0;
- rbtnA = (RadioButton) findViewById(R.id.rbtnOpcijaA);
- rbtnB = (RadioButton) findViewById(R.id.rbtnOpcijaB);
- rbtnC = (RadioButton) findViewById(R.id.rbtnOpcijaC);
- txtPitanje = (TextView) findViewById(R.id.txtPitanje);
- pitanja = new ArrayList<Pitanje>();
- pitanja.add(new Pitanje("Koje boje je nebo?", "Plavo", "Zuto", "Zeleno","Plavo"));
- pitanja.add(new Pitanje("Da li je Android Linux?", "Ne", "Da", "Samo koristi Kernel njegov","Samo koristi"
- + "Kernel njegov"));
- pitanja.add(new Pitanje("Koliko je 2 +2", "4", "2", "9", "4"));
- pitanja.add(new Pitanje("Koje boje je Android maskota", "Zelene", "Plave", "Crvene","Zelene"));
- pitanja.add(new Pitanje(""?", "Plavo", "Zuto", "Zeleno","Plavo"));
- }
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.main, menu);
- return true;
- }
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- // Handle action bar item clicks here. The action bar will
- // automatically handle clicks on the Home/Up button, so long
- // as you specify a parent activity in AndroidManifest.xml.
- int id = item.getItemId();
- if (id == R.id.action_settings) {
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
- /**
- * A placeholder fragment containing a simple view.
- */
- public static class PlaceholderFragment extends Fragment {
- public PlaceholderFragment() {
- }
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- View rootView = inflater.inflate(R.layout.fragment_main, container, false);
- return rootView;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement