Hello I am develop video player with android gallery. I receive URI from gallry. and I need to display video title, when play video. so if content has not title meta data. I
If the uri is a content provider uri, this is how you should retrieve file info.
Cursor cursor = getContentResolver().query(uri, null, null, null, null);
/*
* Get the column indexes of the data in the Cursor,
* move to the first row in the Cursor, get the data,
* and display it.
*/
int nameIndex = returnCursor.getColumnIndex(OpenableColumns.DISPLAY_NAME);
cursor.moveToFirst();
nameView.setText(cursor.getString(nameIndex));
https://developer.android.com/training/secure-file-sharing/retrieve-info.html
Here i am giving you a sample code which will upload image from gallery
To extract filename/Imagename
,Do the following
File f = new File(selectedPath);
System.out.println("Image name is ::" + f.getName());//get name of file
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case 1:
if (resultCode == YourActivity.RESULT_OK) {
Uri selectedImageUri = data.getData();
String selectedPath = getPath(selectedImageUri);
File f = new File(selectedPath);
System.out.println("Image name is ::" + f.getName());//get name of file
}
}
Hope this will help