Hi! I´m working on an activity which shows all the apps installed on the phone, with its photo, name, and a switch. For showing the apps, photo and name I´ve used this example: http://javatechig.com/android/how-to-get-list-of-installed-apps-in-android For the switch I added
<Switch android:id="@+id/app_switch" android:layout_width="match_parent" android:layout_height="fill_parent" android:gravity="center_vertical" android:layout_gravity="center_vertical|right" /> to the snippet_list_row.xml . I need the switch status to be changed and saves(using SharedPreferences) when an item of the ListView is clicked, so in AllAppsActivity.java, inside onListItemClick, I´ve put: Switch appSwitch = (Switch) findViewById(R.id.app_switch); if (appSwitch.isChecked()){ appSwitch.setChecked(false); }else{ appSwitch.setChecked(true); } PreferenceManager.getDefaultSharedPreferences(AppsNotificationsActivity.this ).edit().putString(app.packageName , String.valueOf(appSwitch.isChecked())). commit(); but it doesn´t work, and I don´t know why. Could somebody help me?? Thanks a lot -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. To post to this group, send email to android-developers@googlegroups.com. Visit this group at https://groups.google.com/group/android-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/fbf1d02d-0a63-47ee-ba7f-6a448b1c80c1%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.