abbasalim
چهارشنبه 31 اردیبهشت 1393, 17:26 عصر
بنام خدا
سلام
من با کد زیر یه عکس از دوربین میگیرم ولی یه عکس دیگه به من تحویل میده :افسرده:
if (requestCode == CAMERA_REQUEST) {
if (resultCode == RESULT_OK) {
if (data.hasExtra("data")) {
// retrieve the bitmap from the intent
Cursor cursor = getContentResolver()
.query(Media.EXTERNAL_CONTENT_URI,
new String[] {
Media.DATA,
Media.DATE_ADDED,
MediaStore.Images.ImageColumns.ORIENTATION },
Media.DATE_ADDED, null, "date_added ASC");
if (cursor != null && cursor.moveToFirst()) {
do {
Uri uri = Uri.parse(cursor.getString(cursor
.getColumnIndex(Media.DATA)));
selectedImagePath = uri.toString();
} while (cursor.moveToNext());
cursor.close();
}
Log.e("path of the image from camera ====> ",
selectedImagePath);
//new Upload().execute(UploadUrl, selectedImagePath);
checkfile(selectedImagePath);// یه کلاس دلخواه
} else if (data.getExtras() == null) {
Toast.makeText(getApplicationContext(),
"No extras to retrieve!", Toast.LENGTH_SHORT)
.show();
}
} else if (resultCode == RESULT_CANCELED) {
Toast.makeText(getApplicationContext(), "Cancelled",
Toast.LENGTH_SHORT).show();
}
سلام
من با کد زیر یه عکس از دوربین میگیرم ولی یه عکس دیگه به من تحویل میده :افسرده:
if (requestCode == CAMERA_REQUEST) {
if (resultCode == RESULT_OK) {
if (data.hasExtra("data")) {
// retrieve the bitmap from the intent
Cursor cursor = getContentResolver()
.query(Media.EXTERNAL_CONTENT_URI,
new String[] {
Media.DATA,
Media.DATE_ADDED,
MediaStore.Images.ImageColumns.ORIENTATION },
Media.DATE_ADDED, null, "date_added ASC");
if (cursor != null && cursor.moveToFirst()) {
do {
Uri uri = Uri.parse(cursor.getString(cursor
.getColumnIndex(Media.DATA)));
selectedImagePath = uri.toString();
} while (cursor.moveToNext());
cursor.close();
}
Log.e("path of the image from camera ====> ",
selectedImagePath);
//new Upload().execute(UploadUrl, selectedImagePath);
checkfile(selectedImagePath);// یه کلاس دلخواه
} else if (data.getExtras() == null) {
Toast.makeText(getApplicationContext(),
"No extras to retrieve!", Toast.LENGTH_SHORT)
.show();
}
} else if (resultCode == RESULT_CANCELED) {
Toast.makeText(getApplicationContext(), "Cancelled",
Toast.LENGTH_SHORT).show();
}