How to open another application from current application on Android? – Different Approach
Opening an application from your own application is simple and you can find the solution everywhere like this :
Intent i = new Intent(Intent.ACTION_MAIN); i.setComponent(new ComponentName("app package name", "app launch activity's classname")); i.addCategory(Intent.CATEGORY_LAUNCHER); startActivity(i);
The problem here is that if you do not know the application’s launch activity’s classname, you can not open the application. Of course one can say that: “I can access this file from Package Manager – Application Info”. My answer will be : “Try and see :)”. ApplicationInfo sometimes returns null values which makes the developer crazy.
Here is my approach to this situation (getLaunchIntentForPackage) :
Intent i = new Intent(Intent.ACTION_MAIN); PackageManager manager = getPackageManager(); i = manager.getLaunchIntentForPackage("app package name"); i.addCategory(Intent.CATEGORY_LAUNCHER); startActivity(i);
Hope this also will help to you!
Post comment
Blog Categories
- Actionscript (3)
- Air (4)
- Android (5)
- BLOG (4)
- Flex (3)
Recent Posts
- Showing flash objects in WebView
- Using Android library projects in custom builds
- How to open another application from current application on Android? – Different Approach
Archives
- December 2011
- October 2011
- September 2011
- July 2011
- June 2011
- August 2010
- June 2010
- May 2010
- March 2010

Posted by Ercan in