Guest User

Untitled

a guest
Apr 20th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. package org.bastos;
  2.  
  3. import java.util.Random;
  4.  
  5. import android.app.Activity;
  6. import android.os.Bundle;
  7. import android.widget.TextView;
  8.  
  9. public class OhMyGOd extends Activity {
  10. /** Called when the activity is first created. */
  11. @Override
  12. public void onCreate(Bundle savedInstanceState) {
  13. super.onCreate(savedInstanceState);
  14. setContentView(R.layout.main);
  15.  
  16. final TextView helloTextView =
  17. (TextView) findViewById(R.id.hello);
  18. //final String helloText = helloTextView.getText().toString();
  19. helloTextView.setText(this.getAcronym());
  20. }
  21.  
  22. public String getAcronym(){
  23. String acronymList = this.getString(R.string.acronym_list);
  24. String[] acronyms = acronymList.split("\n");
  25. Integer index = new Random().nextInt(acronyms.length-1);
  26. return acronyms[index];
  27. }
  28. }
Add Comment
Please, Sign In to add comment