嗨每個人都在開發一個Android應用程序,其中有7個屏幕。 當我調試我的應用程序時,它工作正常,當我點擊4個屏幕上的主頁按鈕,並再次啓動我的應用程序,它從應用程序進入背景的同一屏幕/ 4屏幕開始,但是當我爲我的用戶創建app.apk文件當他們使用該應用程序並按Home鍵假設在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);
}
您可以發佈您的錯誤日誌? – Piyush
您的應用程序因用戶而死亡,所以當他們再次啓動應用程序時,它會重新啓動。但是當你在你的模擬器上測試它時,它可能不會被殺死,因此它從它離開的地方恢復。而且,實際上,你無法提供幫助,Android在有需求時會殺死應用程序(如內存)。 –
當你從一個活動轉移到另一個活動或請分享活動4的代碼時,你正在使用完成()。 –