// ////////////////////////////////////////////////////////////////////// // ACTIONS // ////////////////////////////////////////////////////////////////////// @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case PublicIntent.REQUESTCODE_FILEPICKER: if (data != null && IntentIntegrator.ACTION_PICK_FILE.equals(data.getAction())) { ActionManager.actionPickFile( getFragmentManager().findFragmentByTag(TAG), IntentIntegrator.REQUESTCODE_FILEPICKER); } else if (data != null && data.getData() != null) { String tmpPath = ActionManager.getPath(getActivity(), data.getData()); if (tmpPath != null) { tmpFile = new File(tmpPath); } else { // Error case : Unable to find the file path associated // to user pick. // Sample : Picasa image case ActionManager.actionDisplayError( this, new AlfrescoAppException(getString(R.string.error_unknown_filepath), true)); } } else if (data != null && data.getExtras() != null && data.getExtras().containsKey(Intent.EXTRA_STREAM)) { List<File> files = new ArrayList<File>(); List<Uri> uris = data.getExtras().getParcelableArrayList(Intent.EXTRA_STREAM); for (Uri uri : uris) { files.add(new File(ActionManager.getPath(getActivity(), uri))); } createFiles(files); } break; default: break; } }
@Override public void onReceive(Context context, Intent intent) { LogHandler.configureLogger(); try { String log = "onReceive: Action: "; log += intent.getAction(); log += "( "; if (intent.getData() != null) { log += intent.getData().getScheme(); log += "://"; log += intent.getData().getHost(); } log += " ) "; Bundle extras = intent.getExtras(); log += "{ "; if (extras != null) { for (String extra : extras.keySet()) { log += extra + "[" + extras.get(extra) + "], "; } } log += " }"; Log.d(this, log); } catch (Exception e) { Log.e(e); } try { if (ExternalAppConstants.SLEEP_AS_ANDROID_ALARM_EVENT .ALARM_TRIGGERED .getIntentAction() .equals(intent.getAction())) { Log.d("IntentReceiver", "Alarm triggered!"); ActionHandler.execute( context, ExternalAppConstants.SLEEP_AS_ANDROID_ALARM_EVENT.ALARM_TRIGGERED); } else if (ExternalAppConstants.SLEEP_AS_ANDROID_ALARM_EVENT .ALARM_SNOOZED .getIntentAction() .equals(intent.getAction())) { Log.d("IntentReceiver", "Alarm snoozed..."); ActionHandler.execute( context, ExternalAppConstants.SLEEP_AS_ANDROID_ALARM_EVENT.ALARM_SNOOZED); } else if (ExternalAppConstants.SLEEP_AS_ANDROID_ALARM_EVENT .ALARM_DISMISSED .getIntentAction() .equals(intent.getAction())) { Log.d("IntentReceiver", "Alarm dismissed..."); ActionHandler.execute( context, ExternalAppConstants.SLEEP_AS_ANDROID_ALARM_EVENT.ALARM_DISMISSED); } else { Log.d("IntentReceiver", "Received unknown intent: " + intent.getAction()); } } catch (Exception e) { Log.e(e); } }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { Log.d(cTag, "Got resultCode " + resultCode + " with data " + data); switch (requestCode) { case cNewContextCode: if (resultCode == Activity.RESULT_OK) { if (data != null) { long newContextId = ContentUris.parseId(data.getData()); setupContextSpinner(); setSpinnerSelection(mContextSpinner, mContextIds, newContextId); } } break; case cNewProjectCode: if (resultCode == Activity.RESULT_OK) { if (data != null) { long newProjectId = ContentUris.parseId(data.getData()); setupProjectSpinner(); setSpinnerSelection(mProjectSpinner, mProjectIds, newProjectId); } } break; default: Log.e(cTag, "Unknown requestCode: " + requestCode); } }
public LevelImportMode(ModeController modeController, GameResources gameResources, Intent intent) throws IOException { super(modeController, gameResources); camera.center.set(0, 0, 0); camera.eye.set(0, 15, -15f); if ("content".equals(intent.getScheme())) { InputStream attachment = context.getContentResolver().openInputStream(intent.getData()); level = Level.loadFromFile(attachment, gameResources); attachment.close(); } else { File importFile = new File(intent.getDataString()); levelFileName = importFile.getName(); if (!levelFileName.endsWith(".bclevel")) levelFileName = ".bclevel"; InputStream attachment = context.getContentResolver().openInputStream(intent.getData()); level = Level.loadFromFile(attachment, gameResources); attachment.close(); } if (level != null) { state = new GameState(level); } }
protected void parseLaunchIntentLocation() { Intent intent = getIntent(); if (intent != null && intent.getData() != null) { Uri data = intent.getData(); if ("http".equalsIgnoreCase(data.getScheme()) && "download.osmand.net".equals(data.getHost()) && "/go".equals(data.getPath())) { String lat = data.getQueryParameter("lat"); String lon = data.getQueryParameter("lon"); if (lat != null && lon != null) { try { double lt = Double.parseDouble(lat); double ln = Double.parseDouble(lon); String zoom = data.getQueryParameter("z"); int z = settings.getLastKnownMapZoom(); if (zoom != null) { z = Integer.parseInt(zoom); } settings.setMapLocationToShow(lt, ln, z, getString(R.string.shared_location)); } catch (NumberFormatException e) { } } } } }
protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == PICK_IMAGE_REQUEST && resultCode == RESULT_OK && data != null && data.getData() != null) { Uri filePath = data.getData(); try { // Getting the Bitmap from Gallery bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), filePath); // String image = getStringImage(bitmap); Bitmap img_oval = getCroppedBitmap(bitmap); /** ******************** Imagen Final ******************* */ // Setting the Bitmap to ImageView imageView.setImageBitmap(img_oval); } catch (IOException e) { e.printStackTrace(); } } else { Toast.makeText(this, "Tamaño maximo superado", Toast.LENGTH_LONG).show(); } }
/// M: Code analyze 013, fix bug, fix exception when press email add @{ @Override public void startActivityForResult(Intent intent, int requestCode) { // requestCode >= 0 means the activity in question is a sub-activity. if (null != intent && null != intent.getData() && intent.getData().getScheme().equals("mailto")) { try { super.startActivityForResult(intent, requestCode); } catch (ActivityNotFoundException e) { MmsLog.w(TAG, "Failed to startActivityForResult: " + intent); Intent i = new Intent() .setClassName( "com.android.email", "com.android.email.activity.setup.AccountSetupBasics"); this.startActivity(i); finish(); } catch (Exception e) { MmsLog.e(TAG, "Failed to startActivityForResult: " + intent); Toast.makeText(this, getString(R.string.message_open_email_fail), Toast.LENGTH_SHORT) .show(); } } else { super.startActivityForResult(intent, requestCode); } }
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { this.getActivity(); if (requestCode == CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE) { // À´×ÔͼƬ¿â if (resultCode == FragmentActivity.RESULT_OK) { uri = data.getData(); if (uri != null) { ContentResolver cr = this.getActivity().getContentResolver(); try { Bitmap bitmap = BitmapFactory.decodeStream(cr.openInputStream(uri)); // ½«BitmapÉ趨µ½ImageView ivImage.setImageBitmap(bitmap); } catch (FileNotFoundException e) { Log.e("Exception", e.getMessage(), e); } } } } else if (requestCode == CAPTURE_CAMERA_ACTIVITY_REQUEST_CODE) { // À´×ÔÕÕÏà»ú if (resultCode == FragmentActivity.RESULT_OK) { if (data != null) { uri = data.getData(); if (data.hasExtra("data")) { Bitmap bitmap = data.getParcelableExtra("data"); // ½«BitmapÉ趨µ½ImageView ivImage.setImageBitmap(bitmap); } } } } super.onActivityResult(requestCode, resultCode, data); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent; RongContext.getInstance().getEventBus().register(this); if (getActivity() != null) { intent = getActivity().getIntent(); if (intent.getData() != null) { mConversationType = Conversation.ConversationType.valueOf( intent.getData().getLastPathSegment().toUpperCase()); mTargetId = intent.getData().getQueryParameter("targetId"); } } mAdapter = new RongConversationAddMemberAdapter(getActivity()); mAdapter.setDeleteIconListener(this); if (RongIM.getInstance() != null && RongIM.getInstance().getRongIMClient() != null) { initData(); } }
protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == IMAGE_PICK && resultCode == RESULT_OK) { if (data != null && data.getData() != null) { Uri uri = data.getData(); addTemporaryWallpaperTile(uri, false); } } else if (requestCode == PICK_WALLPAPER_THIRD_PARTY_ACTIVITY) { setResult(RESULT_OK); finish(); } else if (requestCode == PICK_LIVE_WALLPAPER) { WallpaperManager wm = WallpaperManager.getInstance(this); final WallpaperInfo oldLiveWallpaper = mLiveWallpaperInfoOnPickerLaunch; final WallpaperInfo clickedWallpaper = mLastClickedLiveWallpaperInfo; WallpaperInfo newLiveWallpaper = wm.getWallpaperInfo(); // Try to figure out if a live wallpaper was set; if (newLiveWallpaper != null && (oldLiveWallpaper == null || !oldLiveWallpaper.getComponent().equals(newLiveWallpaper.getComponent()) || clickedWallpaper.getComponent().equals(oldLiveWallpaper.getComponent()))) { // Return if a live wallpaper was set setResult(RESULT_OK); finish(); } } }
@Override public void onActivityResult(int reqCode, int resultCode, Intent data) { Log.w(TAG, "onActivityResult called: " + reqCode + ", " + resultCode + " , " + data); super.onActivityResult(reqCode, resultCode, data); if (data == null || resultCode != RESULT_OK) return; switch (reqCode) { case PICK_IMAGE: addAttachmentImage(data.getData()); break; case PICK_VIDEO: addAttachmentVideo(data.getData()); break; case PICK_AUDIO: addAttachmentAudio(data.getData()); break; case PICK_CONTACT_INFO: addContactInfo(data.getData()); break; case GROUP_EDIT: this.recipients = data.getParcelableExtra(GroupCreateActivity.GROUP_RECIPIENT_EXTRA); initializeTitleBar(); break; } }
public Data(Context context, Intent intent) { this.context = context; this.intent = intent; action = intent.getAction(); path = intent.getData() != null ? intent.getData().getPath() : null; sdcard = Storage.getSdCardByFilePath(path); }
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == ADD_PHOTO && resultCode == Activity.RESULT_OK) { if (data != null && data.getExtras() != null && data.getExtras().get("data") != null) { Bitmap bm = (Bitmap) data.getExtras().get("data"); showPopupMenuAskingImageSize(null, bm); } else if (data != null && data.getData() != null) { String filePath = getRealPathFromURI(data.getData()); showPopupMenuAskingImageSize(filePath, null); } else if (imageToUploadUri != null) { String filePath = imageToUploadUri.getPath(); showPopupMenuAskingImageSize(filePath, null); } else { File file = new File( Environment.getExternalStorageDirectory(), getString(R.string.temp_photo_name)); if (file.exists()) { imageToUploadUri = Uri.fromFile(file); String filePath = imageToUploadUri.getPath(); showPopupMenuAskingImageSize(filePath, null); } } } else { super.onActivityResult(requestCode, resultCode, data); } }
/** 监听相机返回的事件 */ @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == photoFlag && resultCode == RESULT_OK) { Log.d("takephoto", uri); addUri(uri); adapter = new GridAdapter(ShareThought.this, getUri(), imageWidth, imageHeight); gridView.setAdapter(adapter); } else if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK && data != null) { Log.e("本地图库", resultCode + ""); String picturePath = ""; // 对于4.4及以上系统 if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) { Uri selectedImage = data.getData(); picturePath = PictureHelper.getPath(this, selectedImage); // 获取图片的绝对路径 // 小于4.4的系统 } else { Uri selectedImage = data.getData(); String[] filePathColumn = {MediaStore.Images.Media.DATA}; Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); picturePath = cursor.getString(columnIndex); cursor.close(); } addUri(picturePath); Log.e("图片路径", picturePath); adapter = new GridAdapter(ShareThought.this, getUri(), imageWidth, imageHeight); gridView.setAdapter(adapter); } }
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode != RESULT_OK || (data == null) || (data.getData() == null)) { return; } mFile = data.getData(); TextView uriEdit = (TextView) findViewById(R.id.uri); TextView sizeEdit = (TextView) findViewById(R.id.size); switch (requestCode) { case SELECT_IMAGE: case SELECT_TEXT_FILE: if (LogUtils.isActive) { Log.d(LOGTAG, "Selected file uri:" + mFile); } /* * Display file info and the selected filename attribute. */ mFilename = FileUtils.getFileName(this, mFile); mFilesize = FileUtils.getFileSize(this, mFile) / 1024; sizeEdit.setText(mFilesize + " KB"); uriEdit.setText(mFilename); if (LogUtils.isActive) { Log.i(LOGTAG, "Select file " + mFilename + " of size " + mFilesize + " file=" + mFile); } mInviteBtn.setEnabled(true); break; } }
/** * Returns a note id from an intent if it contains one, either as part of its URI or as an extra * * <p>Returns -1 if no id was contained, this includes insert actions */ long getNoteId(final Intent intent) { long retval = -1; if (intent != null && intent.getData() != null && (Intent.ACTION_EDIT.equals(intent.getAction()) || Intent.ACTION_VIEW.equals(intent.getAction()))) { if (intent.getData().getPath().startsWith(TaskList.URI.getPath())) { // Find it in the extras. See DashClock extension for an example retval = intent.getLongExtra(Task.TABLE_NAME, -1); } else if ((intent .getData() .getPath() .startsWith(LegacyDBHelper.NotePad.Notes.PATH_VISIBLE_NOTES) || intent.getData().getPath().startsWith(LegacyDBHelper.NotePad.Notes.PATH_NOTES) || intent.getData().getPath().startsWith(Task.URI.getPath()))) { retval = Long.parseLong(intent.getData().getLastPathSegment()); } // else if (null != intent // .getStringExtra(TaskDetailFragment.ARG_ITEM_ID)) { // retval = Long.parseLong(intent // .getStringExtra(TaskDetailFragment.ARG_ITEM_ID)); // } } return retval; }
/** * Returns a list id from an intent if it contains one, either as part of its URI or as an extra * * <p>Returns -1 if no id was contained, this includes insert actions */ long getListId(final Intent intent) { long retval = -1; if (intent != null && intent.getData() != null && (Intent.ACTION_EDIT.equals(intent.getAction()) || Intent.ACTION_VIEW.equals(intent.getAction()) || Intent.ACTION_INSERT.equals(intent.getAction()))) { if ((intent.getData().getPath().startsWith(NotePad.Lists.PATH_VISIBLE_LISTS) || intent.getData().getPath().startsWith(NotePad.Lists.PATH_LISTS) || intent.getData().getPath().startsWith(TaskList.URI.getPath()))) { try { retval = Long.parseLong(intent.getData().getLastPathSegment()); } catch (NumberFormatException e) { retval = -1; } } else if (-1 != intent.getLongExtra(LegacyDBHelper.NotePad.Notes.COLUMN_NAME_LIST, -1)) { retval = intent.getLongExtra(LegacyDBHelper.NotePad.Notes.COLUMN_NAME_LIST, -1); } else if (-1 != intent.getLongExtra(TaskDetailFragment.ARG_ITEM_LIST_ID, -1)) { retval = intent.getLongExtra(TaskDetailFragment.ARG_ITEM_LIST_ID, -1); } else if (-1 != intent.getLongExtra(Task.Columns.DBLIST, -1)) { retval = intent.getLongExtra(Task.Columns.DBLIST, -1); } } return retval; }
@Override public void onReceive(Context context, Intent intent) { // 监听添加和删除事件 if (PluginManager.ACTION_PACKAGE_ADDED.equals(intent.getAction())) { try { PackageManager pm = getActivity().getPackageManager(); String pkg = intent.getData().getAuthority(); PackageInfo info = PluginManager.getInstance().getPackageInfo(pkg, 0); mApkListAdapter.addApkItem(new ApkItem(pm, info, info.applicationInfo.publicSourceDir)); } catch (Exception e) { e.printStackTrace(); } } else if (PluginManager.ACTION_PACKAGE_REMOVED.equals(intent.getAction())) { String pkg = intent.getData().getAuthority(); int num = mApkListAdapter.getCount(); ApkItem removedItem = null; for (int i = 0; i < num; i++) { ApkItem item = mApkListAdapter.getApkItem(i); if (TextUtils.equals(item.packageInfo.packageName, pkg)) { removedItem = item; break; } } if (removedItem != null) { mApkListAdapter.removeApkItem(removedItem); } } }
public void onActivityResult(int requestCode, int resultCode, Intent resultData) { Uri currentUri = null; if (resultCode == Activity.RESULT_OK) { if (requestCode == CREATE_REQUEST_CODE) { if (resultData != null) { textView.setText(""); } } else if (requestCode == SAVE_REQUEST_CODE) { if (resultData != null) { currentUri = resultData.getData(); writeFileContent(currentUri); } } else if (requestCode == OPEN_REQUEST_CODE) { if (resultData != null) { currentUri = resultData.getData(); try { String content = readFileContent(currentUri); textView.setText(content); } catch (IOException e) { // 에러가 있을 때 처리하는 코드 } } } } }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == PICK_IMAGE_CAMERY_REQUEST && resultCode == RESULT_OK) { File imgFile = new File(pictureImagePath); if (imgFile.exists()) { // Bitmap myBitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath()); File imageFile = new File(pictureImagePath); // TODO beginCrop(Uri.fromFile(imageFile)); } } if (requestCode == PICK_IMAGE_GALLERY_REQUEST && resultCode == RESULT_OK && data != null && data.getData() != null) { Uri uri = data.getData(); // Bitmap bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), // uri); beginCrop(uri); // TODO } if (requestCode == Crop.REQUEST_CROP) { handleCrop(resultCode, data); } }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { // TODO Auto-generated method stub switch (requestCode) { case CSV_RESULT: if (resultCode == RESULT_OK) { String FilePath = data.getData().getPath(); String FileName = data.getData().getLastPathSegment(); // int lastPos = FilePath.length() - FileName.length(); // String Folder = FilePath.substring(0, lastPos); okbt.setEnabled(true); filename.setText("File Name: \n" + FileName + "\n"); obj = new ReadCVS(); obj.run(FilePath, getBaseContext()); // filename.setText(obj..toString()); Toast.makeText(this, FilePath, Toast.LENGTH_SHORT).show(); FName = obj.retFName(); FSN = obj.retSN(); FID = obj.retFID(); // Toast.makeText(this,FName.get(1),Toast.LENGTH_SHORT ).show();//test } } }
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == PICK_DROPBOX_DIR_CODE) { if (resultCode == Activity.RESULT_OK) { PreferenceManager.getDefaultSharedPreferences(getActivity()) .edit() .putString(KEY_DROPBOX_DIR, data.getData().getPath()) .commit(); } // else was cancelled } else if (requestCode == PICK_SD_DIR_CODE) { if (resultCode == Activity.RESULT_OK) { // Set it File path = new File(data.getData().getPath()); if (path.exists() && path.isDirectory() && path.canWrite()) { PreferenceManager.getDefaultSharedPreferences(getActivity()) .edit() .putString(KEY_SD_DIR, path.toString()) .commit(); } else { Toast.makeText(getActivity(), R.string.cannot_write_to_directory, Toast.LENGTH_SHORT) .show(); } } // else was cancelled } else { super.onActivityResult(requestCode, resultCode, data); } }
@Override public void onActivityResult(int requestCode, int resultCode, Intent intent) { if (requestCode == REQUEST_FILE_PICKER) { if (mFilePathCallback4 != null) { Uri result = intent == null || resultCode != Activity.RESULT_OK ? null : intent.getData(); if (result != null) { String path = MediaUtility.getPath(getActivity(), result); Uri uri = Uri.fromFile(new File(path)); mFilePathCallback4.onReceiveValue(uri); } else { mFilePathCallback4.onReceiveValue(null); } } if (mFilePathCallback5 != null) { Uri result = intent == null || resultCode != Activity.RESULT_OK ? null : intent.getData(); if (result != null) { String path = MediaUtility.getPath(getActivity(), result); Uri uri = Uri.fromFile(new File(path)); mFilePathCallback5.onReceiveValue(new Uri[] {uri}); } else { mFilePathCallback5.onReceiveValue(null); } } mFilePathCallback4 = null; mFilePathCallback5 = null; } }
Task getTask() { if (_task == null && _intent.getData() != null) { int taskId = Task.getIdFromUri(_intent.getData()); if (_provider != null) setTask(_provider.get(taskId)); } return _task; }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == 1) { if (resultCode == RESULT_OK) { this.currentCoordinates[0] = data.getIntExtra("lag", Integer.MAX_VALUE); this.currentCoordinates[1] = data.getIntExtra("lon", Integer.MAX_VALUE); } if (resultCode == RESULT_CANCELED) { return; } } else if (requestCode == VideoUtility.CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE) { if (resultCode == RESULT_OK) { // Image captured and saved to fileUri specified in the Intent Toast.makeText(this, "Image saved to:\n" + data.getData(), Toast.LENGTH_LONG).show(); } else if (resultCode == RESULT_CANCELED) { // User cancelled the image capture } else { // Image capture failed, advise user } } else if (requestCode == VideoUtility.CAPTURE_VIDEO_ACTIVITY_REQUEST_CODE) { if (resultCode == RESULT_OK) { // Video captured and saved to fileUri specified in the Intent Toast.makeText(this, "Video saved to:\n" + data.getData(), Toast.LENGTH_LONG).show(); this.videoLoc = VideoUtility.getRealPathFromURI(data.getData(), SavePlace.this); } else if (resultCode == RESULT_CANCELED) { // User cancelled the video capture } else { // Video capture failed, advise user } } }
/** * 消息分发,选择跳转到哪个fragment * * @param intent */ private void enterFragment(Intent intent) { String tag = null; if (intent != null) { Fragment fragment = null; if (intent.getExtras() != null && intent.getExtras().containsKey(RongConst.EXTRA.CONTENT)) { String fragmentName = intent.getExtras().getString(RongConst.EXTRA.CONTENT); fragment = Fragment.instantiate(this, fragmentName); } else if (intent.getData() != null) { if (intent.getData().getPathSegments().get(0).equals("conversation")) { tag = "conversation"; String fragmentName = ConversationFragment.class.getCanonicalName(); fragment = Fragment.instantiate(this, fragmentName); } else if (intent.getData().getLastPathSegment().equals("conversationlist")) { tag = "conversationlist"; String fragmentName = ConversationListFragment.class.getCanonicalName(); fragment = Fragment.instantiate(this, fragmentName); } else if (intent.getData().getLastPathSegment().equals("subconversationlist")) { tag = "subconversationlist"; String fragmentName = SubConversationListFragment.class.getCanonicalName(); fragment = Fragment.instantiate(this, fragmentName); SubConversationListFragment sub = (SubConversationListFragment) fragment; sub.setAdapter(new SubConversationListAdapterEx(RongContext.getInstance())); } else if (intent.getData().getPathSegments().get(0).equals("friend")) { tag = "friend"; String fragmentName = FriendMultiChoiceFragment.class.getCanonicalName(); fragment = Fragment.instantiate(this, fragmentName); ActionBar actionBar = getSupportActionBar(); actionBar.hide(); // 隐藏ActionBar } targetId = intent.getData().getQueryParameter("targetId"); targetIds = intent.getData().getQueryParameter("targetIds"); mDiscussionId = intent.getData().getQueryParameter("discussionId"); if (targetId != null) { mConversationType = Conversation.ConversationType.valueOf( intent.getData().getLastPathSegment().toUpperCase(Locale.getDefault())); } else if (targetIds != null) { mConversationType = Conversation.ConversationType.valueOf( intent.getData().getLastPathSegment().toUpperCase(Locale.getDefault())); } } if ("tag".equals(tag)) { showRealTimeLocationBar(null); // RealTimeLocation } if (fragment != null) { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.add(R.id.de_content, fragment, tag); transaction.addToBackStack(null).commitAllowingStateLoss(); } } }
@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode != RESULT_OK) { // 正しい結果が得られなかった場合の処理 return; } if (requestCode == REQUEST_CODE_PICK_IMAGE) { // 画像を共有へ imageShare(data.getData()); } else if (requestCode == REQUEST_CODE_PICK_IMAGE_TO_MAIL) { // メール添付送信へ sendMail(data.getData()); } else if (requestCode == REQUEST_CODE_RECOGNIZE) { StringBuffer sb = new StringBuffer(); // 認識結果のリストを取得 // 似ている言葉など、複数の結果がある場合もある。 List<String> results = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); for (String result : results) { sb.append(result); sb.append("\n"); } // AlertDialogに表示 new AlertDialog.Builder(this).setMessage(sb).show(); } }
@Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); // callbackManager.onActivityResult(requestCode, resultCode, data); // Toast.makeText(getApplicationContext(),data.toString(),Toast.LENGTH_LONG).show(); int a = 0; if (requestCode == INTENT_ACTION_PICTURE && resultCode == Activity.RESULT_OK && null != data) { Cursor c = getContentResolver().query(data.getData(), null, null, null, null); c.moveToNext(); Uri uri = data.getData(); String path = c.getString(c.getColumnIndex(MediaStore.MediaColumns.DATA)); c.close(); System.out.println("onActivityResult == " + path); // Toast.makeText(getApplicationContext(), path, 1).show(); // photobean.setPicturepath(path); Log.v("sssssssssssss", path); avatar.setImageURI(uri); file = new File(path); try { requstlogin.put("avatar", file); PreferenceUtils.setPrefString(getApplicationContext(), "avatar", path); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
@Override protected void onActivityResult(int requestCode, int resultCode, final Intent data) { if (resultCode == RESULT_OK) { if (requestCode == REQUEST_GALLERY) { if (data.getData() != null) { execute(messenger().sendUri(peer, data.getData()), R.string.pick_downloading); } } else if (requestCode == REQUEST_PHOTO) { messenger().sendPhoto(peer, pending_fileName); } else if (requestCode == REQUEST_VIDEO) { messenger().sendVideo(peer, pending_fileName); } else if (requestCode == REQUEST_DOC) { if (data.getData() != null) { execute(messenger().sendUri(peer, data.getData()), R.string.pick_downloading); } else if (data.hasExtra("picked")) { ArrayList<String> files = data.getStringArrayListExtra("picked"); if (files != null) { for (String s : files) { messenger().sendDocument(peer, s); } } } } } }
public static boolean checkForKeyImport(Intent intent, Activity activity) { boolean doKeyStoreImport = false; // if otr_keystore.ofcaes is in the SDCard root, import it File otrKeystoreAES = new File(Environment.getExternalStorageDirectory(), "otr_keystore.ofcaes"); if (otrKeystoreAES.exists()) { // Log.i(TAG, "found " + otrKeystoreAES + "to import"); doKeyStoreImport = true; importOtrKeyStore(otrKeystoreAES, activity); } else if (intent.getData() != null) { Uri uriData = intent.getData(); String path = null; if (uriData.getScheme() != null && uriData.getScheme().equals("file")) { path = uriData.toString().replace("file://", ""); File file = new File(path); doKeyStoreImport = true; importOtrKeyStore(file, activity); } } else { Toast.makeText(activity, R.string.otr_keysync_warning_message, Toast.LENGTH_LONG).show(); } return doKeyStoreImport; }