开发者

calling one app from another, Android sdk?

开发者 https://www.devze.com 2023-01-12 16:50 出处:网络
My question is, is it possible to call one app from ano开发者_Python百科ther? It would be very helpful if anyone had an answer or solution.

My question is, is it possible to call one app from ano开发者_Python百科ther? It would be very helpful if anyone had an answer or solution.

-Chris-


Yes, by using intents.

For example:

final Intent intent = new Intent();
intent.setAction(Intent.ACTION_MAIN);
intent.setClassName("com.example.theotherapp", "com.example.theotherapp.MainActivity");
startActivity(intent);

This is called an explicit intent, because you're explicitly stating which component should respond to it. You can also use implicit intents, in which you specify what kind of component you expect and the OS and/or the user selects the most appropriate one.

If you can choose, implicit intents are preferred.


You should take a look at http://developer.android.com/guide/topics/fundamentals.html, more specifically at the "Application Components" section.

There are many ways to make two applications talk to each other - and they're explained there.

0

精彩评论

暂无评论...
验证码 换一张
取 消