• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps 2nd update need to show output on screen

apdev

Lurker
I need to show the output on the screen from my if statement. Please be as specific as possible. I need something to put instead of
system.out.println("This") - I know this shows it on the log. I want to show on the screen.

Code:
  try 
{ PleaseEnter=(EditText)findViewById(R.id.PleaseEnter); 
 
  { 
   } 
 
  if ("1".equals(PleaseEnter.getText().toString().trim())) {
      // tv.setText("This is the display 1."); 
     system.out.println("This is 1") ; 
}
  
 else if  (PleaseEnter.equals("2")) 
     return; 
     //tv.setText("Dispaly 2");
 
You could either use Toast or a TextView. Toast would be simpler, though I am not sure if it meets your needs exactly. Furthermore, your code is horrid. It is formatted poorly and there are many wasted characters (such as the useless { and } right after the first line of the try statement. I suggest you read up on best coding practices.
 
Back
Top Bottom