Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.bastos;
- import java.util.Random;
- import android.app.Activity;
- import android.os.Bundle;
- import android.widget.TextView;
- public class OhMyGOd extends Activity {
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
- final TextView helloTextView =
- (TextView) findViewById(R.id.hello);
- //final String helloText = helloTextView.getText().toString();
- helloTextView.setText(this.getAcronym());
- }
- public String getAcronym(){
- String acronymList = this.getString(R.string.acronym_list);
- String[] acronyms = acronymList.split("\n");
- Integer index = new Random().nextInt(acronyms.length-1);
- return acronyms[index];
- }
- }
Add Comment
Please, Sign In to add comment