Skip to content

Instantly share code, notes, and snippets.

@bastos
Created November 23, 2009 18:28
Show Gist options
  • Save bastos/241260 to your computer and use it in GitHub Desktop.
Save bastos/241260 to your computer and use it in GitHub Desktop.
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];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment