Android 应用程序崩溃时,我正在恢复很长时间后,这是在后台
长时间后从后台恢复活动时,我的应用程序显示“无响应”。当我单击“确定”关闭应用程序时,应用程序出现。我没有使用OnResume方法。我正在犯错误Android 应用程序崩溃时,我正在恢复很长时间后,这是在后台,android,onresume,Android,Onresume,长时间后从后台恢复活动时,我的应用程序显示“无响应”。当我单击“确定”关闭应用程序时,应用程序出现。我没有使用OnResume方法。我正在犯错误 Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter,
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);
}
}
@覆盖
创建时受保护的void(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_秒);
如果(!IsMyService正在运行(服务类))
{
startService(新意图(此,服务类));
}
状态=(EditText)findViewById(R.id.status);
btn_send=(ImageButton)findviewbyd(R.id.btn_send);
btn_send.setOnClickListener(此);
contlist=(ListView)findViewById(R.id.contlist);
SharedPreferences=PreferenceManager.getDefaultSharedPreferences(此);
字符串y=prefs.getString(“mobstat”,null);
状态.setText(y);
status.setSelection(status.getText().length());
if(!prefs.getBoolean(“firstTime”,false))
{
尝试
{
getNumber(seconds.this.getContentResolver());
}捕获(JSONException e)
{
e、 printStackTrace();
}
SharedReferences.Editor=prefs.edit();
编辑:putBoolean(“第一次”,真);
editor.apply();
}
非索普伦();
}
专用布尔值isMyServiceRunning(类serviceClass)
{
ActivityManager=(ActivityManager)getSystemService(Context.ACTIVITY_服务);
对于(ActivityManager.RunningServiceInfo服务:manager.getRunningServices(Integer.MAX_值))
{
if(serviceClass.getName().equals(service.service.getClassName()))
{
返回true;
}
}
返回false;
}
私有无效非操作程序()
{
handler=新的handler();
update=newrunnable()
{
@凌驾
公开募捐
{
musers=(ArrayList)mobstat.listAll(mobstat.class);
descAdapter=新的descAdapter(秒。此,缪斯,秒。此);
contlist.setAdapter(descAdapter);
handler.postDelayed(这个,1000);
}
};
handler.postDelayed(更新,10);
}
}
我搜索了上述错误,但没有解决此问题的答案。长时间后打开应用程序时出现相同问题。请提供日志。我只收到上面问题中提到的错误。错误消息似乎与问题无关。您是否使用静态变量存储内容?有一个变量存储URL public static final String FetchURL=”“public static final String FetchURL1=“”。您必须提供更多日志,您显示的内容既不相关也不足以分析您的问题