Can't find Activity error

by John Lussmyer » Thu, 13 Jan 2011 07:45:18 GMT


Sponsored Links
 I'm trying to use an Intent() to send a little data to another app.
So far, I've been unable to get the startActivity() to succeed.  It always
fails with a ActivityNotFound exception.
I just haven't been able to figure out WHY my activity isn't being found.

invoking code is:

                Intent intent = new
Intent("com.casadelgato.lifewallpaper.UPDATEPREFS");
                intent.setPackage("com.casadelgato.lifewallpaper");
                intent.putExtra("PrefUpdate", true);
                startActivity(intent);


Manifest of target app is:

<?xml version="1.0" encoding="utf-8"?>
<manifest
    xmlns:android=" http://schemas.android.com/apk/res/android" ;
    package="com.casadelgato.lifewallpaper"
    android:versionName="1.0.3"
    android:versionCode="4"
    android:sharedUserId="@string/SharedUserID">
    <uses-sdk
        android:minSdkVersion="7" />
    <uses-feature
        android:name="android.software.live_wallpaper"
        android:required="true" />
    <application
        android:icon="@drawable/icon"
        android:label="@string/app_name"
        android:process="@string/SharedUserID">

        <service
            android:label="@string/servicelabel"
            android:permission="android.permission.BIND_WALLPAPER"
            android:name="LifeWallpaper"
            android:enabled="true">
            <intent-filter>
                <action

android:name="android.service.wallpaper.WallpaperService" />
            </intent-filter>
            <meta-data
                android:name="android.service.wallpaper"
                android:resource="@xml/settingsconfig" />
        </service>
        <activity
            android:label="Life Wallpaper Settings"
            android:theme="@android:style/Theme.Light.WallpaperSettings"
            android:exported="true"
            android:enabled="true"
            android:name="LifeSettings">
            <intent-filter>
                <action
                    android:name="com.casadelgato.lifewallpaper.UPDATEPREFS"
/>
            </intent-filter>
        </activity>

    </application>


</manifest>

-- 



Re: Can't find Activity error

by Kostya Vasilyev » Thu, 13 Jan 2011 08:47:07 GMT


 You need category_default in the intent filter of your activity for launch
by action string to work.

--
Kostya Vasilyev --  http://kmansoft.wordpress.com 
13.01.2011 2:46  "John Lussmyer" <johnlussm...@gmail.com>
:

-- 


Sponsored Links


Re: Can't find Activity error

by John Lussmyer » Thu, 13 Jan 2011 08:55:51 GMT


 So, I modified the manifest to have:

            <intent-filter>
                <action
                    android:name="com.casadelgato.lifewallpaper.UPDATEPREFS"
/>
                <category
                    android:name="android.intent.category.CATEGORY_DEFAULT"
/>
            </intent-filter>

Made no difference.

2011/1/12 Kostya Vasilyev <kmans...@gmail.com>


-- 



Re: Can't find Activity error

by Mark Murphy » Thu, 13 Jan 2011 08:59:44 GMT


 I'd get rid of the setPackage() call.






-- 
Mark Murphy (a Commons Guy)
 http://commonsware.com  |  http://github.com/commonsguy 
 http://commonsware.com/blog  |  http://twitter.com/commonsguy 

Android App Developer Books:  http://commonsware.com/books 

-- 



Re: Can't find Activity error

by John Lussmyer » Thu, 13 Jan 2011 09:06:01 GMT


 Didn't help.





-- 



Re: Can't find Activity error

by Stephen Jungels » Thu, 13 Jan 2011 09:22:11 GMT


 Unless your android:name elements are fully qualified, they should
begin with a period, should they not?





-- 



Re: Can't find Activity error

by John Lussmyer » Thu, 13 Jan 2011 10:20:58 GMT


 Should they?
And which ones are you talking about?





-- 



Re: Can't find Activity error

by Kostya Vasilyev » Thu, 13 Jan 2011 16:47:20 GMT


 It should be like this:

In the manifest:

<activity android:label="Life Wallpaper Settings" android:theme="@android:style/Theme.Light.WallpaperSettings" android:exported="true" android:enabled="true" android:name="LifeSettings">
You'd only need the leading dot if your activity class was in a sub-package: e.g. ".ui.settings.LifeSettings"
<intent-filter> <action android:name="com.casadelgato.lifewallpaper.UPDATEPREFS" />
*<category android:name="android.intent.category.DEFAULT" />* ( not category_default )
</intent-filter> </activity>
In the code: Intent intent = new Intent("com.casadelgato.lifewallpaper.UPDATEPREFS"); intent.putExtra(...); startActivity(intent); Don't worry about setting the package or class name, as that's the point of launching by action string. -- Kostya 13.01.2011 4:37, John Lussmyer ?????:
Should they? And which ones are you talking about? On Wed, Jan 12, 2011 at 5:22 PM, Stephen Jungels <sjung...@gmail.com Unless your android:name elements are fully qualified, they should begin with a period, should they not? --
-- Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com --



Re: Can't find Activity error

by Stephen Jungels » Fri, 14 Jan 2011 09:59:45 GMT


 


I was talking about the name elements of your service and activity
definitions. A technique much like this works in my own code and the
only thing that jumps out as different about your manifest file is the
lack of fully-qualified class names.

(Referring to this page, under the heading "Declaring class names":)
 http://developer.android.com/guide/topics/manifest/manifest-intro.html 

SJ




-- 



Other Threads

1. Nexus One multicolor LED notifications gone?

Wonder why they chose to disable this feature, only allowing internal apps
to access it? It is a very useful ability.. to look at the color of the LED
for specific types of notifications with no sound to bug you. Is this only
disabled on the Nexus One? I've not yet tried on my Moto Droid.

On Tue, Jan 12, 2010 at 11:48 PM, code_android_festival_way <











> 

2. Developing mobily?

Does anyone have any clue if it's possible to develop on an android
device or if it will happen anytime soon?

3. AbortBroadcast Problem With 2.0 and 2.0.1 SDK's

4. hore cyanogen versi 13 sudah ada

5. Dear Android-Developers, If you can't find in google, try JUSTDIAL.COM

6. App buat liat saham

7. Android plush bag