In Android I want to make folder on home screen programmatically like clean master do for game booster OR MyJio app put its all applications in one folder. I try with Live folder but its deprecated and also not working for me in latest android version. Is it a widget or what i can't understand about this please help me to understand this. Thanks in advance
you can do it with dialog, Create app icon with multiple app image and set it as your app icon, Now Create one activity and register it in manifest like , i have only display two button you can add more in your dialog layout
<activity android:name=".DialogActivity"
android:theme="@android:style/Theme.DeviceDefault.Dialog">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Now your activity as follow
public class DialogActivity extends Activity {
AlertDialog dialog;
LinearLayout mLinearLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.test);
mLinearLayout = (LinearLayout) findViewById(R.id.test);
mLinearLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
Window window = this.getWindow();
window.setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setPositiveButton("ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// User clicked OK button
}
});
builder.setNegativeButton("cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
// User cancelled the dialog
dialog.dismiss();
finish();
}
});
dialog = builder.create();
dialog.show();
dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
finish();
}
});
}}
test.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:id="@+id/test"
android:layout_height="match_parent"></LinearLayout>