Android Manifest中的订购活动

时间:2018-03-13 15:19:44

标签: android xml android-manifest manifest

尝试在我的应用程序中订购某些活动时遇到问题。已经实现了我在SO上看到的一些想法,但无济于事。

此时,我的申请正在进行SplashScreen > MainActivty。我想要SplashScreen > LoginActivity > MainActivity

任何有关我出错的迹象都将受到赞赏。

清单

<activity
        android:name="com.example.XXX.myapplication.SplashScreen">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <activity
        android:name="com.example.XXX.myapplication.LoginActivity"
        android:parentActivityName=".SplashScreen">
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="com.example.XXX.myapplication.SplashScreen" />
    </activity>

    <activity
        android:name=".SignUpActivity" />

    <activity
        android:name="com.example.XXX.myapplication.MainActivity"
        android:parentActivityName=".LoginActivity">
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="com.example.XXX.myapplication.LoginActivity"
            android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
    </activity>

4 个答案:

答案 0 :(得分:4)

您不能像这样在清单中订购活动。将启动画面设置为默认活动。在启动活动的Java代码中,使用startactivity方法启动mainactivity。然后在loginactivity中调用mainactivity的startactivity。

https://developer.android.com/training/basics/firstapp/starting-activity.html

答案 1 :(得分:1)

你应该用Java编程,在你的SplashScreen类中,你应该有类似的东西:

startActivity(new Intent(SplashScreen.this, LoginActivity.class));

示例:

private final int SPLASH_DISPLAY_TIME = 5000;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash_screen);

    new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            Intent myIntent = new Intent(SplashScreen.this, LoginActivity.class);
            startActivity(myIntent);
            finish();
        }
    },SPLASH_DISPLAY_TIME);
}

答案 2 :(得分:0)

curl -XPUT 'localhost:9200/users2?pretty' -H 'Content-Type: application/json' -d'
{
  "mappings": {
    "users": {
      "properties": {
        "email":    { "type": "text"  },
        "first_name":     { "type": "text"  },
        "last_name":    { "type": "text"  },
        "date_joined":     { "type": "date"  },
        "expertise":     { "type": "text"  },
        "institution":    { "type": "text"  },
        "position":     { "type": "text"  }
      }
    }
  }
}'

答案 3 :(得分:0)

    You can not ordering Activities by Manifest 

    1.Your Launch page is Splash.So you can write below code in splash page

        Thread timerThread = new Thread(){
                public void run(){
                    try{
                        sleep(3000);
                    }catch(InterruptedException e){
                        e.printStackTrace();
                    }finally{
                        startActivity(new Intent(SplashScreenActivity.this,YourActivity.class));
                        finish();
                    }
                }
            };
            timerThread.start();

You can write your Login Activity on plcae of YourActivity.

2.On Click Login button Ho to main Activity