请原谅我,因为我对android很新。每当我的应用程序从睡眠模式唤醒时,我都会尝试启动登录页面(Login Activity)。示例:我的应用程序在我的主活动中进入睡眠模式。当它唤醒时,我想将活动设置为登录活动而不是返回主活动。我读了一些关于onResume的东西,我试过但我的应用程序崩溃了。非常感谢任何建议或建议。提前谢谢。
主要活动
public class UserMainActivity extends TabActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_main);
TabHost tabHost = getTabHost();
// List view
TabSpec list = tabHost.newTabSpec("List view");
list.setIndicator("List view");
Intent listIntent = new Intent(this, UserListActivity.class);
list.setContent(listIntent);
// Grid view
TabSpec grid = tabHost.newTabSpec("Grid view");
grid.setIndicator("Grid view");
Intent gridIntent = new Intent(this, UserGridActivity.class);
grid.setContent(gridIntent);
// Update Info
TabSpec update = tabHost.newTabSpec("Update Info");
update.setIndicator("Update Info");
Intent updateIntent = new Intent(this, UpdateInformationUser.class);
update.setContent(updateIntent);
// Authentication
TabSpec auth = tabHost.newTabSpec("Unlock");
auth.setIndicator("Unlock");
Intent authIntent = new Intent(this, Authentication.class);
auth.setContent(authIntent);
// add all tabs
tabHost.addTab(list);
tabHost.addTab(grid);
tabHost.addTab(update);
tabHost.addTab(auth);
//set Windows tab as default (zero based)
tabHost.setCurrentTab(0);
}
}