我收到以下错误:
08-27 17:49:17.995: E/AndroidRuntime(10085): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
08-27 17:49:17.995: E/AndroidRuntime(10085): at android.os.Handler.<init>(Handler.java:121)
08-27 17:49:17.995: E/AndroidRuntime(10085): at android.widget.Toast$TN.<init>(Toast.java:361)
08-27 17:49:17.995: E/AndroidRuntime(10085): at android.widget.Toast.<init>(Toast.java:97)
08-27 17:49:17.995: E/AndroidRuntime(10085): at android.widget.Toast.makeText(Toast.java:254)
运行第一行时:
public static void alertUser(String str) {
Toast toast = Toast.makeText(mInstance.getApplicationContext(), str,
Toast.LENGTH_LONG);
toast.show();
}
我怎样才能解决这个问题?