I'm using the following code and it works fine, don't need to add
external activities in you Manifest.xml.

Not sure if it's a recommended way.

                Intent intent = new Intent(Intent.ACTION_VIEW);

                // intent.setData(m_uri);
                intent.setComponent(new 
ComponentName("com.toremote.serversmanager",
                                "com.toremote.RemoteActivity"));

                intent.putExtra(REMOTE_SERVER, HOST);

                intent.putExtra(REMOTE_PORT, PORT);

                startActivity(intent);



                <activity android:name="com.toremote.RemoteActivity"
                        android:label="@string/app_name" 
android:configChanges="orientation|
keyboardHidden"
                        android:theme="@android:style/Theme.NoTitleBar">
                        <intent-filter>
                                <action 
android:name="android.intent.action.VIEW" />
                                <category 
android:name="android.intent.category.DEFAULT" />
                        </intent-filter>
                        </activity>


On Dec 22, 8:40 pm, Dianne Hackborn <[email protected]> wrote:
> You always need to have the DEFAULT category for things to be found
> implicitly by startActivity().
>
> On Tue, Dec 22, 2009 at 6:12 PM, Mark Murphy <[email protected]>wrote:
>
>
>
> > ClarkBattle wrote:
> > > The other developer is sitting right next to me.  Its the same
> > > company.
>
> > Well, that certainly simplifies matters... :-)
>
> > > He just implemented an intent-filter in his manifest to listen for an
> > > action called "com.poof.intent.action.MovieApp"
>
> > Does his <intent-filter> have anything else? For these sorts of things,
> > I usually just have the <action> element in the filter and nothing else.
> > You don't need a category or anything, and they can actually get in the
> > way a bit. For example, if his <intent-filter> has a category, you'll
> > need that category in your Intent as well, AFAIK.
>
> > > I changed my code to
>
> > > Intent intent = new Intent( "com.poof.intent.action.MovieApp" );
> > > intent.putExtra("FILENAME", MOVIES[state.currentMovie].filename);
> > > PendingIntent pendingIntent = PendingIntent.getActivity( context, 0,
> > > intent, PendingIntent.FLAG_UPDATE_CURRENT );
> > > remoteView.setOnClickPendingIntent( R.id.btnDoIt, pendingIntent );
>
> > > And updated his apk on my emulator.  The button still does nothing.
> > > Any ideas?  Examples?
>
> > Well, assuming his <intent-filter> is just the <action>, that should be
> > fine. Are you seeing any warnings in LogCat? If Android can't find a
> > match on the Intent, it'll toss out a warning, not an error.
>
> > Also, you could toss together a scrap project and call a regular
> > startActivity() in there on the Intent, to see if that launches. That'll
> > tell you if your problem is in the Intent construction or in the app
> > widget proper.
>
> > In terms of an example, here's one where I am starting up the browser on
> > a URL:
>
> > Intent i=new Intent(Intent.ACTION_VIEW, Uri.parse(c.getString(1)));
> > PendingIntent pi=PendingIntent.getActivity(this, 0, i, 0);
>
> > updateViews.setOnClickPendingIntent(R.id.title, pi);
> > updateViews.setOnClickPendingIntent(R.id.panel, pi);
>
> > In this case, I am using the same PendingIntent on two views in the app
> > widget, because the title itself (a TextView) is kinda thin and
> > difficult to tap, so I have the panel (a layout) behind it also respond
> > to a click to provide a larger target. Also, c.getString(1) is pulling a
> > String URL value out of a Cursor.
>
> > --
> > Mark Murphy (a Commons Guy)
> >http://commonsware.com|http://twitter.com/commonsguy
>
> > Android App Developer Training:http://commonsware.com/training
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]<android-developers%[email protected]>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Dianne Hackborn
> Android framework engineer
> [email protected]
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to