rennoDeniro
rennoDeniro

Reputation: 928

Android application design help, How to control which activity shows

Hello I require some advice on how to approach this problem, bear with me as I am still new to android.

I have an activity that opens on application start and requires some information from the user, but next time the user opens the app, i want the application to open a different activity that will display the various information. Kind of like facebooks app, where when you first run it, you have to login, and only then next time you run the app you are guided straight to the feed.

Any ideas how one could do this efficiently?

UPDATE: Ive stored the information via shared preferences and am now using a controller activity that decides which step to take. So, Controller activity runs on start up, and decides whether to show a log in screen or whether to go straight to the information. But now im encountering a problem where i end up opening a blank activity (the controller) and then another ontop of that ( the decided activtiy). I dont want the blank activity to show, so its kinda of like a background process, any ideas?

Upvotes: 3

Views: 450

Answers (1)

midhunhk
midhunhk

Reputation: 5554

Ideally you would have a main activity like a controller. Use a SharedPreference object to keep track of whether the user is logged in or not. So back in your main activity, read this value and if it is set go to your news feed activity else show a login screen activity. (as you do the check and redirection, you can show a progress dialog)

links for SharedPreferences

MobTuts

Android Developer

Upvotes: 1

Related Questions