Apps don't return

I have written custom home screen app from which I am launching apps.

The main problem is the opened apps doesn't return to my home screen app, instead they go to the launcher home screen, even though I have set my home screen app as default home screen. I want these apps to return to my home screen. How can i do that?

Answers


If you check documentation for the getLaunchIntentForPackage(..) method you see

"Returns either a fully-qualified Intent that can be used to launch the main activity in the package, or null if the package does not contain such an activity. "

That's pretty self explaining.. your "app package name" is not correct, it might be for some apps but not for others.

try something like

PackageManager pManager = getPackageManager();  
List<PackageInfo> packs = pManager.getInstalledPackages(PackageManager.GET_INSTALLED_PACKAGES);  
 for (PackageInfo pi : packs) {  
   if(pi.packageName.toLowerCase().contains("app package name") )
{
     Intent intent = pManager.getLaunchIntentForPackage(pi.packageName); 
     if (intent != null)  
       startActivity(intent);  
    }
 } 

Need Your Help

How can I get the Check box seleted Listview value in android?

android checkbox selection

I am displaying the check-box with Android List-view in the screen. Now I want to get the value of the list-item based on check-box selection. How can I do it?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.