This is my code. I want to select an image from either camera or gallery. For this i have to check the camera support feature of a device.
  public void selectImage() {
            final String[] items = new String[]{"Camera", "Gallery"};
            final Integer[] icons = new Integer[]{R.drawable.ic_camera, R.drawable.ic_gallery};
            ListAdapter adapter = new ArrayAdapterWithIcon(getActivity(), items, icons);
            new AlertDialog.Builder(getActivity()).setTitle("Select Picture")
                    .setAdapter(adapter, new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int item) {
                            if (items[item].equals("Camera")) {
                                if (//here i want to check is there mobile exists camera or not) {
                                    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
                                    startActivityForResult(intent, REQUEST_CAMERA);
                                } 
                            } else if (items[item].equals("Gallery")) {
                                    Intent intent = new Intent();
                                    intent.setType("image/*");
                                    intent.setAction(Intent.ACTION_GET_CONTENT);
                                    intent.addCategory(Intent.CATEGORY_OPENABLE);
                                    startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE);
                            }
                        }
                    }).show();
        }
I have tried a lot but no success.
 
     
    