Example usage for android.content Intent getExtras

List of usage examples for android.content Intent getExtras

Introduction

In this page you can find the example usage for android.content Intent getExtras.

Prototype

public @Nullable Bundle getExtras() 

Source Link

Document

Retrieves a map of extended data from the intent.

Usage

From source file:com.ieeton.user.activity.ChatActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_chat);
    Intent intent = getIntent();
    if (intent == null) {
        return;// w w w .  ja v  a2s  .  c  om
    }
    mUser = (IeetonUser) intent.getExtras().getSerializable(Constants.EXTRA_USER);
    toChatUsername = intent.getStringExtra(Constants.EXTRA_UID);

    initView();
    setUpView();
}

From source file:com.ieeton.user.activity.ChatActivity.java

@Override
protected void onResume() {
    super.onResume();
    adapter.refresh();/*w  ww.ja v a  2  s .c  o  m*/
    if (isFirstIn) {
        isFirstIn = false;

        if (mUser == null) {
            try {
                FetchUserInfoTask task = new FetchUserInfoTask();
                task.execute();
            } catch (RejectedExecutionException e) {
                e.printStackTrace();
            }
        }

        Intent intent = getIntent();
        boolean auto_begin_conversation = intent.getExtras().getBoolean(EXTRA_AUTO_BEGIN_CONVERSATION);
        if (auto_begin_conversation && conversation.getMsgCount() <= 0) {
            //???
            boolean[] onoff = Utils.getMessageNotifySetting(ChatActivity.this);
            if (onoff[0]) {
                mSoundID = initSoundPool();
                mSoundPool.setOnLoadCompleteListener(new OnLoadCompleteListener() {
                    @Override
                    public void onLoadComplete(SoundPool soundPool, int sampleId, int status) {
                        playSound();
                    }
                });
            }
            if (onoff[1]) {
                mVibrator = (Vibrator) getApplicationContext().getSystemService(Context.VIBRATOR_SERVICE);
                playVibrator();
            }

            EMMessage message = EMMessage.createSendMessage(EMMessage.Type.TXT);
            String msgID = message.getMsgId();
            message.setMsgId("ieeton" + msgID);

            String content;
            if (toChatUsername.equals(NetEngine.getSecretaryID())) {
                content = getString(R.string.mishu_begin_conversation);
            } else {
                content = getString(R.string.doctor_begin_conversation);
            }
            TextMessageBody txtBody = new TextMessageBody(content);
            message.addBody(txtBody);

            message.setFrom(toChatUsername);
            message.setTo(IeetonApplication.getInstance().getUserName());
            message.direct = EMMessage.Direct.RECEIVE;

            conversation.addMessage(message);
            EMChatManager.getInstance().saveMessage(message);
            adapter.refresh();
        }
    }
}

From source file:com.logilite.vision.camera.CameraLauncher.java

/**
 * Applies all needed transformation to the image received from the camera.
 *
 * @param destType          In which form should we return the image
 * @param intent            An Intent, which can return result data to the caller (various data can be attached to Intent "extras").
 */// w  w  w . ja v a  2s  .co m
