-1

I need to make it so that after installation of the project, opened the activity of the "THREE (C)".A shortcut to the activities of the "THREE (C)" in the menu, applications do not need! In the application menu should be only 2 shortcut for the activity of the FIRST (A) and TWO (B). Thanks!

Here is a link to the project. (https://drive.google.com/file/d/0Bxhi0uFKK3upUVRNMGF5WU9xTW8/edit?usp=sharing)

GAAAN
  • 389
  • 2
  • 3
  • 14
  • 1
    You aren't being clear. Are you asking how to make Activity A run the first time the app is run, but skip A and run Activity B every time after that? – Gabe Sechan Jun 02 '14 at 18:38
  • hi! Thank you for responding. You watched my AndroidManifest file? After installing the application starts "FirstActivity", and I need after installation "TwoActivity". I put Intent-filter ".DEFAULT" on "TwoActivity". But after installing the application still runs "FirstActivity". – GAAAN Jun 02 '14 at 18:59
  • I think he means that he needs to have two shortcuts on the screen, one for the first activity, and one for the second. So he is looking for something in the vein of this: http://stackoverflow.com/questions/3270409/how-do-i-get-multiple-icons-to-launch-different-activities-in-one-application/3270422#3270422 – EpicPandaForce Jun 02 '14 at 19:13
  • No! Sorry! I well add two shortcut! It works perfectly! I need to do so after installation, when the user clicks "Open". Run the second activity. And in my case launched the first activity. Please See my file AndroidManifest. I placed a link to it. I think I need to specify additional options "Intent-filter"button after the setup was run a second operation. Sorry for my English, I translated through Google translator. – GAAAN Jun 02 '14 at 19:23
  • user clicks open?. A button click? – SMK Jun 02 '14 at 19:57
  • Please read my last comment at the bottom. When I press the "open" button (after installation). I run the activity "A", for which there is a shortcut in the application menu. I need to after installation, open the activity "С", for which there is no shortcut in the application menu. Thank you! – GAAAN Jun 02 '14 at 20:09

2 Answers2

1

How about having an Activity "C"? Activity "C" can be your splash screen to display while the app "loads" If the app is being used for the first time then it loads activity "A", else it loads activity "B". You would need to store off a Boolean in the shared preference to know if the app has been open before. Set it to true when activity "A" loads for the first time, then save it, so next time when your app loads it will load activity "B"

apmartin1991
  • 2,994
  • 1
  • 22
  • 43
  • Hi! Thanks For the tip! But I need to do to open the activity of "B" always! – GAAAN Jun 02 '14 at 19:28
  • I will try to explain it differently. For example, let's add one more activity. I have 3 Activity "A", "B"and "C". For activity "A" and "B" are the shortcuts menu of the application (that I know to do, you can see my file ANdroidManifest, I specify the desired "intent-filter" in the file AndroidManifest). I need to make after installing the application run activities "C" to which the shortcut is not created. Shortcuts I only needed for the activity "A" and "B". – GAAAN Jun 02 '14 at 19:40
  • The user may see the launcher icon as going to Activity A or B, but it can actually go to Activity C and have that silently figure out which activity it is appropriate to run on an initial/subsequent launch. – Chris Stratton Jun 02 '14 at 20:24
  • Is it something like this you require? http://www.basic4ppc.com/android/forum/threads/add-shortcuts-to-your-android-application.11444/ – apmartin1991 Jun 02 '14 at 22:46
  • No, sorry! I need not it. Please download my project, and read again the description of my problem. thanks..! – GAAAN Jun 03 '14 at 05:24
  • Sorry but it is very unclear what you are asking... – apmartin1991 Jun 03 '14 at 08:47
0

How about setting set content view for the secondactivity.xml layout in the MainActivity.java file?

When you first install your application and opens it. It always first goto MainActivity.java file. whatever view you set to setContentView will first appear in your application.

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

change activity_main .

SMK
  • 326
  • 3
  • 13
  • Sorry.. I can't understand? You want to see my Java file to the second activity? – GAAAN Jun 02 '14 at 19:46
  • read back I update it. – SMK Jun 02 '14 at 19:49
  • Generally you don't want to display the view for a different Activity than you are executing! – Chris Stratton Jun 02 '14 at 19:50
  • @ChrisStratton he says he has two layouts and two activities. And he says after install it opens his first activity I guess he means it opens his first layout. But he want the second one to appear. as I understood. – SMK Jun 02 '14 at 19:55
  • Yes, you have correctly understood!!! To make it easier to explain, I'll add activity "C". So... I can run any activity. I know how to do it. I will try to explain again.. I have three activity. "A" "B" and "C". For the activity "A" and "B" I create shortcuts from the applications menu. They work great. For activity "C" I don't want shortcuts. I need to start activity after you install applications. Activity "С" must be run when the user after installation on the Google play press the button "Open". – GAAAN Jun 02 '14 at 19:59
  • place your full code. layouts and .java files and all – SMK Jun 02 '14 at 20:01
  • Here is a link to the project. I need to make it so that after installation of the project, opened the activity of the "THREE (C)". In the application menu should be only 2 label for the activity of the FIRST (A) and TWO (B). https://drive.google.com/file/d/0Bxhi0uFKK3upUVRNMGF5WU9xTW8/edit?usp=sharing – GAAAN Jun 02 '14 at 20:30