This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Android and the fly likes How to call an activity in another application using intent? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Mobile » Android
Bookmark "How to call an activity in another application using intent?" Watch "How to call an activity in another application using intent?" New topic
Author

How to call an activity in another application using intent?

Kev Lee
Greenhorn

Joined: Mar 03, 2012
Posts: 5
I have difficulty finding a more complete and perhaps well explained tutorial on how to call activity created and deployed in another Android application from my application. I have not been successful learning from what I found (getting activity not found error resulting from my intent.setComponent statement, which I am not absolutely certain I need) I think I can set the action field of the intent somehow to accomplish this. Please refer me to such resource if you can or kindly give me some pointers. Thanks!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42047
    
  64
The only discussion of how to do that I have seen was in this book (which I recommened for its other content anyway): http://shop.oreilly.com/product/0636920022596.do (And no, I don't recall the details, so I can't post 'em here...)


Ping & DNS - my free Android networking tools app
Kev Lee
Greenhorn

Joined: Mar 03, 2012
Posts: 5
I keep getting "ActivityNotFoundException: Unable to find explicit activity class ... " when using Eclipse's emulator to call the activity of another application from an application. Perhaps the problem maybe related to not able to have both applications in the emulator at the same time because when I click on "Manage Applications" in Settings, only one of them is listed. This is the first project I need to call the activity of another application. If this is a problem how do I correct that? Thanks!
Przemek Boryka
Ranch Hand

Joined: Dec 06, 2011
Posts: 51

Hi !

I think you can't launch activity from other application because, to launch activity you must have inserted information about that activity in your AndroidManifest.xml file or you will get exception. You can launch other applications (not activity) like GPS or BluetoothModule but not any Activity of that applications (GPS, BluetoothModule).

If I was wrong, please tell my, becouse I am not one hundred percent sure of that

Sorry for my english, I am still learning
Bye !
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42047
    
  64
Przemek Boryka wrote:I think you can't launch activity from other application because, to launch activity you must have inserted information about that activity in your AndroidManifest.xml file or you will get exception.

In other words, you can do it?

It's perfectly possible to launch activities that are part of other apps if those apps have declared the activities in question as public (via the exported attribute). It's also permissible for different apps that share the same UID - the most common case of that would be apps written by the same developer.

This is all explained in depth in the book I mentioned. Every serious Android should get it, as it's inexpensive, and security is very important for mobile devices. (I have no financial interest in the book, I just think it's an important subject that is not sufficiently discussed in general.)
Przemek Boryka
Ranch Hand

Joined: Dec 06, 2011
Posts: 51

Hi !

Ulf Dittmer wrote:
In other words, you can do it?

It's perfectly possible to launch activities that are part of other apps if those apps have declared the activities in question as public (via the exported attribute). It's also permissible for different apps that share the same UID - the most common case of that would be apps written by the same developer.

This is all explained in depth in the book I mentioned. Every serious Android should get it, as it's inexpensive, and security is very important for mobile devices. (I have no financial interest in the book, I just think it's an important subject that is not sufficiently discussed in general.)



So, I was wrong, I didn't knew that I can launch special prepared activity from other app. Now, I will be know it, that I can. ;)

I bought the book you prefer, now I think, I will be more smarter.

Greetings from Poland.
Mohan Prasath
Ranch Hand

Joined: Jul 25, 2011
Posts: 38

To open another application's activity you must have declared the appropriate activity in your AndroidManifest file.. Have you declared it in your Manifest file?.


With regards,
Mohan Prasath
 
GeeCON Prague 2014
 
subject: How to call an activity in another application using intent?