private void processResultFromCamera(int destType, Intent intent) throws IOException {
    int rotate = 0;

    // Create an ExifHelper to save the exif data that is lost during compression
    ExifHelper exif = new ExifHelper();
    try {
        if (this.encodingType == JPEG) {
            exif.createInFile(getTempDirectoryPath() + "/.Pic.jpg");
            exif.readExifData();
            rotate = exif.getOrientation();
        }
    } catch (IOException e) {
        e.printStackTrace();
    }

    Bitmap bitmap = null;
    Uri uri = null;

    // If sending base64 image back
    if (destType == DATA_URL) {
        bitmap = getScaledBitmap(FileHelper.stripFileProtocol(imageUri.toString()));
        if (bitmap == null) {
            // Try to get the bitmap from intent.
            bitmap = (Bitmap) intent.getExtras().get("data");
        }

        // Double-check the bitmap.
        if (bitmap == null) {
            Log.d(LOG_TAG, "I either have a null image path or bitmap");
            this.failPicture("Unable to create bitmap!");
            return;
        }

        if (rotate != 0 && this.correctOrientation) {
            bitmap = getRotatedBitmap(rotate, bitmap, exif);
        }

        this.processPicture(bitmap);
        checkForDuplicateImage(DATA_URL);
    }

    // If sending filename back
    else if (destType == FILE_URI || destType == NATIVE_URI) {
        if (this.saveToPhotoAlbum) {
            Uri inputUri = getUriFromMediaStore();
            //Just because we have a media URI doesn't mean we have a real file, we need to make it
            uri = Uri.fromFile(new File(FileHelper.getRealPath(inputUri, this.cordova)));
        } else {
            uri = Uri.fromFile(new File(getTempDirectoryPath(), System.currentTimeMillis() + ".jpg"));
        }

        if (uri == null) {
            this.failPicture("Error capturing image - no media storage found.");
        }

        // If all this is true we shouldn't compress the image.
        if (this.targetHeight == -1 && this.targetWidth == -1 && this.mQuality == 100
                && !this.correctOrientation) {
            writeUncompressedImage(uri);

            this.callbackContext.success(uri.toString());
        } else {
            bitmap = getScaledBitmap(FileHelper.stripFileProtocol(imageUri.toString()));

            if (rotate != 0 && this.correctOrientation) {
                bitmap = getRotatedBitmap(rotate, bitmap, exif);
            }

            // Add compressed version of captured image to returned media store Uri
            OutputStream os = this.cordova.getActivity().getContentResolver().openOutputStream(uri);
            bitmap.compress(Bitmap.CompressFormat.JPEG, this.mQuality, os);
            os.close();

            // Restore exif data to file
            if (this.encodingType == JPEG) {
                String exifPath;
                if (this.saveToPhotoAlbum) {
                    exifPath = FileHelper.getRealPath(uri, this.cordova);
                } else {
                    exifPath = uri.getPath();
                }
                exif.createOutFile(exifPath);
                exif.writeExifData();
            }

        }
        // Send Uri back to JavaScript for viewing image
        this.callbackContext.success(uri.toString());
    }

    this.cleanup(FILE_URI, this.imageUri, uri, bitmap);
    bitmap = null;
}

From source file:edu.mit.media.funf.configured.ConfiguredPipeline.java

@Override
protected void onHandleIntent(Intent intent) {
    String action = intent.getAction();
    if (ACTION_RELOAD.equals(action)) {
        reload();//from  w  w  w . java 2s.  co  m
    } else if (ACTION_UPDATE_CONFIG.equals(action)) {
        String config = intent.getStringExtra(CONFIG);
        String configUrl = intent.getStringExtra(CONFIG_URL);
        String configFilePath = intent.getStringExtra(CONFIG_FILE);
        if (config != null) {
            updateConfig(config);
        } else if (configFilePath != null) {
            File file = new File(configFilePath);
            updateConfig(file);
        } else if (configUrl != null) {
            try {
                updateConfig(new URL(configUrl));
            } catch (MalformedURLException e) {
                Log.e(TAG, "Unable to parse config url.");
            }
        } else {
            updateConfig();
        }
    } else if (ACTION_UPLOAD_DATA.equals(action)) {
        uploadData();
    } else if (ACTION_ARCHIVE_DATA.equals(action)) {
        archiveData();
    } else if (ACTION_ENABLE.equals(action)) {
        setEnabled(true);
    } else if (ACTION_DISABLE.equals(action)) {
        setEnabled(false);
    } else if (Probe.ACTION_DATA.equals(action)) {
        onDataReceived(intent.getExtras());
    } else if (Probe.ACTION_STATUS.equals(action)) {
        onStatusReceived(new Probe.Status(intent.getExtras()));
    } else if (Probe.ACTION_DETAILS.equals(action)) {
        onDetailsReceived(new Probe.Details(intent.getExtras()));
    }
}

