Source:
private void setupAddMenuPopup() { String capturePhoto = getString(R.string.media_add_popup_capture_photo); String captureVideo = getString(R.string.media_add_popup_capture_video); String pickPhotoFromGallery = getString(R.string.select_photo); String pickVideoFromGallery = getString(R.string.select_video); String[] items = new String[] { capturePhoto, captureVideo, pickPhotoFromGallery, pickVideoFromGallery }; @SuppressLint("InflateParams") View menuView = getLayoutInflater().inflate(R.layout.actionbar_add_media, null, false); final ArrayAdapter<String> adapter = new ArrayAdapter<>(this, R.layout.actionbar_add_media_cell, items); ListView listView = (ListView) menuView.findViewById(R.id.actionbar_add_media_listview); listView.setAdapter(adapter); listView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { adapter.notifyDataSetChanged(); AppLockManager.getInstance().setExtendedTimeout(); if (position == 0) { MediaBrowserActivity enclosingActivity = MediaBrowserActivity.this; WordPressMediaUtils.launchCamera(enclosingActivity, BuildConfig.APPLICATION_ID, enclosingActivity); } else if (position == 1) { WordPressMediaUtils.launchVideoCamera(MediaBrowserActivity.this); } else if (position == 2) { WordPressMediaUtils.launchPictureLibrary(MediaBrowserActivity.this); } else if (position == 3) { WordPressMediaUtils.launchVideoLibrary(MediaBrowserActivity.this); } mAddMediaPopup.dismiss(); } }); int width = getResources().getDimensionPixelSize(R.dimen.action_bar_spinner_width); mAddMediaPopup = new PopupWindow(menuView, width, ViewGroup.LayoutParams.WRAP_CONTENT, true); mAddMediaPopup.setBackgroundDrawable(new ColorDrawable()); }

Target:
private void setupAddMenuPopup() { String capturePhoto = getString(R.string.media_add_popup_capture_photo); String captureVideo = getString(R.string.media_add_popup_capture_video); String pickPhotoFromGallery = getString(R.string.select_photo); String pickVideoFromGallery = getString(R.string.select_video); String[] items = new String[] { capturePhoto, captureVideo, pickPhotoFromGallery, pickVideoFromGallery }; @SuppressLint("InflateParams") View menuView = getLayoutInflater().inflate(R.layout.actionbar_add_media, null, false); final ArrayAdapter<String> adapter = new ArrayAdapter<>(this, R.layout.actionbar_add_media_cell, items); ListView listView = (ListView) menuView.findViewById(R.id.actionbar_add_media_listview); listView.setAdapter(adapter); listView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { adapter.notifyDataSetChanged(); if (position == 0) { MediaBrowserActivity enclosingActivity = MediaBrowserActivity.this; WordPressMediaUtils.launchCamera(enclosingActivity, BuildConfig.APPLICATION_ID, enclosingActivity); } else if (position == 1) { WordPressMediaUtils.launchVideoCamera(MediaBrowserActivity.this); } else if (position == 2) { WordPressMediaUtils.launchPictureLibrary(MediaBrowserActivity.this); } else if (position == 3) { WordPressMediaUtils.launchVideoLibrary(MediaBrowserActivity.this); } mAddMediaPopup.dismiss(); } }); int width = getResources().getDimensionPixelSize(R.dimen.action_bar_spinner_width); mAddMediaPopup = new PopupWindow(menuView, width, ViewGroup.LayoutParams.WRAP_CONTENT, true); mAddMediaPopup.setBackgroundDrawable(new ColorDrawable()); }