tags:

views:

271

answers:

1

I want to call one android application from another application

I have tried example on site http://www.anddev.org/install-run_applications_from_within_another_application-t6909.html

but it is not working for me It is giving Package parse error..

Please replay as soon as possible.

Consider there are two applications: Application1 and Application2

I want to call Application2 from Application1

I got some sample code to do this:

Intent i = new Intent(); i.setAction(android.content.Intent.ACTION_VIEW); i.setDataAndType(Uri.fromFile(fileName),"application/vnd.android.package-archive"); startActivity(i);

here fileName = "file://data/data/package_name/files/Application1.apk";

But I am getting Package Error and skipping file://data/data/package_name/files/Application1.apk

A: 

Are you trying to launch an application that is not installed? It looks like you're trying to execute an app by passing app1 the location of the .apk file for app2 on the sd card - this won't work. The Android OS will know how to invoke app2 via Intents only after the user has installed it (consider the security risks if you could just invoke any arbitrary code sitting on the sd card).

Assuming app1 and app2 are installed, look at the AndroidManifest.xml file for app2. This file will indicate what kind of Intents it will respond to.

see http://developer.android.com/guide/topics/intents/intents-filters.html#npex for a good example.

Please show us the AndroidManifest.xml file for app2 if you need more help.

Keith