From source file:com.soomla.store.billing.nokia.NokiaIabHelper.java

/**
 * Handles an activity result that's part of the purchase flow in in-app billing. If you
 * are calling {@link #launchPurchaseFlow}, then you must call this method from your
 * Activity's {@link android.app.Activity@onActivityResult} method. This method
 * MUST be called from the UI thread of the Activity.
 *
 * @param requestCode The requestCode as you received it.
 * @param resultCode The resultCode as you received it.
 * @param data The data (Intent) as you received it.
 * @return Returns true if the result was related to a purchase flow and was handled;
 *     false if the result was not related to a purchase, in which case you should
 *     handle it normally./*from w  w  w.jav a 2s.c  o m*/
 */
public boolean handleActivityResult(int requestCode, int resultCode, Intent data) {
    IabResult result;
    if (requestCode != RC_REQUEST)
        return false;

    checkSetupDoneAndThrow("handleActivityResult");

    if (data == null) {
        SoomlaUtils.LogError(TAG, "Null data in IAB activity result.");
        result = new IabResult(IabResult.IABHELPER_BAD_RESPONSE, "Null data in IAB result");
        purchaseFailed(result, null);
        return true;
    }

    int responseCode = getResponseCodeFromIntent(data);
    String purchaseData = data.getStringExtra(RESPONSE_INAPP_PURCHASE_DATA);
    //String dataSignature = data.getStringExtra(RESPONSE_INAPP_SIGNATURE);

    if (resultCode == Activity.RESULT_OK && responseCode == IabResult.BILLING_RESPONSE_RESULT_OK) {
        SoomlaUtils.LogDebug(TAG, "Successful resultcode from purchase activity.");
        SoomlaUtils.LogDebug(TAG, "IabPurchase data: " + purchaseData);
        SoomlaUtils.LogDebug(TAG, "Extras: " + data.getExtras());
        SoomlaUtils.LogDebug(TAG, "Expected item type: " + mPurchasingItemType);

        if (purchaseData == null) {
            SoomlaUtils.LogError(TAG, "BUG: purchaseData is null.");
            SoomlaUtils.LogDebug(TAG, "Extras: " + data.getExtras().toString());
            result = new IabResult(IabResult.IABHELPER_UNKNOWN_ERROR, "IAB returned null purchaseData");
            purchaseFailed(result, null);
            return true;
        }

        IabPurchase purchase = null;
        try {
            purchase = new IabPurchase(mPurchasingItemType, purchaseData, "");
            String sku = purchase.getSku();

            SharedPreferences prefs = SoomlaApp.getAppContext().getSharedPreferences(SoomlaConfig.PREFS_NAME,
                    Context.MODE_PRIVATE);
            String publicKey = prefs.getString(NokiaStoreIabService.PUBLICKEY_KEY, "");

            // Verify signature
            if (!Security.verifyPurchase(publicKey, purchaseData)) {
                SoomlaUtils.LogError(TAG, "IabPurchase signature verification FAILED for sku " + sku);
                result = new IabResult(IabResult.IABHELPER_VERIFICATION_FAILED,
                        "Signature verification failed for sku " + sku);
                purchaseFailed(result, purchase);
                return true;
            }
            SoomlaUtils.LogDebug(TAG, "IabPurchase signature successfully verified.");
        } catch (JSONException e) {
            SoomlaUtils.LogError(TAG, "Failed to parse purchase data.");
            e.printStackTrace();
            result = new IabResult(IabResult.IABHELPER_BAD_RESPONSE, "Failed to parse purchase data.");
            purchaseFailed(result, null);
            return true;
        }

        purchaseSucceeded(purchase);
    } else if (resultCode == Activity.RESULT_OK) {
        // result code was OK, but in-app billing response was not OK.
        SoomlaUtils.LogDebug(TAG, "Result code was OK but in-app billing response was not OK: "
                + IabResult.getResponseDesc(responseCode));
        result = new IabResult(responseCode, "Problem purchashing item.");
        purchaseFailed(result, null);
    } else if (resultCode == Activity.RESULT_CANCELED) {
        SoomlaUtils.LogDebug(TAG, "IabPurchase canceled. Response: " + IabResult.getResponseDesc(responseCode));
        try {
            IabPurchase purchase = new IabPurchase(mPurchasingItemType,
                    "{\"productId\":" + mPurchasingItemSku + "}", "");
            result = new IabResult(IabResult.BILLING_RESPONSE_RESULT_USER_CANCELED, "User canceled.");
            purchaseFailed(result, purchase);
        } catch (JSONException e) {
            SoomlaUtils.LogError(TAG, "Failed to generate canceled purchase.");
            e.printStackTrace();
            result = new IabResult(IabResult.IABHELPER_BAD_RESPONSE, "Failed to generate canceled purchase.");
            purchaseFailed(result, null);
            return true;
        }
    } else {
        SoomlaUtils.LogError(TAG, "IabPurchase failed. Result code: " + Integer.toString(resultCode)
                + ". Response: " + IabResult.getResponseDesc(responseCode));
        result = new IabResult(IabResult.IABHELPER_UNKNOWN_PURCHASE_RESPONSE, "Unknown purchase response.");
        purchaseFailed(result, null);
    }
    return true;
}

