Hi,
I am new To android.I have Some Code..I have
Simple.java :
public class Simple extends Activity {
/** Called when the activity is first created. */
Button show;
TextView view;
EditText edit;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
show=(Button)findViewById(R.id.show);
view=(TextView)findViewById(R.id.view);
edit=(EditText)findViewById(R.id.edit);
show.setOnClickListener(new OnClickListener(){
public void onClick(View view){
show();
}
});
}
public void show(){
String text=edit.getText().toString();
view.setText(text);
Intent t=new Intent(this,Show.class);
startActivity(t);
}
}
When i tried To Display the text in the same activity it works... I am trying to pass the text Which i typed in EditText and to display it to Show.class
the code for Show.class
public class Show extends Activity {
private Simple simple;
TextView text1;
Button back;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.next);
back=(Button)findViewById(R.id.button);
text1=(TextView)findViewById(R.id.then);
back.setOnClickListener(new OnClickListener(){
public void onClick(View view){
start();
}
});
}
public void start(){
String t=simple.edit.getText().toString();
text1.setText(t);
Intent t=new Intent(this,Simple.class);
startActivity(t);
}
}
I tried this one I am not able to Display the text which i gave in editText in Simple.java. I know it is basic but I do know. So Please Help me out.Thanks in Advance..