Android的活动顺序 [英] Android Activity order

查看:140
本文介绍了Android的活动顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 < XML版本=1.0编码=UTF-8&GT?;
<舱单的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
      包=muazam.multiplication.one
      安卓版code =1
      机器人:VERSIONNAME =1.0>
    <使用-SDK安卓的minSdkVersion =3/>

    <应用机器人:图标=@可绘制/图标机器人:标签=@字符串/ APP_NAME>
           <活动机器人:标签=@字符串/ APP_NAME机器人:乘法NAME =>
            <意图过滤器的Andr​​oid版本:优先级=1>
                <作用机器人:名称=android.intent.action.MAIN/>
                <类机器人:名称=android.intent.category.LAUNCHER/>
            &所述; /意图滤光器>
        < /活性GT;

        <活动机器人:标签=@字符串/ APP_NAME机器人:扑通NAME =>
            <意图过滤器的Andr​​oid版本:优先级=3>
                <作用机器人:名称=android.intent.action.CLEARSCREEN/>
                <类机器人:名称=android.intent.category.DEFAULT/>
            &所述; /意图滤光器>
        < /活性GT;

            <活动机器人:标签=@字符串/ APP_NAME机器人:菜单名称=>
            <意图过滤器的Andr​​oid版本:优先=2>
                <作用机器人:名称=muazam.multiplication.one.Play/>
                <类机器人:名称=android.intent.category.DEFAULT/>
            &所述; /意图滤光器>
        < /活性GT;



    < /用途>
< /舱单>
 

我希望它开始与.splash类,然后再。菜单类。 正如你看到的我已经把机器人:优先考虑他们,但它似乎什么也不做

任何人知道如何解决这个问题?谢谢你。

解决方案
  

我希望它开始与.splash类第一

这在Android的没有意义。

如果你的意思是说:我希望.splash类是当在主屏幕发射点击该图标的启动项,那么你需要摆脱 .splash 类的电流<意向滤光器> (这是完全错误的)和移动你的 / LAUNCHER <意向滤光器> .multiplication 类的。飞溅类。

当你在的话,请摆脱了安卓优先属性(在此未使用)和你的播放 / 默认 <意向滤光器> (你真的不应该需要的,除非你计划第三方应用程序启动该活动直接)。

  

然后。菜单类

您做到这一点在Java中code与 startActivity()

  

正如你看到的我已经把机器人:优先考虑他们,但它似乎什么也不做

当然。没有安卓优先属性的<活性GT; 元素,你可以在文档

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="muazam.multiplication.one"
      android:versionCode="1"
      android:versionName="1.0">
    <uses-sdk android:minSdkVersion="3" />

    <application android:icon="@drawable/icon" android:label="@string/app_name">
           <activity android:label="@string/app_name" android:name=".multiplication">
            <intent-filter android:priority="1">
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity android:label="@string/app_name" android:name=".splash">
            <intent-filter android:priority="3">
                <action android:name="android.intent.action.CLEARSCREEN" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

            <activity android:label="@string/app_name" android:name=".Menu">
            <intent-filter android:priority="2">
                <action android:name="muazam.multiplication.one.Play" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>



    </application>
</manifest>

I want it to start with the .splash class first, and then .Menu class. As you see I have put android:priority on them, but it seem to do nothing.

Anyone know how to solve this problem? Thanks.

解决方案

I want it to start with the .splash class first

That has no meaning in Android.

If you meant to say "I want the .splash class to be what launches when the icon in the home screen launcher is clicked", then you need to get rid of the .splash class' current <intent-filter> (which is simply wrong) and move your MAIN/LAUNCHER <intent-filter> from the .multiplication class to the .splash class.

While you are at it, please get rid of the android:priority attributes (which are not used here) and your Play/DEFAULT <intent-filter> (which you really should not need, unless you plan on third-party apps starting up that activity directly).

and then .Menu class

You do this in Java code with startActivity().

As you see I have put android:priority on them, but it seem to do nothing.

Of course. There is no android:priority attribute for the <activity> element, as you can see in the documentation.

这篇关于Android的活动顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