From source file:com.roamprocess1.roaming4world.ui.messages.MessageActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    prefs = getSharedPreferences("com.roamprocess1.roaming4world", Context.MODE_PRIVATE);
    stored_chatuserNumber = "com.roamprocess1.roaming4world.stored_chatuserNumber";
    stored_user_mobile_no = "com.roamprocess1.roaming4world.user_mobile_no";
    stored_user_country_code = "com.roamprocess1.roaming4world.user_country_code";
    stored_supportnumber = "com.roamprocess1.roaming4world.support_no";
    stored_server_ipaddress = "com.roamprocess1.roaming4world.server_ip";

    usernum = prefs.getString(stored_user_country_code, "") + prefs.getString(stored_user_mobile_no, "");

    System.out.println("MessageActivity.java before if statement of savedInstanceState ");
    if (savedInstanceState == null) {
        // During initial setup, plug in the details fragment.
        System.out.println("MessageActivity.java after if statement of savedInstanceState ");
        detailFragment = new MessageFragment();
        detailFragment.setArguments(getIntent().getExtras());

        getSupportFragmentManager().beginTransaction().add(android.R.id.content, detailFragment).commit();
        detailFragment.setOnQuitListener(this);
    }/*w w  w.j a  v  a2s  .  co  m*/

    if (getConnectivityStatus(getApplicationContext()) == TYPE_NOT_CONNECTED)
        dialogBoxNoInternet();

    broadcastReceiver_socket_userStatus = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            // TODO Auto-generated method stub
            String action = intent.getAction();

            Log.d("Receiver", "Broadcast received: " + action);

            if (action.equals(ChatSocket.USER_STATUS)) {
                String state = intent.getExtras().getString(ChatSocket.USER_STATUS);
                Log.d("Receiver state", state + " @");
                setStatus(state);
            }

        }
    };

    broadcastReceiver_lost = new BroadcastReceiver() {

        @Override
        public void onReceive(Context context, Intent intent) {
            // TODO Auto-generated method stub
            Log.d("broadcastReceiver_lost", "called");
            tv_userStatus.setText("");
        }
    };

    registerReceiver(broadcastReceiver_lost, new IntentFilter("INTERNET_LOST"));
    registerReceiver(broadcastReceiver_socket_userStatus, new IntentFilter(ChatSocket.USER_STATUS));

}

