patseb
patseb

Reputation: 651

One android application, two startup view, two two icons

I have my simple notepad application. It display input text and save button when launching. Everything works fine.

Now I want to keep all app logic, but use "second icon" to launch my app with other initial view (I want to set up numbers only filter on input text).

In other words:

Is there any method to create second icon/widget w/e to inform app that it should run in other way?

Upvotes: 0

Views: 364

Answers (1)

Chintan Raghwani
Chintan Raghwani

Reputation: 3370

Add another activity to your application,

also add that activyty to AndroidManidest with

different Icon and with intent-filter as action=main and catagory=LAUNCHER

Just see:

<application
        android:label="@string/app_name" >
        <activity
            android:icon="@drawable/ICON1"
                                    ^^^^^^
            android:name=".FirstActivity"
                           ^^^^^^
            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:icon="@drawable/ICON222"
                                    ^^^^^^^^
            android:name=".SecondActivity"
                           ^^^^^^
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

Also add another XML for only Number Type Input If needed.

Upvotes: 1

Related Questions