1

I use a virtual android device on Eclipse When I write:

    @Override
    protected void onCreate(Bundle savedInstanceState)  {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
            Button but = (Button)findViewById(R.id.button1);
            but.setOnClickListener(this);
}

it works, what I want to appear appears on the device, but when I just add

EditText taille = (EditText)findViewById(R.id.taille);

in the function onCreate, I get a "the application has stopped unexpectedly, please try again", I often have those messages and I know where it comes from as nothing is written on the logcat, and the console has no error.

5
  • you mean the emulator crashes ?
    – sdabet
    Jan 17, 2013 at 14:43
  • Without seeing your code, I'd guess that taille isn't an EditText, thus you're getting a cast error. Run in debug and post your logcat.
    – 323go
    Jan 17, 2013 at 14:45
  • yes, I have to "force close" the application
    – morg
    Jan 17, 2013 at 14:46
  • add your xml layout code also then it will be easy to answer
    – TNR
    Jan 17, 2013 at 14:46
  • 323go was right, really sorry I did mix up between the android:id and android:hint of my EditText, I got the wrong ID that's why it didn't work. Sorry and thanks again! Yet: how can I see this error with the debug tool?
    – morg
    Jan 17, 2013 at 14:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.