From source file:com.mobilyzer.MeasurementScheduler.java

@Override
public void onCreate() {
    Logger.d("MeasurementScheduler -> onCreate called");
    PhoneUtils.setGlobalContext(this.getApplicationContext());

    phoneUtils = PhoneUtils.getPhoneUtils();
    phoneUtils.registerSignalStrengthListener();

    this.measurementExecutor = Executors.newSingleThreadExecutor();
    this.mainQueue = new PriorityBlockingQueue<MeasurementTask>(Config.MAX_TASK_QUEUE_SIZE,
            new TaskComparator());
    this.waitingTasksQueue = new PriorityBlockingQueue<MeasurementTask>(Config.MAX_TASK_QUEUE_SIZE,
            new WaitingTasksComparator());
    this.pendingTasks = new ConcurrentHashMap<MeasurementTask, Future<MeasurementResult[]>>();
    this.tasksStatus = new ConcurrentHashMap<String, MeasurementScheduler.TaskStatus>();
    this.alarmManager = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE);
    this.resourceCapManager = new ResourceCapManager(Config.DEFAULT_BATTERY_THRESH_PRECENT, this);

    this.serverTasks = new HashMap<String, Date>();
    // this.currentSchedule = new HashMap<String, MeasurementTask>();

    this.idToClientKey = new ConcurrentHashMap<String, String>();

    messenger = new Messenger(new APIRequestHandler(this));

    gcmManager = new GCMManager(this.getApplicationContext());

    this.setCurrentTask(null);
    this.setCurrentTaskStartTime(null);

    this.checkin = new Checkin(this);
    this.checkinRetryIntervalSec = Config.MIN_CHECKIN_RETRY_INTERVAL_SEC;
    this.checkinRetryCnt = 0;
    this.checkinTask = new CheckinTask();

    this.batteryThreshold = -1;
    this.checkinIntervalSec = -1;
    this.dataUsageProfile = DataUsageProfile.NOTASSIGNED;

    //    loadSchedulerState();//TODO(ASHKAN)

    // Register activity specific BroadcastReceiver here
    IntentFilter filter = new IntentFilter();
    filter.addAction(UpdateIntent.CHECKIN_ACTION);
    filter.addAction(UpdateIntent.CHECKIN_RETRY_ACTION);
    filter.addAction(UpdateIntent.MEASUREMENT_ACTION);
    filter.addAction(UpdateIntent.MEASUREMENT_PROGRESS_UPDATE_ACTION);
    filter.addAction(UpdateIntent.GCM_MEASUREMENT_ACTION);
    filter.addAction(UpdateIntent.PLT_MEASUREMENT_ACTION);

    broadcastReceiver = new BroadcastReceiver() {

        @Override//from   w w w  . j av a2s .c  om
        public void onReceive(Context context, Intent intent) {
            Logger.d(intent.getAction() + " RECEIVED");
            if (intent.getAction().equals(UpdateIntent.MEASUREMENT_ACTION)) {
                handleMeasurement();

            } else if (intent.getAction().equals(UpdateIntent.GCM_MEASUREMENT_ACTION)) {
                try {
                    JSONObject json = new JSONObject(
                            intent.getExtras().getString(UpdateIntent.MEASUREMENT_TASK_PAYLOAD));
                    Logger.d("MeasurementScheduler -> GCMManager: json task Value is " + json);
                    if (json != null && MeasurementTask.getMeasurementTypes().contains(json.get("type"))) {

                        try {
                            MeasurementTask task = MeasurementJsonConvertor.makeMeasurementTaskFromJson(json);
                            task.getDescription().priority = MeasurementTask.GCM_PRIORITY;
                            task.getDescription().startTime = new Date(System.currentTimeMillis() - 1000);
                            task.getDescription().endTime = new Date(System.currentTimeMillis() + (600 * 1000));
                            task.generateTaskID();
                            task.getDescription().key = Config.SERVER_TASK_CLIENT_KEY;
                            submitTask(task);
                        } catch (IllegalArgumentException e) {
                            Logger.w("MeasurementScheduler -> GCM : Could not create task from JSON: " + e);
                        }
                    }

                } catch (JSONException e) {
                    Logger.e(
                            "MeasurementSchedule -> GCMManager : Got exception during converting GCM json to MeasurementTask",
                            e);
                }

            } else if (intent.getAction().equals(UpdateIntent.MEASUREMENT_PROGRESS_UPDATE_ACTION)) {
                String taskid = intent.getStringExtra(UpdateIntent.TASKID_PAYLOAD);
                String taskKey = intent.getStringExtra(UpdateIntent.CLIENTKEY_PAYLOAD);
                int priority = intent.getIntExtra(UpdateIntent.TASK_PRIORITY_PAYLOAD,
                        MeasurementTask.INVALID_PRIORITY);

                Logger.e(
                        intent.getStringExtra(UpdateIntent.TASK_STATUS_PAYLOAD) + " " + taskid + " " + taskKey);
                if (intent.getStringExtra(UpdateIntent.TASK_STATUS_PAYLOAD).equals(Config.TASK_FINISHED)) {
                    tasksStatus.put(taskid, TaskStatus.FINISHED);
                    Parcelable[] results = intent.getParcelableArrayExtra(UpdateIntent.RESULT_PAYLOAD);
                    if (results != null) {
                        sendResultToClient(results, priority, taskKey, taskid);

                        for (Object obj : results) {
                            try {
                                MeasurementResult result = (MeasurementResult) obj;
                                /**
                                 * Nullify the additional parameters in MeasurmentDesc, or the results won't be
                                 * accepted by GAE server
                                 */
                                result.getMeasurementDesc().parameters = null;
                                String jsonResult = MeasurementJsonConvertor.encodeToJson(result).toString();
                                saveResultToFile(jsonResult);
                            } catch (JSONException e) {
                                Logger.e("Error converting results to json format", e);
                            }
                        }
                    }
                    handleMeasurement();
                } else if (intent.getStringExtra(UpdateIntent.TASK_STATUS_PAYLOAD).equals(Config.TASK_PAUSED)) {
                    tasksStatus.put(taskid, TaskStatus.PAUSED);
                } else if (intent.getStringExtra(UpdateIntent.TASK_STATUS_PAYLOAD)
                        .equals(Config.TASK_STOPPED)) {
                    tasksStatus.put(taskid, TaskStatus.SCHEDULED);
                } else if (intent.getStringExtra(UpdateIntent.TASK_STATUS_PAYLOAD)
                        .equals(Config.TASK_CANCELED)) {
                    tasksStatus.put(taskid, TaskStatus.CANCELLED);
                    Parcelable[] results = intent.getParcelableArrayExtra(UpdateIntent.RESULT_PAYLOAD);
                    if (results != null) {
                        sendResultToClient(results, priority, taskKey, taskid);
                    }
                } else if (intent.getStringExtra(UpdateIntent.TASK_STATUS_PAYLOAD)
                        .equals(Config.TASK_STARTED)) {
                    tasksStatus.put(taskid, TaskStatus.RUNNING);
                } else if (intent.getStringExtra(UpdateIntent.TASK_STATUS_PAYLOAD)
                        .equals(Config.TASK_RESUMED)) {
                    tasksStatus.put(taskid, TaskStatus.RUNNING);
                }
            } else if (intent.getAction().equals(UpdateIntent.CHECKIN_ACTION)
                    || intent.getAction().equals(UpdateIntent.CHECKIN_RETRY_ACTION)) {
                Logger.d("Checkin intent received");
                handleCheckin();
            }
        }
    };
    this.registerReceiver(broadcastReceiver, filter);
}

