-2

I want to launch an installed package from my Android application. I assume that it is possible using Intent, but I didn't find a way of doing it. Is there a link, where to find the information?

but I want to open it in a fixed area of the layout not fill the layout is that possible ?

I wanna just open it in a part of the layout not all of it.

N J
  • 25,967
  • 13
  • 73
  • 94

2 Answers2

4

You can launch another application by following code

Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.package.address");
startActivity(launchIntent);

see official link for sending user to another application

but i want to open it in a fixed area of the layout not fill the lay out is that possible ?

No that is not possible because you can call only Activity not part of Activity

N J
  • 25,967
  • 13
  • 73
  • 94
0

Yes you can launch another application (assuming you have the correct permissions in your AndroidManifest.xml). All you have to do is create the intent with the relevant Action (you can scroll down and see different type of Actions). And if needed, set the relevant "data" and then start an activity using that intent - android will know which application to launch based on the action.

An example that launches a phone dialer:

Intent intent = new Intent(Intent.ACTION_DIAL);
intent.setData(Uri.parse("tel:4087775555"));
startActivity(intent); 

When you start a new Activity (launch another application) your applications moves to the background, so the answer to that second question is that no, you cannot "embed" another application in your application.

Nir Alfasi
  • 49,889
  • 11
  • 75
  • 119
  • that's very good but i don't wanna open it i wanna open it in my app as part of its layout example : i opened my app then i pressed on calculator button then it opens the calculator in my own app not closing it or send it to the background . – Mahmoud Mohsen Saad Jul 15 '15 at 03:57
  • @MahmoudMohsenSaad what you're looking for is an `iframe` behavior (borrowed from the HTML world). As far as I know - you cannot do it in Android. – Nir Alfasi Jul 15 '15 at 03:59
  • okay thanks sir ,,,i am sorry but i have more 2 questions please : 1-why when the url of the webview facebook.com it leave the app and open it in the Browser ? 2-why youtube videos does not work in webview when i run the app ? – Mahmoud Mohsen Saad Jul 15 '15 at 04:55