android - Uncheck Checkbox depend on another activity -


in main activity add icon . there checkbox list dialog appear. when click on checkbox user can check desire url link. when checkbox checked, 2 edittext saved db. 2 edittext invisible. it's list in activity. if user don't added url. can delete popup dialog call delete. problems when user delete url, want uncheck in list of checkbox on dialog.

note* checkbox list manually added.

thanks. if have additional question pls ask me.

there 2 approaches:

  1. pass state of checkbox 1 activity through intent. based on state of checkbox received through intent in second activity, make changes in ui.

    boolean state = [getstateofcheckbox];
    intent.putextra("key", state);
    startactivity(intent);

    //get state in receiver activity's oncreate()
    intent receiveintent = getintent(); boolean checkboxstate = receiverintrent.getbooleanextra("key");

  2. save state of checkbox in sharedpreferences in first activity , retrieve value in second activity.

    //save state in sharedpreferences sharedpreferences prefs = getsharedpreferences("yoursharedpreferencesname", "mode");
    sharedpreferences.editor = editor = prefs.edit(); editor.putboolean("key", state).commit();

    //extract state @ receiver's end
    sharedpreferences prefs = getsharedpreferences("yoursharedpreferencesname", "mode");
    boolean state = prefs.getboolean("key", "defaultstate");


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -