开发者

how to skip an activity once its not needed? android [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

im doing a starting setup settings thing for my app and i was wondering how i can get it to skip the sign up page once they have already entered once? an if statement would be the thing I thought but im not so good with if statem开发者_开发知识库ents in android so could anyone point me in the direction for a solution?


Store a value in SharedPreferences (e.g. boolean loggedIn=true) once the login data has been entered and saved. Then every time you start your app get the value from SharedPreferences and decide whether to show the login-window (loggedIn==false) or not (loggedIn==true).


I've done this by having an Activity with no UI as my startup activity which checks for the existence of a prefernce setting and then launches either the sign up activity or the main activity depending on whether or not the preference setting exists.

In the androidmanifest you can register your activity with no UI using something like this (if I remember correctly):

android:theme="@android:style/Theme.NoDisplay"

After launching your chosen activity you need to call finish() in the UI-less activity


you should maintain a boolean and save it in SharedPreference and check it there and perform your task accordingly.......

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