开发者

changing launching activity

开发者 https://www.devze.com 2023-02-20 21:02 出处:网络
i want to change my launching activity.for the moment my manifest is this: <application android:icon=\"@drawable/iconbj\" android:label=\"@string/app_name\"

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.c开发者_如何学Pythonategory.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?


<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"

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号