I am writing an app in which i have to show device's Home Launcher when user do click on button (which i have placed on my own launcher), I tried using this code, but its showing all the apps installed on my device, but what if i want to show Device's Home Launcher only on button click
public class DefaultLaunchActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_launcher);
btnDeviceLauncher = (Button) findViewById(R.id.button1);
btnDeviceLauncher.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Intent startMain = new Intent(Intent.ACTION_MAIN);
startMain.addCategory(Intent.CATEGORY_LAUNCHER);
startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(startMain);
}
});
}
}
manifest.xml
<activity
android:name="com.def.launc.DefaultLaunchActivity"
android:theme="@android:style/Theme.Wallpaper.NoTitleBar.Fullscreen"
android:launchMode="singleTask"
android:stateNotNeeded="true"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>