I have verified that setOnClickListener is being called, so why doesn't the button click do anything in 2.3? It works fine in 4.1. I am testing on emulators with cameras emulated. I have tried making sure the button is clickable in xml, but that didn't do anything.
ImageButton mPhotoButton = null;
if (v != null) {
mPhotoButton = (ImageButton) v.findViewById(R.id.crime_imageButton);
}
if (mPhotoButton != null) {
mPhotoButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent i = new Intent(getActivity(), CrimeCameraActivity.class);
startActivityForResult(i, REQUEST_PHOTO);
}
});
}
xml:
<ImageButton
android:id="@+id/crime_imageButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@android:drawable/ic_menu_camera"/>
setting button to disabled, why is this executing only in 2.3?:
PackageManager pm = getActivity().getPackageManager();
if (pm != null) {
if (!pm.hasSystemFeature(PackageManager.FEATURE_CAMERA) && !pm.hasSystemFeature(PackageManager.FEATURE_CAMERA_FRONT)) {
if (mPhotoButton != null) {
mPhotoButton.setEnabled(false);
}
}
}