What's wrong in this simple android Program, I get 'Force Close'.
- by andyfan
What is wrong in this program, My eclipse IDE doesn't show any errors....when I execute this simple program the emulator shows force close....Anybody please clarify
import android.app.Activity;
import android.view.View.OnClickListener;
import android.view.View;
import android.os.Bundle;
import android.widget.*;
public class HelloWorld extends Activity implements OnClickListener {
/** Called when the activity is first created. */
View Et1,Bt1,TxtDisp;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.name_getter);
Bt1=(Button)findViewById(R.id.Btn1);
Et1=(EditText)findViewById(R.id.UserInput);
TxtDisp=(TextView)findViewById(R.id.TextDisp);
Bt1.setOnClickListener(this);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
String userInput=((EditText) Et1).getText().toString();
((TextView)TxtDisp).setText(userInput);
}
}