android-music-player

Android 10 MediaStore API changes

孤街浪徒 提交于 2020-01-24 16:24:31
问题 Uri uri = MediaStore.Audio.Artists.Albums.getContentUri("external", artistId); String[] projection = new String[] {BaseColumns._ID}; Cursor cursor = mContext.getApplicationContext().getContentResolver().query (uri, projection, null, null, null); Prior to Android 10, BaseColumns._ID was returning album_id and now in 10, it returns some random Id. When I passed projection as null and retrieved all column names below are the column name that I get. This is in Android 10. [numsongs, artist,

Android Music Seekbar is not working (Idle)

我只是一个虾纸丫 提交于 2020-01-18 05:45:28
问题 I am playing mp3 file from url, but SeekBar is not updating while playing song. When i am trying to move forcefully then song playing from start. Below code i am using to play and update SeekBar. I wanted to create a seekBar that track the progress of a mediaplayer but it doesnt work out quite well, the music is playing but the seekbar stay idle. Is there something that I left out? I think i am not not calling updateSeekBar() method from correct position...so Tried by change position of

Display Album and Artist in listview with LoaderManager and CursorLoader

怎甘沉沦 提交于 2020-01-13 12:56:08
问题 I have a ListFragment whose list should diplay the Albums of the device and the associated artist using MediaStore . Each row has thus two TextViews . I'm using LoaderManager and CursorLoader to fill the list up, with a custom CursorAdapter in order to bind the TextViews of the row to the data. ListFragment Code : public class AlbumsFragment extends ListFragment implements LoaderManager.LoaderCallbacks<Cursor> { AlbumsAdapter mAdapter; @Override public View onCreateView(LayoutInflater

Android Music Player

核能气质少年 提交于 2020-01-07 09:06:18
问题 I am making an Music Player App.I have two different Fragments for SongsList (SongList.java) and Mediaplayer Controls(i.e Mediaplayer.java that includes play, pause buttons). Now, i want to connect my SongsList.java with Mediaplayer.java. I want to select a song from SongsList.java which gets played in Mediaplayer.java. How do I do ? PLEASE HELP !!! SongList.java import android.app.Fragment; import android.content.ContentResolver; import android.database.Cursor; import android.net.Uri; import

Android Music Player

半腔热情 提交于 2020-01-07 09:06:08
问题 I am making an Music Player App.I have two different Fragments for SongsList (SongList.java) and Mediaplayer Controls(i.e Mediaplayer.java that includes play, pause buttons). Now, i want to connect my SongsList.java with Mediaplayer.java. I want to select a song from SongsList.java which gets played in Mediaplayer.java. How do I do ? PLEASE HELP !!! SongList.java import android.app.Fragment; import android.content.ContentResolver; import android.database.Cursor; import android.net.Uri; import

play sound file with a delay and adjust time in android

久未见 提交于 2020-01-06 11:25:59
问题 I am trying to program a sound app where on button click I would like to play 3-4 sound files one after the other. How can this be done? Also I would like to increase the time of play of the files. Is this where the loop variable in play function used?? Here is part of code I have done with SoundPool. However the files all play simultaneously :( public void onClick(View v){ //check for scan button if(v.getId()==R.id.playbutton){ queueSound(1000); sound.changePitchfile3(R.raw.a0); queueSound

More than 1 song playing in Media Player at same time

我只是一个虾纸丫 提交于 2020-01-05 05:55:11
问题 I am new to Android programming and I am trying to make a simple Media Player app which extracts songs from the user's SD Card and enables the user to play the songs. The problem I face is that while a song is playing, if the user clicks on some other song, that song also starts playing. I searched for the solution and used release() but the problem persists. I would appreciate any help given! Relevant code: public class Player extends AppCompatActivity implements SeekBar

How to detect song playing is completed?

喜欢而已 提交于 2020-01-04 04:17:20
问题 I am playing a song with the help of Media Player using following code, mediaPlayer = new MediaPlayer(); mediaPlayer.setDataSource( "sound_file_filepath" ); mediaPlayer.prepareAsync(); mediaPlayer.setOnPreparedListener(new OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { mediaPlayer.start(); } }); Now i have a toggle kind of image in my .xml file which first shows a play image. After clicking/touching the play image it will start the song and replace the image with

How To Add Media To MediaStore on Android 4.4 KitKat SD Card With Metadata

我只是一个虾纸丫 提交于 2019-12-29 04:24:32
问题 Background: In Android 4.4, Google decided that apps should not have write access to SD cards. However, apps can write to /SDCard/Android/data/App Package Name. So this is what I've done. I have written an MP3 file to /Android/data/. I then want this MP3 file to show up in Android music players. I've tried the following... sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + filePath))); and.... MediaScannerConnection.scanFile(this, new String[] { file.toString() }, new

Splash Screen Activity - The element must be a direct child of the element [WrongManifestParent]

≯℡__Kan透↙ 提交于 2019-12-25 07:48:34
问题 I am using an open source android project called Timber & I've been trying to add a splash screen to it but am having no luck. How would I go about doing it? Here my AndroidManifest: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.technologx.blaze.player.pro" android:installLocation="auto"> <meta-data android:name="com.google.android.geo.API_KEY" android:value=