Android activity reopen after start a new activity

时间:2015-10-30 22:41:05

标签: android android-intent android-activity android-manifest

I have a activity called MainActivity that calls a new activity (Tutorial):

Intent secondActivity = new Intent(this, Tutorial.class);
startActivity(secondActivity);

After calling the startActivity, the onCreate of MainActivity is open again. Why this happens? I migrated from Eclipse to Android Studio, and this issue did not happen on Eclipse.

@update1:

The MainActivity is first activity to open on my project. After that I call the TutorialActivity.

Manifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.teste.animationxml" >
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>


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

    <activity
        android:name=".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=".Tutorial">
    </activity>

    <activity
    android:name=".Volume"
    android:label="app_second" >
    </activity>

    <activity
        android:name=".Parabens"
        android:label="app_second" >
    </activity>

</application>

Regards

Best regards

0 个答案:

没有答案