I'm very new to android and java, so I don't have a very good understanding of how to work through certain problems other than taking wild stabs here and there.
The problem i'm trying to overcome is generating a simple random number between 1 and 9 from the click of a button and getting that number to appear in a TextView. This is what I have so far, but it always fails at the .setText() public class AndroidRandom extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); Button b = (Button)findViewById(R.id.Button); b.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { TextView a = (TextView)findViewById(R.id.Output); long tim = System.currentTimeMillis(); Random random = new Random(tim); int RandomNumber = random.nextInt(9); a.setText(RandomNumber); } }); } } -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en