H
H
hudrogen2014-05-29 19:10:58
Java
hudrogen, 2014-05-29 19:10:58

How to change the entry point in the application for android?

If you create a new project in Eclipse by default, it creates one class and markup for it. Next, I manually add a new Activity. Where can I change something so that at startup it starts not the standard Activity, but the one that I created later manually?
PS I tried to add in the manifest

<intent-filter>
               <action android:name="android.intent.action.MAIN" />

               <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

for the second activity, and remove this intent filter for the first one. This method doesn't work.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vladimir Yakushev, 2014-05-29
@hudrogen

I tried to add in the manifest for the second activity, and remove this intent filter for the first

This method works and is the only true one. How exactly do you figure out that it's not working?

G
GavriKos, 2014-05-29
@GavriKos

Eclipse in the launch configuration settings (what works when you click on launch) has a parameter like "what to do after launch": yadi.sk/d/KS549Ht7RdnqV - see if you have a hard-coded activity that you need to launch.

D
dr_yand, 2014-05-29
@dr_yand

The following parameters are responsible for the entry point (Activity to launch)

<intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

For example, the following parameters will force the creation of two application shortcuts, which, when clicked, will launch a specific activity. Those. will look like two applications are installed.
<activity
            android:name="com.example.test4.MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.example.test4.MainActivity2"
            android:label="@string/app_name2" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question