From source file:com.ritul.truckshare.RegisterActivity.DriverLicenseActivity.java

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == Utility.GALLERY_PICTURE && data != null) {
        isImage = true;//from   www  . j ava2  s  .  c o m
        // data contains result
        // Do some task
        Image_Selecting_Task(data);
        Uri selectedImage = data.getData();
        String[] filePathColumn = { MediaStore.Images.Media.DATA };
        Cursor cursor = DriverLicenseActivity.this.getContentResolver().query(selectedImage, filePathColumn,
                null, null, null);
        cursor.moveToFirst();
        int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
        selectedpath = cursor.getString(columnIndex);
        cursor.close();
        BitmapFactory.Options options = new BitmapFactory.Options();
        options.inSampleSize = 8;
        final Bitmap bitmap = BitmapFactory.decodeFile(selectedpath, options);
        convertimagetobyte();
        imagedata = Base64.encodeToString(imageByte, Base64.DEFAULT);
    } else if (requestCode == Utility.CAMERA_PICTURE && data != null) {
        isImage = true;
        // Do some task
        //Image_Selecting_Task(data);
        if (requestCode == Utility.CAMERA_PICTURE && resultCode == RESULT_OK && data != null) {
            Bitmap photo = (Bitmap) data.getExtras().get("data");
            preview.setImageBitmap(photo);

            Bitmap bitmap = ((BitmapDrawable) preview.getDrawable()).getBitmap();
            imagedata = Base64.encodeToString(getBytesFromBitmap(bitmap), Base64.DEFAULT);

        }
    }
}

