List of usage examples for android.content Intent ACTION_PICK
String ACTION_PICK
To view the source code for android.content Intent ACTION_PICK.
Click Source Link
From source file:cn.kangeqiu.kq.activity.ChatActivity.java
/** * ?// w w w.ja v a2 s . co m */ public void selectPicFromLocal() { 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_CODE_LOCAL); }
From source file:com.grass.caishi.cc.activity.ChatActivity.java
/** * ?/*from w w w.ja v a 2s .c om*/ */ public void selectPicFromLocal() { 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_CODE_LOCAL); }
From source file:edu.usf.cutr.opentripplanner.android.fragments.MainFragment.java
private void addInterfaceListeners() { final OnMapClickListener onMapClickListener = new OnMapClickListener() { @Override/*from w ww.jav a2s.c o m*/ public void onMapClick(LatLng latlng) { InputMethodManager imm = (InputMethodManager) MainFragment.this.getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(mTbEndLocation.getWindowToken(), 0); imm.hideSoftInputFromWindow(mTbStartLocation.getWindowToken(), 0); if (mTbStartLocation.hasFocus()) { setMarker(true, latlng, true); } else { setMarker(false, latlng, true); } } }; mMap.setOnMapClickListener(onMapClickListener); OnMarkerDragListener onMarkerDragListener = new OnMarkerDragListener() { @Override public void onMarkerDrag(Marker marker) { } @Override public void onMarkerDragEnd(Marker marker) { LatLng markerLatlng = marker.getPosition(); if (((mOTPApp.getSelectedServer() != null) && LocationUtil.checkPointInBoundingBox(markerLatlng, mOTPApp.getSelectedServer(), OTPApp.CHECK_BOUNDS_ACCEPTABLE_ERROR)) || (mOTPApp.getSelectedServer() == null)) { if ((mStartMarker != null) && (marker.hashCode() == mStartMarker.hashCode())) { if (mPrefs.getBoolean(OTPApp.PREFERENCE_KEY_USE_INTELLIGENT_MARKERS, true)) { updateMarkerPosition(markerLatlng, true); } else { mIsStartLocationGeocodingCompleted = true; removeFocus(true); setMarker(true, markerLatlng, false); } mStartMarkerPosition = markerLatlng; } else if ((mEndMarker != null) && (marker.hashCode() == mEndMarker.hashCode())) { if (mPrefs.getBoolean(OTPApp.PREFERENCE_KEY_USE_INTELLIGENT_MARKERS, true)) { updateMarkerPosition(markerLatlng, false); } else { mIsEndLocationGeocodingCompleted = true; removeFocus(false); setMarker(false, markerLatlng, false); } mEndMarkerPosition = markerLatlng; } } else { if ((mStartMarker != null) && (marker.hashCode() == mStartMarker.hashCode())) { marker.setPosition(mStartMarkerPosition); } else { marker.setPosition(mEndMarkerPosition); } Toast.makeText(mApplicationContext, mApplicationContext.getResources().getString( R.string.toast_map_markers_marker_out_of_boundaries), Toast.LENGTH_SHORT).show(); } } @Override public void onMarkerDragStart(Marker marker) { InputMethodManager imm = (InputMethodManager) MainFragment.this.getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(mTbEndLocation.getWindowToken(), 0); imm.hideSoftInputFromWindow(mTbStartLocation.getWindowToken(), 0); } }; mMap.setOnMarkerDragListener(onMarkerDragListener); OnMapLongClickListener onMapLongClickListener = new OnMapLongClickListener() { @Override public void onMapLongClick(LatLng latlng) { InputMethodManager imm = (InputMethodManager) MainFragment.this.getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(mTbEndLocation.getWindowToken(), 0); imm.hideSoftInputFromWindow(mTbStartLocation.getWindowToken(), 0); final LatLng latLngFinal = latlng; final CharSequence[] items = { mApplicationContext.getResources() .getString(R.string.point_type_selector_start_marker_option), mApplicationContext.getResources() .getString(R.string.point_type_selector_end_marker_option) }; AlertDialog.Builder builder = new AlertDialog.Builder(MainFragment.this.getActivity()); builder.setTitle(getResources().getString(R.string.point_type_selector_title)); builder.setItems(items, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { if (item == 0) { setMarker(true, latLngFinal, true); } else { setMarker(false, latLngFinal, true); } } }); AlertDialog alert = builder.create(); alert.show(); } }; mMap.setOnMapLongClickListener(onMapLongClickListener); OnClickListener onClickListener = new OnClickListener() { @Override public void onClick(View v) { mDrawerLayout.openDrawer(Gravity.LEFT); } }; mBtnHandle.setOnClickListener(onClickListener); OnInfoWindowClickListener onInfoWindowClickListener = new OnInfoWindowClickListener() { @Override public void onInfoWindowClick(Marker modeMarker) { saveOTPBundle(); OTPBundle otpBundle = getFragmentListener().getOTPBundle(); Matcher matcher = Pattern.compile("\\d+").matcher(modeMarker.getTitle()); if (matcher.find()) { String numberString = modeMarker.getTitle().substring(0, matcher.end()); //Step indexes shown to the user are in a scale starting by 1 but instructions steps internally start by 0 int currentStepIndex = Integer.parseInt(numberString) - 1; otpBundle.setCurrentStepIndex(currentStepIndex); otpBundle.setFromInfoWindow(true); getFragmentListener().setOTPBundle(otpBundle); getFragmentListener().onSwitchedToDirectionFragment(); } } }; mMap.setOnInfoWindowClickListener(onInfoWindowClickListener); DrawerListener dl = new DrawerListener() { @Override public void onDrawerStateChanged(int arg0) { } @Override public void onDrawerSlide(View arg0, float arg1) { InputMethodManager imm = (InputMethodManager) MainFragment.this.getActivity() .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(mTbEndLocation.getWindowToken(), 0); imm.hideSoftInputFromWindow(mTbStartLocation.getWindowToken(), 0); } @Override public void onDrawerOpened(View arg0) { } @Override public void onDrawerClosed(View arg0) { } }; mDrawerLayout.setDrawerListener(dl); OnTouchListener otlStart = new RightDrawableOnTouchListener(mTbStartLocation) { @Override public boolean onDrawableTouch(final MotionEvent event) { final CharSequence[] items = { getResources().getString(R.string.text_box_dialog_location_type_current_location), getResources().getString(R.string.text_box_dialog_location_type_contact), getResources().getString(R.string.text_box_dialog_location_type_map_point) }; AlertDialog.Builder builder = new AlertDialog.Builder(MainFragment.this.getActivity()); builder.setTitle(getResources().getString(R.string.text_box_dialog_choose_location_type_start)); builder.setItems(items, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { if (items[item].equals(getResources() .getString(R.string.text_box_dialog_location_type_current_location))) { LatLng mCurrentLatLng = getLastLocation(); if (mCurrentLatLng != null) { SharedPreferences.Editor prefsEditor = mPrefs.edit(); setTextBoxLocation(getResources().getString(R.string.text_box_my_location), true); prefsEditor.putBoolean(OTPApp.PREFERENCE_KEY_ORIGIN_IS_MY_LOCATION, true); if (mStartMarker != null) { mStartMarker.remove(); mStartMarker = null; } prefsEditor.commit(); } else { Toast.makeText(MainFragment.this.mApplicationContext, mApplicationContext.getResources() .getString(R.string.toast_tripplanner_current_location_error), Toast.LENGTH_LONG).show(); } } else if (items[item] .equals(getResources().getString(R.string.text_box_dialog_location_type_contact))) { Intent intent = new Intent(Intent.ACTION_PICK); intent.setType(ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_TYPE); ((MyActivity) MainFragment.this.getActivity()).setButtonStartLocation(true); MainFragment.this.getActivity().startActivityForResult(intent, OTPApp.CHOOSE_CONTACT_REQUEST_CODE); } else { // Point on Map if (mStartMarker != null) { updateMarkerPosition(mStartMarker.getPosition(), true); } else { setTextBoxLocation("", true); mTbStartLocation .setHint(getResources().getString(R.string.text_box_need_to_place_marker)); mTbStartLocation.requestFocus(); } } } }); AlertDialog alert = builder.create(); alert.show(); return true; } }; mTbStartLocation.setOnTouchListener(otlStart); OnTouchListener otlEnd = new RightDrawableOnTouchListener(mTbEndLocation) { @Override public boolean onDrawableTouch(final MotionEvent event) { final CharSequence[] items = { getResources().getString(R.string.text_box_dialog_location_type_current_location), getResources().getString(R.string.text_box_dialog_location_type_contact), getResources().getString(R.string.text_box_dialog_location_type_map_point) }; AlertDialog.Builder builder = new AlertDialog.Builder(MainFragment.this.getActivity()); builder.setTitle(getResources().getString(R.string.text_box_dialog_choose_location_type_end)); builder.setItems(items, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { if (items[item].equals(getResources() .getString(R.string.text_box_dialog_location_type_current_location))) { LatLng mCurrentLatLng = getLastLocation(); if (mCurrentLatLng != null) { SharedPreferences.Editor prefsEditor = mPrefs.edit(); setTextBoxLocation(getResources().getString(R.string.text_box_my_location), false); prefsEditor.putBoolean(OTPApp.PREFERENCE_KEY_DESTINATION_IS_MY_LOCATION, true); if (mEndMarker != null) { mEndMarker.remove(); mEndMarker = null; } prefsEditor.commit(); } else { Toast.makeText(MainFragment.this.mApplicationContext, mApplicationContext.getResources() .getString(R.string.toast_tripplanner_current_location_error), Toast.LENGTH_LONG).show(); } } else if (items[item] .equals(getResources().getString(R.string.text_box_dialog_location_type_contact))) { Intent intent = new Intent(Intent.ACTION_PICK); intent.setType(ContactsContract.CommonDataKinds.StructuredPostal.CONTENT_TYPE); ((MyActivity) MainFragment.this.getActivity()).setButtonStartLocation(false); MainFragment.this.getActivity().startActivityForResult(intent, OTPApp.CHOOSE_CONTACT_REQUEST_CODE); } else { // Point on Map if (mEndMarker != null) { updateMarkerPosition(mEndMarker.getPosition(), false); } else { setTextBoxLocation("", false); mTbEndLocation .setHint(getResources().getString(R.string.text_box_need_to_place_marker)); mTbEndLocation.requestFocus(); } } } }); AlertDialog alert = builder.create(); alert.show(); return true; } }; mTbEndLocation.setOnTouchListener(otlEnd); mBtnPlanTrip.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { processRequestTrip(); } }); OnFocusChangeListener tbLocationOnFocusChangeListener = new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { mMap.setOnMapClickListener(onMapClickListener); } TextView tv = (TextView) v; if (!hasFocus) { CharSequence tvCharSequence = tv.getText(); if (tvCharSequence != null) { String text = tvCharSequence.toString(); if (!TextUtils.isEmpty(text)) { if (v.getId() == R.id.tbStartLocation && !mIsStartLocationGeocodingCompleted && !mPrefs.getBoolean(OTPApp.PREFERENCE_KEY_ORIGIN_IS_MY_LOCATION, true)) { processAddress(true, text, false); } else if (v.getId() == R.id.tbEndLocation && !mIsEndLocationGeocodingCompleted && !mPrefs.getBoolean(OTPApp.PREFERENCE_KEY_DESTINATION_IS_MY_LOCATION, true)) { processAddress(false, text, false); } } else { if (v.getId() == R.id.tbStartLocation) { tv.setHint(getResources().getString(R.string.text_box_start_location_hint)); } else if (v.getId() == R.id.tbEndLocation) { tv.setHint(getResources().getString(R.string.text_box_end_location_hint)); } } } else { Log.w(OTPApp.TAG, "Focus has changed, but was not possible to obtain start/end" + " textbox text"); } } } }; mTbStartLocation.setOnFocusChangeListener(tbLocationOnFocusChangeListener); mTbEndLocation.setOnFocusChangeListener(tbLocationOnFocusChangeListener); TextWatcher textWatcherStart = new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { if (mIsStartLocationChangedByUser) { SharedPreferences.Editor prefsEditor = mPrefs.edit(); prefsEditor.putBoolean(OTPApp.PREFERENCE_KEY_ORIGIN_IS_MY_LOCATION, false); prefsEditor.commit(); mIsStartLocationGeocodingCompleted = false; } else { mIsStartLocationChangedByUser = true; } } }; TextWatcher textWatcherEnd = new TextWatcher() { @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void afterTextChanged(Editable s) { if (mIsEndLocationChangedByUser) { SharedPreferences.Editor prefsEditor = mPrefs.edit(); prefsEditor.putBoolean(OTPApp.PREFERENCE_KEY_DESTINATION_IS_MY_LOCATION, false); prefsEditor.commit(); mIsEndLocationGeocodingCompleted = false; } else { mIsEndLocationChangedByUser = true; } } }; mTbStartLocation.addTextChangedListener(textWatcherStart); mTbEndLocation.addTextChangedListener(textWatcherEnd); OnEditorActionListener tbLocationOnEditorActionListener = new OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (v.getId() == R.id.tbStartLocation) { if (actionId == EditorInfo.IME_ACTION_NEXT || (event != null && event.getAction() == KeyEvent.ACTION_DOWN && event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) { if (!mIsStartLocationGeocodingCompleted && !mPrefs.getBoolean(OTPApp.PREFERENCE_KEY_ORIGIN_IS_MY_LOCATION, true)) { CharSequence tvCharSequence = v.getText(); if (tvCharSequence != null) { processAddress(true, tvCharSequence.toString(), false); } else { Log.w(OTPApp.TAG, "User switched to next input, but was not possible to" + "obtain start/end textbox text"); } } } } else if (v.getId() == R.id.tbEndLocation) { if (actionId == EditorInfo.IME_ACTION_DONE || (event != null && event.getAction() == KeyEvent.ACTION_DOWN && event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) { processRequestTrip(); } } return false; } }; mTbStartLocation.setOnEditorActionListener(tbLocationOnEditorActionListener); mTbEndLocation.setOnEditorActionListener(tbLocationOnEditorActionListener); OnClickListener oclDisplayDirection = new OnClickListener() { @Override public void onClick(View arg0) { saveOTPBundle(); getFragmentListener().onSwitchedToDirectionFragment(); } }; mBtnDisplayDirection.setOnClickListener(oclDisplayDirection); // Do NOT show direction icon if there is no direction yet toggleItinerarySelectionSpinner(!getFragmentListener().getCurrentItinerary().isEmpty()); OnClickListener oclMyLocation = new OnClickListener() { @Override public void onClick(View arg0) { LatLng mCurrentLatLng = getLastLocation(); if (mCurrentLatLng == null) { Toast.makeText(mApplicationContext, mApplicationContext.getResources() .getString(R.string.toast_tripplanner_current_location_error), Toast.LENGTH_LONG) .show(); } else { if (mMap.getCameraPosition().zoom < OTPApp.defaultMyLocationZoomLevel) { mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(mCurrentLatLng, OTPApp.defaultMyLocationZoomLevel)); } else { mMap.animateCamera(CameraUpdateFactory.newLatLng(getLastLocation())); } } } }; mBtnMyLocation.setOnClickListener(oclMyLocation); OnClickListener oclDateDialog = new OnClickListener() { @Override public void onClick(View arg0) { FragmentTransaction ft = MainFragment.this.getActivity().getSupportFragmentManager() .beginTransaction(); Fragment prev = MainFragment.this.getActivity().getSupportFragmentManager() .findFragmentByTag(OTPApp.TAG_FRAGMENT_DATE_TIME_DIALOG); if (prev != null) { ft.remove(prev); } ft.addToBackStack(null); // Create and show the dialog. DateTimeDialog newFragment = new DateTimeDialog(); Date dateDialogDate; if (mTripDate == null) { dateDialogDate = Calendar.getInstance().getTime(); } else { dateDialogDate = mTripDate; } Bundle bundle = new Bundle(); bundle.putSerializable(OTPApp.BUNDLE_KEY_TRIP_DATE, dateDialogDate); bundle.putBoolean(OTPApp.BUNDLE_KEY_ARRIVE_BY, mArriveBy); newFragment.setArguments(bundle); ft.commit(); newFragment.show(MainFragment.this.getActivity().getSupportFragmentManager(), OTPApp.TAG_FRAGMENT_DATE_TIME_DIALOG); } }; mBtnDateDialog.setOnClickListener(oclDateDialog); AdapterView.OnItemSelectedListener itinerarySpinnerListener = new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { mFragmentListener.onItinerarySelected(position); if (!mAppResumed) { showRouteOnMap(mFragmentListener.getCurrentItinerary(), true); } else { showRouteOnMap(mFragmentListener.getCurrentItinerary(), false); mAppResumed = false; } } @Override public void onNothingSelected(AdapterView<?> parent) { } }; int currentItineraryIndex = mFragmentListener.getCurrentItineraryIndex(); mItinerarySelectionSpinner.setSelection(currentItineraryIndex); mItinerarySelectionSpinner.setOnItemSelectedListener(itinerarySpinnerListener); mBikeTriangleParameters.setOnRangeSeekBarChangeListener(new OnRangeSeekBarChangeListener<Double>() { @Override public void onRangeSeekBarValuesChanged(RangeSeekBar<?> rangeSeekBar, Double minValue, Double maxValue) { // handle changed range values Log.i(OTPApp.TAG, "User selected new range values: MIN=" + minValue + ", MAX=" + maxValue); } }); mDdlTravelMode.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { TraverseModeSpinnerItem traverseModeSpinnerItem = (TraverseModeSpinnerItem) mDdlTravelMode .getItemAtPosition(position); if (traverseModeSpinnerItem != null) { if (traverseModeSpinnerItem.getTraverseModeSet().contains(TraverseMode.BICYCLE)) { setBikeOptimizationAdapter(true); showBikeParameters(true); } else { setBikeOptimizationAdapter(false); showBikeParameters(false); } mBtnPlanTrip.setImageBitmap(BitmapFactory.decodeResource(getResources(), DirectionsGenerator.getModeIcon(traverseModeSpinnerItem.getTraverseModeSet()))); } Log.e(OTPApp.TAG, "Not possible to change travel mode because traverse mode is unknown" + "for selected transport medium"); } }); mDdlOptimization.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { OptimizeSpinnerItem optimizeSpinnerItem = (OptimizeSpinnerItem) mDdlOptimization .getItemAtPosition(position); if (optimizeSpinnerItem != null) { showBikeParameters(optimizeSpinnerItem.getOptimizeType().equals(OptimizeType.TRIANGLE)); } else { Log.e(OTPApp.TAG, "Not possible to change optimization mode because selected" + "optimization is unknown"); } } }); mBikeTriangleParameters.setOnRangeSeekBarChangeListener(this); }
From source file:dong.lan.tuyi.activity.MainActivity.java
@Override public void onClick(View v) { switch (v.getId()) { case R.id.toolbar_community: startActivity(new Intent(MainActivity.this, TuyiHomeActivity.class)); overridePendingTransition(R.anim.slide_in_from_left, R.anim.slide_out_to_right); break;//w ww . j a va 2 s . c om case R.id.toolbar_tuyi: startActivity(new Intent(MainActivity.this, TuMapActivity.class)); overridePendingTransition(R.anim.slide_in_from_left, R.anim.slide_out_to_right); break; case R.id.my_Favorite: startActivity(new Intent(MainActivity.this, FavoriteActivity.class)); overridePendingTransition(R.anim.slide_in_from_left, R.anim.slide_out_to_right); break; case R.id.user_des: isGetWeather = true; break; case R.id.offline_tuyi: startActivityForResult(new Intent(MainActivity.this, OfflineTuyiActivity.class), 100); overridePendingTransition(R.anim.slide_in_from_left, R.anim.slide_out_to_right); break; case R.id.user_community: Lock.canPop = false; startActivityForResult(new Intent(MainActivity.this, TuyiCommunityActivity.class), 100); overridePendingTransition(R.anim.slide_in_from_left, R.anim.slide_out_to_right); break; case R.id.user_head: if (Config.tUser == null) { Show("????"); return; } Lock.canPop = false; final Dialog dialog = new AlertDialog.Builder(MainActivity.this).create(); dialog.setCancelable(true); dialog.show(); dialog.getWindow().setContentView(R.layout.dialog_set_head_img); TextView msg = (TextView) dialog.findViewById(R.id.dialog_msg); msg.setText("?"); TextView dialog_left = (TextView) dialog.findViewById(R.id.dialog_left); TextView dialog_right = (TextView) dialog.findViewById(R.id.dialog_right); dialog_left.setText(""); dialog_right.setText(""); dialog_left.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); File dir = new File(Constant.PICTURE_PATH); if (!dir.exists()) { dir.mkdirs(); } // File file = new File(dir, username + "_head_" + new SimpleDateFormat(TimeUtil.FORMAT_NORMAL).format(new Date())); filePath = file.getAbsolutePath();// ?? Uri imageUri = Uri.fromFile(file); Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri); startActivityForResult(intent, Constant.REQUESTCODE_UPLOADAVATAR_CAMERA); } }); dialog_right.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); Intent intent = new Intent(Intent.ACTION_PICK, null); intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*"); startActivityForResult(intent, Constant.REQUESTCODE_UPLOADAVATAR_LOCATION); } }); break; case R.id.user_center: if (Config.tUser != null) { Lock.canPop = false; startActivityForResult( new Intent(MainActivity.this, UserCenter.class).putExtra("USER", Config.tUser), 100); overridePendingTransition(R.anim.slide_in_from_left, R.anim.slide_out_to_right); } break; case R.id.user_albums: startActivityForResult(new Intent(MainActivity.this, TuyiPlayActivity.class), 100); overridePendingTransition(R.anim.slide_in_from_left, R.anim.slide_out_to_right); break; case R.id.user_setting: startActivityForResult(new Intent(MainActivity.this, MyRadarActivity.class), 100); break; case R.id.my_interested: startActivityForResult(new Intent(MainActivity.this, MyInterestedActivity.class), 100); overridePendingTransition(R.anim.slide_in_from_left, R.anim.slide_out_to_right); break; } }
From source file:com.cpic.taylor.logistics.activity.HomeActivity.java
/** * ?/*w ww . j a v a 2s . co m*/ */ private void getFromPhoto(int type2) { intent = new Intent(Intent.ACTION_PICK); intent.setType("image/*"); intent.putExtra("return-data", true); startActivityForResult(intent, type2); }
From source file:info.guardianproject.otr.app.im.app.NewChatActivity.java
private void startContactPicker() { Uri.Builder builder = Imps.Contacts.CONTENT_URI_CONTACTS_BY.buildUpon(); Uri data = builder.build();//from w w w . java 2 s .c o m Intent i = new Intent(Intent.ACTION_PICK, data); i.putExtra("invitations", false); startActivityForResult(i, REQUEST_PICK_CONTACTS); }
From source file:com.tweetlanes.android.view.BaseLaneActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: if (composeReleaseFocus(false) == true) { return true; }/*from w w w .j a v a 2s .com*/ break; case R.id.action_gallery: { Intent intent = new Intent(Intent.ACTION_PICK); intent.setType("image/*"); startActivityForResult(intent, Constant.REQUEST_CODE_IMAGE_PICKER); //startActivityForResult(new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI), Constant.REQUEST_CODE_IMAGE_PICKER); return true; } case R.id.action_camera: { if (Util.isIntentAvailable(this, android.provider.MediaStore.ACTION_IMAGE_CAPTURE)) { Uri tmpUri = Uri.fromFile(getFixedTempFile(BaseLaneActivity.this)); Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, tmpUri); startActivityForResult(intent, Constant.REQUEST_CODE_CAMERA); } return true; } /* case R.id.action_locate: Toast.makeText(getApplicationContext(), getString(R.string.functionality_not_implemented), Constant.DEFAULT_TOAST_DISPLAY_TIME).show(); break; */ default: { BaseLaneFragment fragment = mLaneFragmentHashMap.get(getCurrentLaneIndex()); if (fragment != null) { return fragment.onOptionsItemSelected(item); } } } return false; }
From source file:com.ccxt.whl.activity.SettingsFragment.java
/** * ?/* w ww. j a va2s. c om*/ */ public void selectPicFromLocal() { Intent intent; if (Build.VERSION.SDK_INT < 19) { intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("image/*"); //Intent intent = new Intent(Intent.ACTION_GET_CONTENT, null); /*intent.setType("image/*"); intent.putExtra("crop", "true"); intent.putExtra("aspectX", 1); intent.putExtra("aspectY", 1); intent.putExtra("outputX", 600); intent.putExtra("outputY", 600); intent.putExtra("scale", true); intent.putExtra("return-data", false); intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUritest); intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString()); intent.putExtra("noFaceDetection", true); // no face detection */ //startActivityForResult(intent, CHOOSE_BIG_PICTURE); } else { intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); //startActivityForResult(intent, USERPIC_REQUEST_CODE_LOCAL_19); } startActivityForResult(intent, USERPIC_REQUEST_CODE_LOCAL); }
From source file:com.hdu.tx.aschool.ui.activity.ChatActivity.java
/** * //from www .j a v a2s.com */ private void selectFileFromLocal() { Intent intent = null; if (Build.VERSION.SDK_INT < 19) { intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("*/*"); intent.addCategory(Intent.CATEGORY_OPENABLE); } else { intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI); } startActivityForResult(intent, REQUEST_CODE_SELECT_FILE); }
From source file:info.guardianproject.otr.app.im.app.NewChatActivity.java
void startImagePicker() { Intent intent = new Intent(Intent.ACTION_PICK); intent.setType("image/*"); startActivityForResult(intent, REQUEST_SEND_IMAGE); }