Get the launcher activity name

Hello i wan't to keep home activity name for launch it from my app.

I know we can launch the launcher without know is package name but. I'm making a custom home and i will set it as default so this will launch my custom home.

I wan't to keep the launcher activity name on a shared preference the first time i launch my custom home and then i will be able to go on the default home from my personal home(without delete my home preference i will keep it as default and launch default home just for some debug test)

Don't know if i'm clear; i have difficult to understood myself in this subject so for resume I need at the first launch of my activity get the name of the default launcher(because it's not com.android.launcher for every device) and keep it to be able to launch it after some time

Any idea?

Answers


Finaly i don't keep the name i don't care of it i just use the following code to launch a launcher who is not mine :P

PackageManager pm = getPackageManager();
Intent i = new Intent("android.intent.action.MAIN");
i.addCategory("android.intent.category.HOME");
List<ResolveInfo> lst = pm.queryIntentActivities(i, 0);
if (lst != null) 
{
  for (ResolveInfo resolveInfo : lst) {
    if (resolveInfo.activityInfo.packageName != getPackageName()){
      Intent res = new Intent();
      String mPackage = resolveInfo.activityInfo.packageName;
      String mClass = resolveInfo.activityInfo.name;
      res.setComponent(new ComponentName(mPackage,mClass));
      startActivity(res);
    }
  }
}

you can get application registered with intent action android.intent.category.HOME, and you can get package list for aplication registered with this intent. May be this can also help


Need Your Help

The configuration element is not declared

c# xml app-config

I'm doing some work in Visual Studio 2012 Express Edition. I have added an App.config XML file as follows:

Understanding Xcode build error

ios compiler-errors mopub missing-symbols

Solution: so Mopub's instructions don't mention that EventKit and EventKitUI are required. Adding these in addition to the frameworks mentioned by MoPub got the project to build.

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.