我想在每次第一次更新或安装应用程序后打开我的应用程序时运行服务.如何在启动后检查App是否首次打开?
我试过这个但是onCreate方法中的代码,但我在更新我的代码时得到isFirst = true,但是它应该是空白/ null以便我可以运行我的服务.我哪里错了?
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
isFirst = sPrefs.getString(Utility.KEY_IS_FIRST, "");
if(isFirst == null || isFirst.equalsIgnoreCase("")){
//run service and set isFirst = true
SharedPreferences preferences = PreferenceManager
.getDefaultSharedPreferences(Activity_Home.this);
SharedPreferences.Editor edit = preferences.edit();
edit.putString(Utility.KEY_IS_FIRST, "true");
edit.commit();
}
}
Run Code Online (Sandbox Code Playgroud) 我在ui上面有两个按钮"Submit"和"Reset",下面是我的表格.问题是当我打开键盘时,表单向上滚动并位于顶部按钮布局下方.应该是什么问题?我想只在顶部显示buutons.