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

