java.lang.RuntimeException: Can't create handler inside thre

Search for BETA-testers and/or promote your own Application in a decent way.

java.lang.RuntimeException: Can't create handler inside thre

Postby mamungm » Thu Jul 23, 2009 11:53 am

Hi,

I am getting this runtime exception:

07-23 17:45:27.336: WARN/System.err(775): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare().



I first created a thread to call server for some data. Then the class which implements runnable and gets the data from server, calls another class through interface. In that class I called showDialog(0); and that class is an activity and overrides

@Override
public Dialog onCreateDialog(int id)
{
if(id == YES_NO_DIALOG)
{
return new AlertDialog.Builder(this)
.setIcon(R.drawable.yesno)
.setTitle("Are you sure")
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {

/* User clicked OK so do some stuff */
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {

/* User clicked Cancel so do some stuff */
}
})
.create();
}
}

Please help me how to get rid of this runtime exception.

G.M.Al-Mamun
Android software developer
mamungm
Once Poster
Once Poster
 
Posts: 1
Joined: Wed Jul 22, 2009 4:48 pm

Top

Return to Promote your Android Application

Who is online

Users browsing this forum: No registered users and 1 guest