Stillie
Stillie

Reputation: 2676

Creating a new Activity, makes a whole new application?

Im new to android, and when i read "Create New Activity" i was under the impression it creates a new "Window/Layout/Screen".

When i start making my own application i see

Main.java

is one application and

SecondActivity.java

is another app in my Emulators menu?

Why is that and how can i go about making one app with multiple windows as apposed to multiple applications essentially?

Manifest

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.ryan.bidorbuyapp" >

    <application
        android:allowBackup="true"
        android:icon="@mipmap/bidorbuy_logo"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".FullscreenActivity"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:label="@string/app_name"
            android:theme="@style/FullscreenTheme" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".SearchResults"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:label="@string/title_activity_search_results"
            android:parentActivityName=".FullscreenActivity"
            android:theme="@style/FullscreenTheme" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.ryan.bidorbuyapp.FullscreenActivity" />

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

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

</manifest>

thanks

Upvotes: 1

Views: 80

Answers (2)

mrciga
mrciga

Reputation: 57

You should understand what is an Activity before starting to developing an android application. You can think an activity as a page in web. There can be one or more and every activity includes their own contents.

When you create a new activity in your project, you should navigate by doing some operations in another activity. Intent helps you at this point to navigate one activity to the another.

Your problem is that, you should check your AndroidManifest.xml file. Please check the declaration of intent here. I think you will solve it after making a search about Intent.

Upvotes: 0

Look at your AndroidManifest.xml there is the problem. Your activities have Launcher between it's tags. Only one activity must have LAUNCHER tag

Only one activity must have

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

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

Upvotes: 3

Related Questions