-2

enter image description here

I started yesterday with developing app on Android Studio and I am not sure how to declare my activity in AndroidManifest. I read the post on Activity Declaration in AndroidManifest.xml but I am still not sure what to put for the name and label and how to find their exact names. I would really appreciate your help and thank you.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Abby Layman
  • 11
  • 1
  • 4

2 Answers2

1

Try This

Read doc about Manifest file Manifest file structure

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

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <activity android:name=".MainActivity"
            android:theme="@style/AppTheme">

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

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

        </activity>

       <activity android:name=".CreateAccountActivity"></activity>
       <activity android:name=".LoginActivity"></activity>

    </application>

</manifest>
Ratilal Chopda
  • 4,162
  • 4
  • 18
  • 31
  • Thank you! It works! May I know what I did wrong in my codes? So my problem was that there was an activity inside intent tag? How about my app name and label like was there a problem there? – Abby Layman Jan 20 '18 at 14:01
  • you forgot this line in your code – Ratilal Chopda Jan 20 '18 at 14:02
  • Okay I understand now. Thank you so much for your help! – Abby Layman Jan 20 '18 at 14:04
  • @JeonghwanLee Thanks, Happy to help you. – Ratilal Chopda Jan 20 '18 at 14:05
  • Just 1 more thing but I can set set an activity as a starting default using AndroidManifest right? There are 2 things currently on my Manifest which is CreateAccountActivity and LoginActivity but when I run the app, it does not show those 2 things but the original template. I tried deleting the origina acitivty.xml and debugging the app but it didnt work so what should I do? – Abby Layman Jan 21 '18 at 11:07
0

As per your shared image you have added activity inside of intent tag. Please out it from intent-filter tag. Please check below code also. Might be it will help.

<application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name="com.product.activities.SplashActivity"
            android:theme="@style/SplashTheme">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
           <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
           //second activity
            <activity android:name="com.product.activities.MainActivity" />

        </activity>
devajay
  • 399
  • 4
  • 12
  • Thank you for your help but I already got a solution from Ratial. – Abby Layman Jan 20 '18 at 14:03
  • Just 1 more thing but I can set set an activity as a starting default using AndroidManifest right? There are 2 things currently on my Manifest which is CreateAccountActivity and LoginActivity but when I run the app, it does not show those 2 things but the original template. I tried deleting the origina acitivty.xml and debugging the app but it didnt work so what should I do – Abby Layman Jan 21 '18 at 13:54