[Android] Hello World x2

the_maniac

Disciple
I am sorry if this is not the correct forum or if the question seems very n00bish..

i just want to learn developemnt in android .. i am not expert in any of the programming language/platform. out of curiosity i picked up android to learn some simple coding.

The first thing I looked at was the Hello world program given here

Than I tried to modify the code to display 2 times "hello world"

This is how I visualized it :
Code:
hello world1
hello world2

but somehow it didn't happen the way i expected it to happen..and i kept getting "hello world 2" on the display ( i am using Eclispe with adt)
i tried to put sleep in the code as well but even then there was delay but no message "hello world1"

can someone tell me how i can get both the messages in the same screen?

my code:
Code:
package com.example.helloandroid; 
import android.app.Activity; 
import android.os.Bundle; 
import android.widget.TextView; 
public class HelloAndroid extends Activity { 
       @Override 
   public void onCreate(Bundle savedInstanceState) { 
       super.onCreate(savedInstanceState); 
       TextView tv = new TextView(this); 
       tv.setText("Hello, world1"); 
       setContentView(tv); 
/*---*/
TextView tv2 = new TextView(this); 
       tv2.setText("Hello, world2"); 
       setContentView(tv2); 
   } 
}
 
Back
Top