大家好,我正在开发一个有 7 个屏幕的 android 应用程序。当我调试我的应用程序时它工作正常,当我在 4 屏幕上单击主页按钮并再次启动我的应用程序时,它从应用程序进入后台的同一个屏幕/4 屏幕开始,但是当我为我的用户创建 app.apk 文件和当他们使用该应用程序并假设在第 4 个屏幕上按主页键时,他/她重新启动应用程序从登录屏幕/1 屏幕的起始屏幕开始。有没有朋友可以告诉我这里面有什么问题,我能做些什么来解决这个问题。
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.dblist);
setTitle("Databases");
try {
jsonObj = new JSONObject(getIntent().getStringExtra("key"));
nameArray = jsonObj.names();
valArray = jsonObj.getJSONArray("DbList");
} catch (JSONException e1) {
e1.printStackTrace();
}
ArrayAdapter<String> dbName = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1);
for (Integer i = 0; i < valArray.length(); i++) {
try {
String obj = valArray.getJSONObject(i)
.getString("DataBaseName").toString();
dbName.add(obj);
} catch (JSONException e) {
}
}
setListAdapter(dbName);
}
@Override
protected void onResume() {
super.onResume();
// versionUpdate();
Logout lo = new Logout();
lo.Check();
processThreadLogoutTime();
}
final Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
super.handleMessage(msg);
int compareTime = 1;
if (diff >= compareTime) {
Intent intent = new Intent(ShowDbList.this, LoginActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
}
}
};
protected void processThreadLogoutTime() {
new Thread() {
public void run() {
cw = new ConnectToWebService();
getMethod gm = getMethod.GetApplicationDetails;
String result = cw.getUrl("", gm);
String urlLogoutTime = result.replaceAll(" ", "%20");
cw.LogoutTime(urlLogoutTime);
Logout logout = new Logout();
diff = logout.LogoutFun();
handler.sendEmptyMessage(0);
}
}.start();
}
@Override
protected void onListItemClick(ListView l, View v, int position, long id) {
String item = (String) getListAdapter().getItem(position);
Entities.DataBaseName = item;
try {
String webAdmin = valArray.getJSONObject(position)
.getString("WebAdmin").toString();
Integer uId = Integer.parseInt(valArray.getJSONObject(position)
.getString("UserID"));
Entities.webAdmin = webAdmin;
Entities.userId = uId;
} catch (JSONException e) {
// TODO Auto-generated catch block
}
Intent intent = new Intent(v.getContext(), Menu.class);
startActivity(intent);
}