改变启动活动

发布于 2024-10-27 21:26:18 字数 4141 浏览 2 评论 0原文

我想更改我的启动活动。目前我的清单是这样的:

<application android:icon="@drawable/iconbj" android:label="@string/app_name"
    android:debuggable="true">
    <activity android:name=".Main" android:label="@string/app_name" android:screenOrientation="landscape">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:label="DemoPlayActivity" android:name="DemoPlayActivity" android:screenOrientation="landscape"></activity>

</application>

现在我创建了另一个活动,它是一个启动屏幕,我想启动它而不是主屏幕,所以我尝试了这种方式:

<application android:icon="@drawable/iconbj" android:label="@string/app_name"
    android:debuggable="true">
    <activity android:name=".Splash" android:label="@string/app_name"
        android:screenOrientation="landscape">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name="Main" android:label="Main"
        android:screenOrientation="landscape">
    </activity>
    <activity android:label="DemoPlayActivity" android:name="DemoPlayActivity"
        android:screenOrientation="landscape"></activity>

</application>

但我在获得许可的情况下遇到了这个问题:

[2011-03-31 16:32:44 - BlackJackNuovo] 活动管理器: java.lang.SecurityException: 权限拒绝:开始意图{ act=android.intent.action.MAIN 猫=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.phinet.android.blackjack/.Main } from null (pid=-1, uid=-1) 需要 空。

请帮助我:)

更新

没办法。我这样做了:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.phinet.android.blackjack" android:versionCode="1"
    android:versionName="1.0">
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.VIBRATE" />

    <application android:icon="@drawable/iconbj" android:label="@string/app_name"
        android:debuggable="true">
        <activity android:name="com.phinet.android.blackjack.Splash" android:label="Splash"
            android:screenOrientation="landscape">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="com.phinet.android.blackjack.Main" android:label="Main"
            android:screenOrientation="landscape">
        </activity>
        <activity android:label="com.phinet.android.blackjack.DemoPlayActivity" android:name="DemoPlayActivity"
            android:screenOrientation="landscape"></activity>

    </application>
</manifest>

但午餐似乎总是主要活动,这是控制台日志:

[2011-04-01 10:57:10 - BlackJackNuovo] Uploading BlackJackNuovo.apk onto device '9000d365e767'
[2011-04-01 10:57:16 - BlackJackNuovo] Installing BlackJackNuovo.apk...
[2011-04-01 10:57:32 - BlackJackNuovo] Success!
[2011-04-01 10:57:32 - BlackJackNuovo] Starting activity com.phinet.android.blackjack.Main on device 9000d365e767
[2011-04-01 10:57:32 - BlackJackNuovo] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.phinet.android.blackjack/.Main }
[2011-04-01 10:57:35 - BlackJackNuovo] ActivityManager: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.phinet.android.blackjack/.Main } from null (pid=-1, uid=-1) requires null

为什么?

i want to change my launching activity.for the moment my manifest is this:

<application android:icon="@drawable/iconbj" android:label="@string/app_name"
    android:debuggable="true">
    <activity android:name=".Main" android:label="@string/app_name" android:screenOrientation="landscape">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:label="DemoPlayActivity" android:name="DemoPlayActivity" android:screenOrientation="landscape"></activity>

</application>

now I have created another activity which is a splash screen and i want to launch this instead of Main so I tried this way:

<application android:icon="@drawable/iconbj" android:label="@string/app_name"
    android:debuggable="true">
    <activity android:name=".Splash" android:label="@string/app_name"
        android:screenOrientation="landscape">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name="Main" android:label="Main"
        android:screenOrientation="landscape">
    </activity>
    <activity android:label="DemoPlayActivity" android:name="DemoPlayActivity"
        android:screenOrientation="landscape"></activity>

</application>

but i get thisproblem with permission:

[2011-03-31 16:32:44 - BlackJackNuovo]
ActivityManager:
java.lang.SecurityException:
Permission Denial: starting Intent {
act=android.intent.action.MAIN
cat=[android.intent.category.LAUNCHER]
flg=0x10000000
cmp=com.phinet.android.blackjack/.Main
} from null (pid=-1, uid=-1) requires
null.

please help me :)

Update

NO WAY. I did this way:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.phinet.android.blackjack" android:versionCode="1"
    android:versionName="1.0">
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.VIBRATE" />

    <application android:icon="@drawable/iconbj" android:label="@string/app_name"
        android:debuggable="true">
        <activity android:name="com.phinet.android.blackjack.Splash" android:label="Splash"
            android:screenOrientation="landscape">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="com.phinet.android.blackjack.Main" android:label="Main"
            android:screenOrientation="landscape">
        </activity>
        <activity android:label="com.phinet.android.blackjack.DemoPlayActivity" android:name="DemoPlayActivity"
            android:screenOrientation="landscape"></activity>

    </application>
</manifest>

but it seems to lunch always the Main activity,this is the concole log:

[2011-04-01 10:57:10 - BlackJackNuovo] Uploading BlackJackNuovo.apk onto device '9000d365e767'
[2011-04-01 10:57:16 - BlackJackNuovo] Installing BlackJackNuovo.apk...
[2011-04-01 10:57:32 - BlackJackNuovo] Success!
[2011-04-01 10:57:32 - BlackJackNuovo] Starting activity com.phinet.android.blackjack.Main on device 9000d365e767
[2011-04-01 10:57:32 - BlackJackNuovo] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.phinet.android.blackjack/.Main }
[2011-04-01 10:57:35 - BlackJackNuovo] ActivityManager: java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.phinet.android.blackjack/.Main } from null (pid=-1, uid=-1) requires null

WHY?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寄意 2024-11-03 21:26:18
<activity android:name="Main" android:label="Main"
    android:screenOrientation="landscape">
</activity>
<activity android:label="DemoPlayActivity" android:name="DemoPlayActivity"
    android:screenOrientation="landscape"></activity>

仍然应该有领先的

<activity android:name=".Main" android:label="Main" android:screenOrientation="landscape">
</activity>
<activity android:label=".DemoPlayActivity" android:name="DemoPlayActivity"android:screenOrientation="landscape">
</activity>

这表明它具有到您的类的相对路径。如果您愿意,您可以进行绝对引用,即 "com.your.app.Main"

<activity android:name="Main" android:label="Main"
    android:screenOrientation="landscape">
</activity>
<activity android:label="DemoPlayActivity" android:name="DemoPlayActivity"
    android:screenOrientation="landscape"></activity>

Should still have the leading .

<activity android:name=".Main" android:label="Main" android:screenOrientation="landscape">
</activity>
<activity android:label=".DemoPlayActivity" android:name="DemoPlayActivity"android:screenOrientation="landscape">
</activity>

This is stating it has a relative path to your Classes. You could make absolute references if you wished, i.e. "com.your.app.Main"

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文