|
android应用开发:第一次打开app时是欢迎页,推出之后每次再打开都直接进入主页面,如何设计app的页面关系 |
|
| 5分 |
在欢迎界面判断一下,如果不是第一次启动,就跳转到主界面。是的话,不跳转。
|
|
怎么判断呢?求示例!谢谢
|
|
|
怎么判断呢?求示例!谢谢
|
|
|
可以利用各种存储来判断是否第一次启动,比如sp,比如xml
|
|
| 5分 |
笨点就写个一个文件上,聪明点就用个SharedPreferences
|
| 10分 |
正好我的应用里面有这个,就分享给你了:在mainfest中guide页<action android:name=”android.intent.action.MAIN” />
guide页面: private SharedPreferences sharepreferences;
private SharedPreferences.Editor editor;
....
oncreat()
sharepreferences=this.getSharedPreferences("check", MODE_PRIVATE);
editor=sharepreferences.edit();
boolean fristload=sharepreferences.getBoolean("fristload", true);
if (!fristload) {
Intent intent = new Intent();
intent.setClass(this,toActivity.class);
startActivityForResult(intent,0);
}
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
editor.putBoolean("fristload", false);
Intent intent = new Intent();
intent.setClass(this,toActivity.class);
startActivityForResult(intent, 0);
}
}
});
|
|
5854符合国家和国家
|
|
|
这种方法在安装新版本应用是不是会删除fristload值的,所以安装新版本的时候还是不会进入到第一次启动的界面 |
|
|
直接用sharepreferences存版本号,然后判断大小就好的。
|
|
|
你没有editor.commit(); |
|