Thursday, March 6, 2014
Get the file path issue by uri
When Hello everyone, I get the file path via the following methodsMost models have no problems
But
when running on nexus7
The reason is that they are always being given int column_index = cursor.getColumnIndexOrThrow (MediaStore.Images.Media.DATA);
This sentence prompted to find _data column (column _data does not exist)
A friend of mine met you how to solve?
protected String getAbsoluteImagePath (Uri uri)
{
/ / Can post image
String [] proj = {MediaStore.Images.Media.DATA};
Cursor cursor = managedQuery (uri,
proj,
null,
null,
null);
int column_index = cursor.getColumnIndexOrThrow (MediaStore.Images.Media.DATA);
cursor.moveToFirst ();
return cursor.getString (column_index);
}
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
MediaStore.Images.Media.DATA
This Column does not exist in this field in your database table.
Is usually caused by different versions of Android, you try other low version,
Sometimes taking system data is one such example to a lot of contacts in different versions column names are not the same.
Reply:
First thank you
I probably know the version of the thing, I was asking. . . In such cases, there is no _data column, that there are other ways to get the file path right through the uri
Reply:
This corresponds to the API documentation going to investigate,
http://developer.android.com/reference/android/provider/MediaStore.Images.Media.html
http://developer.android.com/reference/android/provider/MediaStore.Images.ImageColumns.html
Reply:
Hello upstairs friends who still do
I just put internal.db data / data / com.android.provider.media / databases / under and external.db
Are turned inside out _data found this out ah
Why not find out it will be reported to help ah. . . . Here is the error log
10-21 12:59:33.547: E / AndroidRuntime (12414): Caused by: java.lang.IllegalArgumentException: column '_data' does not exist
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment