creating custom intent

by Bob » Thu, 30 Apr 2009 09:45:48 GMT


Sponsored Links
 Hi,
Can anyone tell me what I am doing wrong, I'm sure it is real simple.
I am trying to create a custom intent but everytime I try to launch it
from another activity I get a "No Activity found to handle Intent"
error?  Am I failing to register the new intent somehow even though it
is in the manifest?


Thanks,
Bob

In other activity,produces error:

 Intent i = new Intent("com.example.Intent1");
        startActivity(i);

In Receiver Activity:

In Manifest:

 <receiver android:name=".TestBroadcastReceiver"
android:enabled="true" >
             <intent-filter>
         <action android:name="com.example.Intent1" />

            </intent-filter>
        </receiver>


In Code File:

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class TestBroadcastReceiver extends BroadcastReceiver {

        @Override
        public void onReceive(Context context, Intent intent) {
                // TODO Auto-generated method stub

        }

}

--~--~---------~--~----~------------~-------~--~----~



creating custom intent

by Jeff Sharkey » Thu, 30 Apr 2009 11:33:09 GMT


 So because you're targeting a BroadcastReceiver, you would call
sendBroadcast() instead of startActivity().

j






-- 
Jeff Sharkey
jshar...@google.com

--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


creating custom intent

by Bob » Thu, 30 Apr 2009 12:32:37 GMT


 > So because you're targeting a BroadcastReceiver, you would call

Thanks Jeff for quick response. What I want to do is start an activity
but I tried the Broadcast Receiver because I was getting the activity
not found error with the manifest like this:

 <activity  android:name=".MyActivity"  android:label="@string/
app_name">

              <intent-filter>
         <action android:name="com.example.Intent1" />

            </intent-filter>

Is there something wrong with that used in conjunction with
startactivity()?

Thanks,
Bob





--~--~---------~--~----~------------~-------~--~----~



creating custom intent

by Jeff Sharkey » Thu, 30 Apr 2009 13:09:48 GMT


 That code should have worked, as long as "MyActivity" is directly
inside of the android:package you defined in the manifest.  If it was
deeper you would have to reference the remaining sub-package leaves in
the android:name.

For example, if you had "com.example.uistuff.MyActivity" and your
manifest was only android:package="com.example", you would need to use
android:name=".uistuff.MyActivity" when defining that activity.

j









-- 
Jeff Sharkey
jshar...@google.com

--~--~---------~--~----~------------~-------~--~----~



creating custom intent

by Bob » Thu, 30 Apr 2009 14:35:54 GMT


 hanks for your help.  I believe I have resolved the problem and it
was that I didn't have the line

<category android:name="android.intent.category.DEFAULT" />

following

<intent-filter>
<action android:name="com.example.Intent1" />


Thanks Again,
Bob


On Apr 30, 1:09am, Jeff Sharkey <jshar...@android.com> wrote:
--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Email ContentProvider

hi ,

I could see Email ContentProvider in Email application( under packages/
apps/Email/src/com/android/email/provider). Why was it not exported in
SDK or am I blind?. If this is not exported, was there any way I could
read Email from other apps?. Thanks.

Regards,

SK.

2. Mapview + Tab example

Hi,

i need to have an mapview on a tab.
The attached example (http://www24.zippyshare.com/v/37272515/
file.html) shows how to do this if using intents.
Now i want to change the zoom level of the mapview(s).
How can i do this, although i'm using intents (or is there completely
different solution)?

thx

3. Reliable GPS location

4. Problem with song's ID3 Genre tag. If tag isn't present can't ID Song..

5. Mail stays in my Outbox - Using Exchange ActiveSync

6. Best free hollywood moives downloads. Over 50 beautiful sketches ...

7. How to Calculate Temperature