List of usage examples for android.content Intent ACTION_GET_CONTENT
String ACTION_GET_CONTENT
To view the source code for android.content Intent ACTION_GET_CONTENT.
Click Source Link
From source file:com.openerp.addons.messages.MessageComposeActivty.java
/** * requesting for file browse for attachment in message * /*from w w w . j a va2 s. co m*/ * @param type */ private void requestForAttachmentIntent(ATTACHMENT_TYPE type) { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType(attachments_type.get(type)); startActivityForResult(intent, PICKFILE_RESULT_CODE); }
From source file:com.boko.vimusic.ui.activities.ProfileActivity.java
/** * Starts an activity for result that returns an image from the Gallery. *///from w ww .j a v a2 s.c om public void selectNewPhoto() { // First remove the old image removeFromCache(); // Now open the gallery final Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null); intent.setType("image/*"); startActivityForResult(intent, NEW_PHOTO); }
From source file:com.facebook.react.views.webview.ReactWebViewManager.java
@Override protected WebView createViewInstance(final ThemedReactContext reactContext) { final ReactWebView webView = new ReactWebView(reactContext); /**/* w w w . j av a 2 s .c om*/ * cookie? * 5.0???cookie,5.0?false * */ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true); } webView.setDownloadListener(new DownloadListener() { @Override public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) { Uri uri = Uri.parse(url); Intent intent = new Intent(Intent.ACTION_VIEW, uri); reactContext.getCurrentActivity().startActivity(intent); // DownloadManager.Request request = new DownloadManager.Request( // Uri.parse(url)); // // request.setMimeType(mimetype); // String cookies = CookieManager.getInstance().getCookie(url); // request.addRequestHeader("cookie", cookies); // request.addRequestHeader("User-Agent", userAgent); // request.allowScanningByMediaScanner(); //// request.setTitle() // request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); //Notify client once download is completed! // request.setDestinationInExternalPublicDir( // Environment.DIRECTORY_DOWNLOADS, URLUtil.guessFileName( // url, contentDisposition, mimetype)); // DownloadManager dm = (DownloadManager) reactContext.getCurrentActivity().getSystemService(DOWNLOAD_SERVICE); // dm.enqueue(request); // Toast.makeText(reactContext, "...", //To notify the Client that the file is being downloaded // Toast.LENGTH_LONG).show(); } }); webView.setWebChromeClient(new WebChromeClient() { @Override public boolean onConsoleMessage(ConsoleMessage message) { if (ReactBuildConfig.DEBUG) { return super.onConsoleMessage(message); } // Ignore console logs in non debug builds. return true; } @Override public void onGeolocationPermissionsShowPrompt(String origin, GeolocationPermissions.Callback callback) { callback.invoke(origin, true, false); } private File createImageFile() throws IOException { // Create an image file name String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); String imageFileName = "JPEG_" + timeStamp + "_"; File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES); File imageFile = new File(storageDir, /* directory */ imageFileName + ".jpg" /* filename */ ); return imageFile; } public boolean onShowFileChooser(WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams) { if (mFilePathCallback != null) { mFilePathCallback.onReceiveValue(null); } mFilePathCallback = filePathCallback; Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (takePictureIntent .resolveActivity(reactContext.getCurrentActivity().getPackageManager()) != null) { // Create the File where the photo should go File photoFile = null; try { photoFile = createImageFile(); takePictureIntent.putExtra("PhotoPath", mCameraPhotoPath); } catch (IOException ex) { // Error occurred while creating the File FLog.e(ReactConstants.TAG, "Unable to create Image File", ex); } // Continue only if the File was successfully created if (photoFile != null) { mCameraPhotoPath = "file:" + photoFile.getAbsolutePath(); takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile)); } else { takePictureIntent = null; } } Intent contentSelectionIntent = new Intent(Intent.ACTION_GET_CONTENT); contentSelectionIntent.addCategory(Intent.CATEGORY_OPENABLE); contentSelectionIntent.setType("*/*"); Intent[] intentArray; if (takePictureIntent != null) { intentArray = new Intent[] { takePictureIntent }; } else { intentArray = new Intent[0]; } Intent chooserIntent = new Intent(Intent.ACTION_CHOOSER); chooserIntent.putExtra(Intent.EXTRA_INTENT, contentSelectionIntent); chooserIntent.putExtra(Intent.EXTRA_TITLE, "?"); chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, intentArray); reactContext.getCurrentActivity().startActivityForResult(chooserIntent, INPUT_FILE_REQUEST_CODE); // final Intent galleryIntent = new Intent(Intent.ACTION_PICK); // galleryIntent.setType("image/*"); // final Intent chooserIntent = Intent.createChooser(galleryIntent, "Choose File"); // reactContext.getCurrentActivity().startActivityForResult(chooserIntent, INPUT_FILE_REQUEST_CODE); return true; } @Override public void onShowCustomView(View view, CustomViewCallback callback) { if (mVideoView != null) { callback.onCustomViewHidden(); return; } // Store the view and it's callback for later, so we can dispose of them correctly mVideoView = view; mCustomViewCallback = callback; view.setBackgroundColor(Color.BLACK); getRootView().addView(view, FULLSCREEN_LAYOUT_PARAMS); webView.setVisibility(View.GONE); UiThreadUtil.runOnUiThread(new Runnable() { @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void run() { // If the status bar is translucent hook into the window insets calculations // and consume all the top insets so no padding will be added under the status bar. View decorView = reactContext.getCurrentActivity().getWindow().getDecorView(); decorView.setOnApplyWindowInsetsListener(null); ViewCompat.requestApplyInsets(decorView); } }); reactContext.getCurrentActivity() .setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); } @Override public void onHideCustomView() { if (mVideoView == null) { return; } mVideoView.setVisibility(View.GONE); getRootView().removeView(mVideoView); mVideoView = null; mCustomViewCallback.onCustomViewHidden(); webView.setVisibility(View.VISIBLE); // View decorView = reactContext.getCurrentActivity().getWindow().getDecorView(); // // Show Status Bar. // int uiOptions = View.SYSTEM_UI_FLAG_VISIBLE; // decorView.setSystemUiVisibility(uiOptions); UiThreadUtil.runOnUiThread(new Runnable() { @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void run() { // If the status bar is translucent hook into the window insets calculations // and consume all the top insets so no padding will be added under the status bar. View decorView = reactContext.getCurrentActivity().getWindow().getDecorView(); // decorView.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() { // @Override // public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) { // WindowInsets defaultInsets = v.onApplyWindowInsets(insets); // return defaultInsets.replaceSystemWindowInsets( // defaultInsets.getSystemWindowInsetLeft(), // 0, // defaultInsets.getSystemWindowInsetRight(), // defaultInsets.getSystemWindowInsetBottom()); // } // }); decorView.setOnApplyWindowInsetsListener(null); ViewCompat.requestApplyInsets(decorView); } }); reactContext.getCurrentActivity().setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); } private ViewGroup getRootView() { return ((ViewGroup) reactContext.getCurrentActivity().findViewById(android.R.id.content)); } }); reactContext.addLifecycleEventListener(webView); reactContext.addActivityEventListener(new ActivityEventListener() { @Override public void onActivityResult(Activity activity, int requestCode, int resultCode, Intent data) { if (requestCode != INPUT_FILE_REQUEST_CODE || mFilePathCallback == null) { return; } Uri[] results = null; // Check that the response is a good one if (resultCode == Activity.RESULT_OK) { if (data == null) { // If there is not data, then we may have taken a photo if (mCameraPhotoPath != null) { results = new Uri[] { Uri.parse(mCameraPhotoPath) }; } } else { String dataString = data.getDataString(); if (dataString != null) { results = new Uri[] { Uri.parse(dataString) }; } } } if (results == null) { mFilePathCallback.onReceiveValue(new Uri[] {}); } else { mFilePathCallback.onReceiveValue(results); } mFilePathCallback = null; return; } @Override public void onNewIntent(Intent intent) { } }); mWebViewConfig.configWebView(webView); webView.getSettings().setBuiltInZoomControls(true); webView.getSettings().setDisplayZoomControls(false); webView.getSettings().setDomStorageEnabled(true); webView.getSettings().setDefaultFontSize(16); webView.getSettings().setTextZoom(100); // Fixes broken full-screen modals/galleries due to body height being 0. webView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); if (ReactBuildConfig.DEBUG && Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { WebView.setWebContentsDebuggingEnabled(true); } return webView; }
From source file:com.xorcode.andtweet.TweetListActivity.java
/** * Listener that checks for clicks on the main list view. * // ww w. j av a 2s .c om * @param adapterView * @param view * @param position * @param id */ @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { if (MyLog.isLoggable(TAG, Log.VERBOSE)) { Log.v(TAG, "onItemClick, id=" + id); } if (id <= 0) { return; } Uri uri = ContentUris.withAppendedId(Tweets.CONTENT_URI, id); String action = getIntent().getAction(); if (Intent.ACTION_PICK.equals(action) || Intent.ACTION_GET_CONTENT.equals(action)) { if (MyLog.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "onItemClick, setData=" + uri); } setResult(RESULT_OK, new Intent().setData(uri)); } else { if (MyLog.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "onItemClick, startActivity=" + uri); } startActivity(new Intent(Intent.ACTION_VIEW, uri)); } }
From source file:com.example.zf_android.activity.MerchantEdit.java
private void show3Dialog(int type, final String uri) { AlertDialog.Builder builder = new AlertDialog.Builder(MerchantEdit.this); final String[] items = getResources().getStringArray(R.array.apply_detail_view); MerchantEdit.this.type = type; builder.setItems(items, new DialogInterface.OnClickListener() { @Override//from www. j a v a 2s . c o m public void onClick(DialogInterface dialog, int which) { switch (which) { case 0: { AlertDialog.Builder build = new AlertDialog.Builder(MerchantEdit.this); LayoutInflater factory = LayoutInflater.from(MerchantEdit.this); final View textEntryView = factory.inflate(R.layout.show_view, null); build.setView(textEntryView); final ImageView view = (ImageView) textEntryView.findViewById(R.id.imag); // ImageCacheUtil.IMAGE_CACHE.get(uri, view); ImageLoader.getInstance().displayImage(uri, view, options); build.create().show(); break; } case 1: { Intent intent; if (Build.VERSION.SDK_INT < 19) { intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("image/*"); } else { intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); } startActivityForResult(intent, REQUEST_UPLOAD_IMAGE); break; } case 2: { String state = Environment.getExternalStorageState(); if (state.equals(Environment.MEDIA_MOUNTED)) { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); File outDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES); if (!outDir.exists()) { outDir.mkdirs(); } File outFile = new File(outDir, System.currentTimeMillis() + ".jpg"); photoPath = outFile.getAbsolutePath(); intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(outFile)); intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); startActivityForResult(intent, REQUEST_TAKE_PHOTO); } else { CommonUtil.toastShort(MerchantEdit.this, getString(R.string.toast_no_sdcard)); } break; } } } }); builder.show(); }
From source file:org.alfresco.mobile.android.application.extension.samsung.pen.SNoteEditorActivity.java
private void requestPickImage() { // gallery? image . try {/*from w w w.j a va2 s . c om*/ Intent galleryIntent = new Intent(Intent.ACTION_GET_CONTENT); galleryIntent.setType("image/*"); startActivityForResult(galleryIntent, REQUEST_CODE_ATTACH_IMAGE); } catch (ActivityNotFoundException e) { e.printStackTrace(); } }
From source file:org.andstatus.app.msg.TimelineActivity.java
public void onItemClick(AdapterView<?> adapterView, final View view, final int position, final long id) { if (id <= 0) { if (MyLog.isVerboseEnabled()) { MyLog.v(this, "onItemClick, position=" + position + "; id=" + id + "; view=" + view); }/*from w ww . j a v a2s . c om*/ return; } new AsyncTask<Void, Void, Uri>() { @Override protected Uri doInBackground(Void... params) { long linkedUserId = getLinkedUserIdFromCursor(position); MyAccount ma = MyContextHolder.get().persistentAccounts().getAccountForThisMessage(id, linkedUserId, mListParametersNew.myAccountUserId, false); if (MyLog.isVerboseEnabled()) { MyLog.v(this, "onItemClick, position=" + position + "; id=" + id + "; view=" + view + "; linkedUserId=" + linkedUserId + " account=" + ma.getAccountName()); } return MatchedUri.getTimelineItemUri(ma.getUserId(), mListParametersNew.getTimelineType(), mListParametersNew.isTimelineCombined(), mListParametersNew.getSelectedUserId(), id); } @Override protected void onPostExecute(Uri uri) { String action = getIntent().getAction(); if (Intent.ACTION_PICK.equals(action) || Intent.ACTION_GET_CONTENT.equals(action)) { if (MyLog.isLoggable(this, MyLog.DEBUG)) { MyLog.d(this, "onItemClick, setData=" + uri); } setResult(RESULT_OK, new Intent().setData(uri)); } else { if (MyLog.isLoggable(this, MyLog.DEBUG)) { MyLog.d(this, "onItemClick, startActivity=" + uri); } startActivity(MyAction.VIEW_CONVERSATION.getIntent(uri)); } } }.execute(); }
From source file:com.amaze.carbonfilemanager.activities.MainActivity.java
/** * Called when the activity is first created. */// w w w.j a v a 2 s.com @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); initialisePreferences(); initializeInteractiveShell(); dataUtils = new DataUtils(); dataUtils.registerOnDataChangedListener(this); setContentView(R.layout.main_toolbar); initialiseViews(); tabHandler = new TabHandler(this); mImageLoader = AppConfig.getInstance().getImageLoader(); utils = getFutils(); mainActivityHelper = new MainActivityHelper(this); initialiseFab(); // TODO: Create proper SQLite database handler class with calls to database from background thread history = new HistoryManager(this, "Table2"); history.initializeTable(DataUtils.HISTORY, 0); history.initializeTable(DataUtils.HIDDEN, 0); grid = new HistoryManager(this, "listgridmodes"); grid.initializeTable(DataUtils.LIST, 0); grid.initializeTable(DataUtils.GRID, 0); grid.initializeTable(DataUtils.BOOKS, 1); grid.initializeTable(DataUtils.SMB, 1); if (!sharedPref.getBoolean("booksadded", false)) { grid.make(DataUtils.BOOKS); sharedPref.edit().putBoolean("booksadded", true).commit(); } dataUtils.setHiddenfiles(history.readTable(DataUtils.HIDDEN)); dataUtils.setGridfiles(grid.readTable(DataUtils.GRID)); dataUtils.setListfiles(grid.readTable(DataUtils.LIST)); // initialize g+ api client as per preferences if (sharedPref.getBoolean("plus_pic", false)) { mGoogleApiClient = new GoogleApiClient.Builder(this).addConnectionCallbacks(this) .addOnConnectionFailedListener(this).addApi(Plus.API).addScope(Plus.SCOPE_PLUS_LOGIN).build(); } if (CloudSheetFragment.isCloudProviderAvailable(this)) { getSupportLoaderManager().initLoader(REQUEST_CODE_CLOUD_LIST_KEY_CLOUD, null, this); } util = new IconUtils(sharedPref, this); icons = new IconUtils(sharedPref, this); timer = new CountDownTimer(5000, 1000) { @Override public void onTick(long l) { } @Override public void onFinish() { utils.crossfadeInverse(buttons, pathbar); } }; path = getIntent().getStringExtra("path"); openProcesses = getIntent().getBooleanExtra(KEY_INTENT_PROCESS_VIEWER, false); try { intent = getIntent(); if (intent.getStringArrayListExtra(TAG_INTENT_FILTER_FAILED_OPS) != null) { ArrayList<BaseFile> failedOps = intent.getParcelableArrayListExtra(TAG_INTENT_FILTER_FAILED_OPS); if (failedOps != null) { mainActivityHelper.showFailedOperationDialog(failedOps, intent.getBooleanExtra("move", false), this); } } if (intent.getAction() != null) { if (intent.getAction().equals(Intent.ACTION_GET_CONTENT)) { // file picker intent mReturnIntent = true; Toast.makeText(this, getString(R.string.pick_a_file), Toast.LENGTH_LONG).show(); } else if (intent.getAction().equals(RingtoneManager.ACTION_RINGTONE_PICKER)) { // ringtone picker intent mReturnIntent = true; mRingtonePickerIntent = true; Toast.makeText(this, getString(R.string.pick_a_file), Toast.LENGTH_LONG).show(); } else if (intent.getAction().equals(Intent.ACTION_VIEW)) { // zip viewer intent Uri uri = intent.getData(); openzip = true; zippath = uri.toString(); } } } catch (Exception e) { e.printStackTrace(); } if (savedInstanceState != null) { selectedStorage = savedInstanceState.getInt("selectitem", SELECT_0); } refreshDrawer(); // setting window background color instead of each item, in order to reduce pixel overdraw if (getAppTheme().equals(AppTheme.LIGHT)) { /*if(Main.IS_LIST) getWindow().setBackgroundDrawableResource(android.R.color.white); else getWindow().setBackgroundDrawableResource(R.color.grid_background_light); */ getWindow().setBackgroundDrawableResource(android.R.color.white); } else { getWindow().setBackgroundDrawableResource(R.color.holo_dark_background); } if (savedInstanceState == null) { if (openProcesses) { android.support.v4.app.FragmentTransaction transaction = getSupportFragmentManager() .beginTransaction(); transaction.replace(R.id.content_frame, new ProcessViewer(), KEY_INTENT_PROCESS_VIEWER); //transaction.addToBackStack(null); selectedStorage = SELECT_102; openProcesses = false; //title.setText(utils.getString(con, R.string.process_viewer)); //Commit the transaction transaction.commit(); supportInvalidateOptionsMenu(); } else if (intent.getAction() != null && intent.getAction().equals(TileService.ACTION_QS_TILE_PREFERENCES)) { // tile preferences, open ftp fragment android.support.v4.app.FragmentTransaction transaction2 = getSupportFragmentManager() .beginTransaction(); transaction2.replace(R.id.content_frame, new FTPServerFragment()); findViewById(R.id.lin).animate().translationY(0).setInterpolator(new DecelerateInterpolator(2)) .start(); selectedStorage = SELECT_MINUS_2; adapter.toggleChecked(false); transaction2.commit(); } else { if (path != null && path.length() > 0) { HFile file = new HFile(OpenMode.UNKNOWN, path); file.generateMode(this); if (file.isDirectory()) goToMain(path); else { goToMain(""); utils.openFile(new File(path), this); } } else { goToMain(""); } } } else { COPY_PATH = savedInstanceState.getParcelableArrayList("COPY_PATH"); MOVE_PATH = savedInstanceState.getParcelableArrayList("MOVE_PATH"); oppathe = savedInstanceState.getString("oppathe"); oppathe1 = savedInstanceState.getString("oppathe1"); oparrayList = savedInstanceState.getParcelableArrayList("oparrayList"); operation = savedInstanceState.getInt("operation"); selectedStorage = savedInstanceState.getInt("selectitem", SELECT_0); //mainFragment = (Main) savedInstanceState.getParcelable("main_fragment"); adapter.toggleChecked(selectedStorage); } if (getAppTheme().equals(AppTheme.DARK)) { mDrawerList.setBackgroundColor(ContextCompat.getColor(this, R.color.holo_dark_background)); } mDrawerList.setDivider(null); if (!isDrawerLocked) { mDrawerToggle = new ActionBarDrawerToggle(this, /* host Activity */ mDrawerLayout, /* DrawerLayout object */ R.drawable.ic_drawer_l, /* nav drawer image to replace 'Up' caret */ R.string.drawer_open, /* "open drawer" description for accessibility */ R.string.drawer_close /* "close drawer" description for accessibility */ ) { public void onDrawerClosed(View view) { mainActivity.onDrawerClosed(); } public void onDrawerOpened(View drawerView) { //title.setText("Amaze File Manager"); // creates call to onPrepareOptionsMenu() } }; mDrawerLayout.setDrawerListener(mDrawerToggle); getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_drawer_l); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setHomeButtonEnabled(true); mDrawerToggle.syncState(); } /*((ImageButton) findViewById(R.id.drawer_buttton)).setOnClickListener(new ImageView.OnClickListener() { @Override public void onClick(View view) { if (mDrawerLayout.isDrawerOpen(mDrawerLinear)) { mDrawerLayout.closeDrawer(mDrawerLinear); } else mDrawerLayout.openDrawer(mDrawerLinear); } });*/ if (mDrawerToggle != null) { mDrawerToggle.setDrawerIndicatorEnabled(true); mDrawerToggle.setHomeAsUpIndicator(R.drawable.ic_drawer_l); } //recents header color implementation if (SDK_INT >= 21) { ActivityManager.TaskDescription taskDescription = new ActivityManager.TaskDescription("Amaze", ((BitmapDrawable) getResources().getDrawable(R.mipmap.ic_launcher)).getBitmap(), getColorPreference().getColor(ColorUsage.getPrimary(MainActivity.currentTab))); setTaskDescription(taskDescription); } }
From source file:studio.imedia.vehicleinspection.fragments.CarInfoFragment.java
/** * 4.4/*from w w w.j a v a 2 s . c om*/ */ @TargetApi(Build.VERSION_CODES.KITKAT) private void selectAfterKitkat() { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("image/*"); startActivityForResult(intent, REQUEST_GALLERY_AFTER_KITKAT); }
From source file:com.dvn.vindecoder.ui.seller.GetAllVehicalSellerDetails.java
private void startDilog() { AlertDialog.Builder myAlertDilog = new AlertDialog.Builder(GetAllVehicalSellerDetails.this); myAlertDilog.setTitle("Upload picture option.."); myAlertDilog.setMessage("Take Photo"); myAlertDilog.setPositiveButton("Gallery", new DialogInterface.OnClickListener() { @Override/*from w w w .j av a 2 s .c o m*/ public void onClick(DialogInterface dialog, int which) { Intent picIntent = new Intent(Intent.ACTION_GET_CONTENT, null); picIntent.setType("image/*"); picIntent.putExtra("return_data", true); startActivityForResult(picIntent, GALLERY_REQUEST); } }); myAlertDilog.setNegativeButton("Camera", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (checkPermission(Manifest.permission.CAMERA, GetAllVehicalSellerDetails.this)) { openCameraApplication(); } else { requestPermission(GetAllVehicalSellerDetails.this, new String[] { Manifest.permission.CAMERA }, REQUEST_ACESS_CAMERA); } } else { openCameraApplication(); } } }); myAlertDilog.show(); }