Skip to content Skip to sidebar Skip to footer

Listview Item Click Open Custom Dialog With Another Custom Listview

Here I have created custom dialog which includes listview with single choice mode. when user selects one of the item in listview then it should be selected when dialog is opened ne

Solution 1:

For simply saving a value to persist app sessions you can use the SharedPreferences API: Here's a sample of saving:

SharedPreferencessettings= getSharedPreferences("MYPREFS", 0);
    SharedPreferences.Editoreditor= settings.edit();
    editor.putBoolean("isChecked", rb.isChecked());
    editor.commit();

where rb is your radioButton. and to retrieve it and apply it next time, you can use:

SharedPreferencessettings= getSharedPreferences("MYPREFS", 0);
    rb.setChecked(settings.getBoolean("isChecked", false)); 

Note that false here is simply a default value in case a value with that key doesn't exist the sharedPrefs file yet. It will automatically create one if not existing.

Post a Comment for "Listview Item Click Open Custom Dialog With Another Custom Listview"