myEditText.getText().toString() giving null pointer excep!!!

Basic Tutorials concerning: GUI, Views, Activites, XML, Layouts, Intents, ...

myEditText.getText().toString() giving null pointer excep!!!

Postby sheshi85 » Mon Jun 15, 2009 9:22 am

all the methods of edittext not working.u try doin it it gives a dialog telling the opration is unexpectedly stopped!!!!!!!!!!!!!!!!!!!!!!!!!!
dont know what is wrong,tried out in all blogs but did not get any reply
Attachments
TestSearch.java
(1.74 KiB) Downloaded 146 times
sheshi85
Junior Developer
Junior Developer
 
Posts: 15
Joined: Mon Jun 08, 2009 11:17 am

Top

Postby WarrenFaith » Mon Jun 15, 2009 12:11 pm

Have you checked what object is null?
Is it myEditText not null? Returns getText() not null? Or is toString() generating a null pointer?

Have you used a custom EditText or the default built in?
WarrenFaith
Moderator
Moderator
 
Posts: 227
Joined: Fri Mar 13, 2009 10:59 am
Location: Berlin, Germany

rectified the problem

Postby sheshi85 » Thu Jun 18, 2009 11:23 am

Thanks a lot for the reply.
it was EditText myEditText=(EditText)findViewById(R.layout.myedittext);
now I cahnged it to EditText myEditText=(EditText)findViewById(R.Id.myedittext);
it started working
sheshi85
Junior Developer
Junior Developer
 
Posts: 15
Joined: Mon Jun 08, 2009 11:17 am

Top

Return to Novice Tutorials

Who is online

Users browsing this forum: No registered users and 5 guests