我有一个代码可以检查一些数据并在非活动类中显示警报。但是在运行应用程序时崩溃并且不显示警报对话框。我用下面的代码...
if( str.isEmpty() || strPort.isEmpty()){
new AlertDialog.Builder(Mtx.getContext())
.setMessage("Please provide a valid String")
.setTitle("HAT Alert !!!")
.setCancelable(true)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton){
return;
}
}).show();
Mtx.getContent() 方法的代码
public class Mtx extends Application {
public static Context context;
@Override
public void onCreate(){
super.onCreate();
Mtx.context = getApplicationContext();
}
public static Context getContext(){
return Mtx.context;
}
}
日志猫中显示的错误消息
10-15 12:50:33.708: E/global(329): Deprecated Thread methods are not supported.
10-15 12:50:33.708: E/global(329): java.lang.UnsupportedOperationException
10-15 12:50:33.708: E/global(329): at java.lang.VMThread.stop(VMThread.java:85)
10-15 12:50:33.708: E/global(329): at java.lang.Thread.stop(Thread.java:1280)
10-15 12:50:33.708: E/global(329): at java.lang.Thread.stop(Thread.java:1247)
10-15 12:50:33.708: E/global(329): at mediatronix.HAT.Splash$1.run(Splash.java:36)
请纠正我
谢谢