android4.2 高用zing拍照后,返回其它页面操作时,主线程关掉或程序退出的问题解决

时间:2024-09-30 10:04:38

产生错误的代码:

@Override
protected void onCreate(Bundle savedInstanceState)
{
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectDiskReads().detectDiskWrites().detectNetwork().penaltyLog().build());
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectLeakedSqlLiteObjects().detectLeakedClosableObjects().penaltyLog().penaltyDeath().build());

super.onCreate(savedInstanceState);
setContentView(R.layout.pub_login);

findViews();
setListeners();

getLoginParam();

checkUpdate();
}

正常的代码:

@Override
protected void onCreate(Bundle savedInstanceState)
{
//StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectDiskReads().detectDiskWrites().detectNetwork().penaltyLog().build()); 
//StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectLeakedSqlLiteObjects().detectLeakedClosableObjects().penaltyLog().penaltyDeath().build());

super.onCreate(savedInstanceState);
setContentView(R.layout.pub_login);

findViews();
setListeners();

getLoginParam();

checkUpdate();
}