last day (15 days later) » 

4:41 AM
0
Q: Failed to get type for: content://

Sumit PansuriyaIn Nougat and Pie, this function is not working. I have used below function to get realpath form content uri for .mp3 files. Please check below link: Get Real File Path From Android Uri Error log: *2019-07-01 14:39:33.965 9971-10277/com.mp3musicapp W/ContentResolver: Failed to get type for: co...

 
you cannot get any real path for your Uri - what do you want to achieve actually with given Uri?
 
I want to get real path from content uri.
 
because Uri != File you cannot get any real path from Uri - more: commonsware.com/blog/2014/07/04/uri-not-necessarily-file.htm‌​l
 
Hello, I have content uri not a file uri - content://media/external/audio/albumart/-1. Now I'm getting realpath form content uri using above method (link mention in question). But getting error like - "java.lang.IllegalArgumentException: column '_data' does not exist. Available columns: []". So what I do dear.
 
in the link i posted you have the section saying: "Ideally, nowadays, those Uri values are “openable”. You can perform the following operations on such Uri values:" - read it carefully
 
4:41 AM
Hello, I want to play this uri in my musiv player. Is it possible to play in all Android version. "content://cn.xender.provider/external_files/Music/90s%20Bol‌​lywood%20Songs%20Mas‌​hup.mp3"
 
you mean MediaPlayer class?
 
yes. I want to play this uri in MediaPlayer class.
 
and how do you create a new MediaPlayer instance? with MediaPlayer.create static method?
 
I got a new path as per above link: "/data/user/0/com.sahajanand.mp3musicapp/files/90s Bollywood Songs Mashup.mp3" Media Player Code: MediaPlayer mPlayer = new MediaPlayer(); mPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mPlayer.setDataSource(getApplicationContext(), myUri); mPlayer.prepare(); mPlayer.start();
 
yes, setDataSource is what you should use
 
4:41 AM
in setDataSource I'm use below path: "Uri myUri = Uri.parse(Uri.fromFile(new File(videoRealPath)).toString());"
 
i told you that you CANNOT use any videoRealPath, i did it 3 times already - if you have Uri use that Uri and do not try to get any real path from that Uri
if you want to get an Uri for some music then simply get it like: stackoverflow.com/a/17945257/2252830
here: Uri uri = data.getData(); is your Uri
you wanna chat or not???
 
4:58 AM
okay sir
exactly I want to play music from "Xender" or "WhatsApp" applications to my app. When user select any song from Xender app, app will show 1 dialog that is Open with dialog. Then user select our app to play selected music file. That is our concept.
 
so you have to use some Intent.ACTION_GET_CONTENT action, right?
if so, it should return Uri - simply use it directly as it is
 
yes, I need to get data from Intent.
 
so what is the Uri like? did you try to Log.d(TAG, "uri: " + uri);
if so what does it print?
 
okay. I'm checking it.
 
5:29 AM
sorry i am not goiung to wait forever
adding one Log.d should take 2 minutes, not 20
bye bye
 
 
3 hours later…
8:57 AM
Hello
Can I play music file as below:
"content:///data/user/0/com.mp3musicapp/files/jat ludhiyane da - songs.pk - 320kbps.mp3"
 

last day (15 days later) »