2

How do I build an intent and the Manifest so that I can invoke an activity with my application as an implicit intent.

The idea is that I am writing some general code that I wish to use in a number of applications. This code is held in an Android library and is linked to the using application. This general code opens an activity and does some work. Once it is done (user clicks a button) it needs to transfer to an activity that is specific to this application.

1
  • Yes. I can't see how to make one that will only take from the manifest of the current application. Commented Jan 19, 2012 at 13:44

2 Answers 2

1

As per my understanding on your questions,

You can declare your activity with specified implicit intent in your application's manifest file..

For example: If you want to make a application for view Image with your application and you have to use that application on your device which can allow other activity to view image using implicit intent action.VIEW so ,just

 <activity android:label="@string/app_name" android:name=".MyImageViewerActivity"> <intent-filter> <action android:name="android.intent.action.MAIN"> <category android:name="android.intent.category.LAUNCHER"> </category></action></intent-filter> <intent-filter> <action android:name="android.intent.action.VIEW"> <category android:name="android.intent.category.DEFAULT"> <data android:mimetype="image/*"> </data></category></action></intent-filter> </activity> 

In the above code we can see that intent-filter has following properties.

a. action: type for which this activity will respond for.Like this activity will respond for view action.

b. category: implicit intents are divided in categories.Like this activity is in default category.

c. data: Specify more information about intent-filter. Like this activity will handle file of mimeType “image/*”.

And when you install this application in your device and click on any image file, you will see a choice dialog that offer you to select between default application and your application. Just select your application to see the image.

For more info with example look at this What is intent filter in android?

Tutorial: Registering via Intentfilter

Sign up to request clarification or add additional context in comments.

2 Comments

Problem with that way is I am using a system-wide action. I want it to be invisible to the user. The whole idea is to make the coding easier so that the first activity comes from the shared code and the next one comes from the specific code of that application.
The choice dialog is only allow if user have a intent with you declared, If user has no intent of yours intent like Wide_Screen then it can no see that choice..
0

I think you can use intent-filters. I didn't use it for such things, but I hope that will help you.

Idea is that you can call your activity not by name, but by it's action (that is setted in intent-filter in your Manifest)

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.