From source file:com.dragon4.owo.ar_trace.ARCore.MixView.java

private void handleIntent(Intent intent) {
    //  ? ? //  w  w  w  .ja  v  a 2  s .c  o  m
    if (Intent.ACTION_SEARCH.equals(intent.getAction())) {
        String query = intent.getStringExtra(SearchManager.QUERY); //  ?
        //  doMixSearch(query);    //  
    } else if (intent.getExtras() != null) {
        FCMMessagingService.clear(intent.getStringExtra("traceID"));
        Intent traceIntent = new Intent(this, TraceActivity.class);
        traceIntent.putExtras(intent.getExtras());
        topLayoutOnMixView.mainArView.setVisibility(View.GONE);
        startActivityForResult(traceIntent, SHOW_TRACE);
    }
}

From source file:com.safecell.HomeScreenActivity.java

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    // TODO Auto-generated method stub
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == 1) {

        if (resultCode == Activity.RESULT_OK) {

            Uri selectedImage = data.getData();
            // Log.v("Safecell :" + "selectedImage", "imagePath = "
            // + selectedImage);
            profileImageView.setImageBitmap(getImageFromURI(selectedImage));

        }/*from w w  w . j  a v  a2 s. c om*/
    } // //End Request code = 1

    if (requestCode == 2 && resultCode == RESULT_OK) {
        Bitmap photo = (Bitmap) data.getExtras().get("data");
        profileImageView.setImageBitmap(photo);
    }

    /*
     * if (requestCode == 2) { if (resultCode == -1) {
     * 
     * if (outputFileUri == null) { //outputFileUri = (Uri)
     * data.getExtras().get(MediaStore.EXTRA_OUTPUT);
     * 
     * Uri selectedImage = data.getData(); // Log.v("Safecell :" +
     * "selectedImage", "imagePath = " // + selectedImage); profileImageView
     * .setImageBitmap(getImageFromURI(selectedImage));
     * 
     * UIUtils.OkDialog(HomeScreenActivity.this,
     * "Capture image not available. outputuri: "+outputFileUri);
     * 
     * } else { Uri selectedImage = Uri.parse(outputFileUri.getPath()); //
     * Log.v("Safecell :" + "selectedImage", "imagePath = " // +
     * selectedImage); profileImageView
     * .setImageBitmap(getImageFromURI(selectedImage)); }
     * 
     * } }
     */

}