I tried the subroutine getView, but this did not work for me, and finally I went through the user one Preference:
public class ImageViewPreference extends Preference {
private ImageView mImageView;
private Bitmap mPhoto;
public ImageViewPreference(Context context, AttributeSet attrs) {
super(context, attrs);
this.setWidgetLayoutResource(R.layout.pref_account_image);
if (mPhoto == null) {
mPhoto = BitmapFactory.decodeResource(
getContext().getResources(), R.drawable.icon);
}
}
@Override
protected void onBindView(View view) {
super.onBindView(view);
mImage = (ImageView) view.findViewById(R.id.pref_imageView);
mImage.setImageBitmap(mPhoto);
}
public void setImage(Intent imageData) {
mPhoto = data.getParcelableExtra("data");
}
}
And here is the Preference.xml:
<PreferenceCategory
android:key="@string/pref_category_myNote_key"
android:title="@string/pref_category_myNote" >
<com.flounder.xeniaNote.view.ImageViewPreference
android:key="@string/pref_image_key"
android:title="@string/pref_image"
android:widgetLayout="@layout/pref_account_image" />
</PreferenceCategory>
And call mImagePref.setImageto change ImageViewin the callback method onPreferenceClick.
I want this to help! Good luck.