Advertisement
Guest User

Untitled

a guest
Apr 20th, 2011
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. package bal.states;
  2.  
  3. import java.util.Random;
  4.  
  5. import android.app.Activity;
  6. import android.os.Bundle;
  7. import android.view.View;
  8. import android.widget.Button;
  9. import android.widget.TextView;
  10.  
  11. public class StateQuiz extends Activity {
  12. /** Called when the activity is first created. */
  13. @Override
  14. public void onCreate(Bundle savedInstanceState) {
  15. super.onCreate(savedInstanceState);
  16. setContentView(R.layout.main);
  17. initializeComponents();
  18. }
  19.  
  20. private TextView mainText;
  21. private Button scan;
  22. private String [] state;
  23. private String index;
  24. private Data dt;
  25.  
  26. public void initializeComponents(){
  27. mainText = (TextView) findViewById(R.id.mainText);
  28. scan = (Button) findViewById(R.id.scan);
  29. scan.setOnClickListener(new Button.OnClickListener() { public void onClick (View v){ try {
  30. run();
  31. } catch (Exception e) {
  32. // TODO Auto-generated catch block
  33. e.printStackTrace();
  34. } }});
  35.  
  36. }
  37.  
  38. public void run(){
  39. dt=new Data();
  40. state=new String [7];
  41. Random r = new Random(49);
  42. index=r.nextInt(49)+"";
  43. // index="4";
  44. mainText.setText("Hello3");
  45. State st = new State();
  46. dt.arr(index);
  47.  
  48. StringBuilder sb= new StringBuilder();
  49.  
  50. sb.append(st.getAbr());
  51. mainText.setText(sb.toString());
  52. }
  53.  
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement