简体   繁体   English

如何只显示一次提交屏幕?

[英]How to display Submit Screen only one time?

I am using this code in main activity for display Registration detail page only one time. 我仅在一次活动中使用此代码显示“注册详细信息”页面。

setContentView(R.layout.register_data);
startActivity(new Intent(RegisterDetail.this, MainActivity.class));

getSharedPreferences("PREFERENCE", MODE_PRIVATE)
boolean isFirstRun = getSharedPreferences("PREFERENCE", MODE_PRIVATE).getBoolean("isFirstRun", true);
if (isFirstRun){
    .edit()
    .putBoolean("isFirstRun", false)
    .apply();
}

but I have problem. 但是我有问题 If some one close app without submit details and reopen app, that page doesn't display. 如果某个关闭的应用程序没有提交详细信息并重新打开应用程序,则不会显示该页面。 I want to display register_data page until user doesn't submit details. 我想显示register_data页面,直到用户不提交详细信息。

共享的首选项在活动之间共享-为什么不仅在收到确认输入了注册详细信息(并正确保存在服务器端)的确认后才写首选项?

Change the MODE_PRIVATE to Context.MODE_PRIVATE while creating the file and one problem is that you are calling startActivity(...) before checking if the PREFERENCE.xml file contains true or false. 创建文件时将MODE_PRIVATE更改为Context.MODE_PRIVATE ,一个问题是您在检查PREFERENCE.xml文件是否包含true或false之前调用了startActivity(...) So first check whats is present inside the file and that accordingly take the action 因此,首先检查文件中存在什么,然后采取相应措施

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在GUI中一次只能显示一个项目 - Can only display one item at a time in GUI 对 android 应用程序进行编程:如何使其显示一次性设置屏幕 - For programming an android app: How do I make it display a one time setup screen 在JPanel中绘制捕获的屏幕图像,图像又显示一次?我如何将其固定为显示一个定时? - Drawing Captured Screen Image in JPanel ,Image is displayed one more time ?How can I fix it to be display one timw? 如何实现只有一次登录活动在启动画面下次打开后,它将在android中打开直接主要活动 - How to Implement Only one time login activity open after splash screen next time it will open direct main activity in android 如何在屏幕上只运行一个片段? - How to run only one fragment on screen? 仅在应用程序启动时显示启动画面,而不是每次调用包含启动画面代码的活动时显示启动画面 - Display splash screen only when the app is launched and not every time when the activity containing splash screen code, is called 如何仅从getCalendar()显示时间 - How to display Time only from getCalendar() java中的Jasper报告中只显示一次数据 - One time only data display on the Jasper report in java 如何使用imageView一次显示一张图像 - how to display one image at a time using imageView 如何只显示几秒钟的屏幕 Android Studio - How to display a screen only for some seconds Android Studio
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM