开发者

How to let the user select which Activity to start when application starts?

开发者 https://www.devze.com 2023-02-09 05:22 出处:网络
I want the user to select which Activity the application should start on. I am trying to开发者_Go百科 avoid tabs because I don\'t like the layout of tabs, but I have a custom title bar that has three

I want the user to select which Activity the application should start on. I am trying to开发者_Go百科 avoid tabs because I don't like the layout of tabs, but I have a custom title bar that has three icons on which to select functionality/activity.

I want the user to select which activity the application should start from the beginning with a user preferences.

How can I do this?


After starting the main activity, immediately read from the settings and start the user preferred activity.


I also offer an alterntaive soultion. This is not an exact answer to your question though, but may help you to solve your problem in an elegant way.

  1. Subclass TabWidget and define how the row with tabs is drawn.
  2. Create a layout file for TabHost with your TabWidget in it.
  3. Subclass TabActivity and set your own layout you've created.
  4. Read the saved settings and use setDefaultTab method to set the preferred activity.

Voila! You got your own look without losing any functionality of TabActivity. You can read Tab Layout Tutorial for more information on how to do it properly.


What so tough in this. if i have three activity and that i want user to pick one which to start.

at least one activity has to be served as menu to the user from which user will pick. This will be main activity of app

. i will display three buttons in it and on their specific click i will initiate the respective activity.

0

精彩评论

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