Code example for File

Methods: fromFile

0
		return collection;
	} 
     
    public static GCAccountMediaModel getMediaModel(String path) {
		final GCAccountMediaModel model = new GCAccountMediaModel();
		path = Uri.fromFile(new File(path)).toString();
		model.setLargeUrl(path);
		model.setThumbUrl(path);
		model.setUrl(path);
		return model;
	} 
     
    public static String convertMediaUriToPath(Context context, Uri uri) {
    	String[] proj = { MediaStore.Images.Media.DATA };
    	Cursor cursor = context.getContentResolver().query(uri, proj, null, null, null);
    	int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
    	cursor.moveToFirst();
    	String path = cursor.getString(column_index);
    	cursor.close();
    	return path;
        }