当我的应用程序在很长一段时间后从后台恢复活动时显示“没有响应”。当我点击“确定”关闭应用程序时,会出现应用程序。我没有使用OnResume方法。我收到了以下错误
Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter,
android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
活动代码:
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_seconds);
if(!isMyServiceRunning(serv.class))
{
startService(new Intent(this, serv.class));
}
status = (EditText)findViewById(R.id.status);
btn_send = (ImageButton) findViewById(R.id.btn_send);
btn_send.setOnClickListener(this);
contlist = (ListView)findViewById(R.id.contlist);
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
String y = prefs.getString("mobstat",null);
status.setText(y);
status.setSelection(status.getText().length());
if(!prefs.getBoolean("firstTime", false))
{
try
{
getNumber(seconds.this.getContentResolver());
} catch (JSONException e)
{
e.printStackTrace();
}
SharedPreferences.Editor editor = prefs.edit();
editor.putBoolean("firstTime", true);
editor.apply();
}
nonstoprun();
}
private boolean isMyServiceRunning(Class<?> serviceClass)
{
ActivityManager manager = (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE))
{
if (serviceClass.getName().equals(service.service.getClassName()))
{
return true;
}
}
return false;
}
private void nonstoprun()
{
handler = new Handler();
update = new Runnable()
{
@Override
public void run()
{
musers = (ArrayList<mobstat>) mobstat.listAll(mobstat.class);
descAdapter = new DescAdapter(seconds.this, musers, seconds.this);
contlist.setAdapter(descAdapter);
handler.postDelayed(this , 1000);
}
};
handler.postDelayed(update, 10);
}
}
我搜索了上述错误,但没有解决此问题的答案。我在很长一段时间后打开应用程序时出现同样的问题。