I am going on with my surfaceview camera activty in that i want to get the MimeTye file from Uri of local path while calling the gallery can get the MimeType from Content Uri but while loading from camera can't get the MimeType for that tried to convert the localpath from file to Content Uri for that tried with below:
public static Uri getImageContentUri(Context context, File imageFile) {
String filePath = imageFile.getAbsolutePath();
Cursor cursor = context.getContentResolver().query(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
new String[] { MediaStore.Images.Media._ID },
MediaStore.Images.Media.DATA + "=? ",
new String[] { filePath }, null);
if (cursor != null && cursor.moveToFirst()) {
int id = cursor.getInt(cursor
.getColumnIndex(MediaStore.MediaColumns._ID));
// Uri baseUri = Uri.parse(stringUri);
return Uri.withAppendedPath(uploadImageURI, "" + id);
} else {
if (imageFile.exists()) {
ContentValues values = new ContentValues();
values.put(MediaStore.Images.Media.DATA, filePath);
return context.getContentResolver().insert(
MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
} else {
return null;
}
}
}
follwed the link :http://android-er.blogspot.in/2011/04/convert-uri-to-real-path-format.html but the issue didn't fixed.
How to solve this is there any other solution to fix the issue.Is there please help me friends