android-music-player

Check if album art exists?

可紊 提交于 2019-12-11 00:25:12
问题 I'm building a music player app. I'm trying to populate a recyclerView with album arts of songs. I successfully did that with the code that is given below. But some of the songs do not have embedded album art not any album art in the folder. So, I'm trying to check if the album art is null or not before adding it to the recyclerView . If the album art is null, the app will automatically fetch it from the internet. I tried checking if the album art is null or not, but everytime it gives me a

MediaPlayer plays the music files only in debug mode ( Android )

别等时光非礼了梦想. 提交于 2019-12-10 17:17:41
问题 I have written an Android application ( in eclipse) that plays a music file as follows: MediaPlayer mediaPlayer = new MediaPlayer(); try { mediaPlayer.setDataSource(fileName); mediaPlayer.prepare(); mediaPlayer.start(); // mediaPlayer.stop(); } catch (Exception e) { Log.d("Exception---", e.getMessage()); } When I run it, it does not play the file ( and does not show any exception ), but when I switch to 'debug mode', and trace it line by line, it plays the file. I'm really confused. Would you

Android:Music Player,Unable to start service with null point exception?

百般思念 提交于 2019-12-08 14:04:57
问题 There were no errors until i added broadcast receiver for showing the progress of the seekbar.The app was working fine before. Code for the activity. package source.justanothermusicplayer; import java.io.Serializable; import java.util.ArrayList; import source.justanothermusicplayer.classes.SongDetails; import source.justanothermusicplayer.service.Music_service; import android.app.Activity; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent;

Using Media Button Broadcasts with Samsung's default media player

时光总嘲笑我的痴心妄想 提交于 2019-12-08 04:21:54
问题 I built an app using Intent.ACTION_MEDIA_BUTTON to control the current media play, but a customer reported it wasn't working with their Samsung music player. Does anyone know if the Samsung media player doesn't support media buttons, and if so how to fix it? 回答1: I don't have a solution for you, but I can confirm that the stock media player on my Samsung Galaxy S / Android 2.1 testing unit does not respond to either 'toggle play/pause' (KEYCODE_MEDIA_PLAY_PAUSE) or 'next track' (KEYCODE_MEDIA

My App is not working in API 23

不想你离开。 提交于 2019-12-07 15:26:20
问题 The music app which is <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="23" /> , it works on API 16 , but not in API 23. The listview is not loaded with songs, it shows empty when checked in API23, working fine in API16. In API22 also working fine import java.io.File; import java.util.ArrayList; import java.util.HashMap; import android.app.ListActivity; import android.content.Context; import android.content.Intent; import android.graphics.Color; import android.os.Bundle; import

Throwing null pointer exception in Android

放肆的年华 提交于 2019-12-06 20:49:40
I'm trying to fetch an audio file from the audio directory, for that I'm using below code. I'm not able to figure out why this condition if (home.listFiles(new FileExtensionFilter()).length > 0) is throwing an error. Code is given below. Uri allsongsuri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI; final String MEDIA_PATH = allsongsuri.toString(); private ArrayList<HashMap<String, String>> songsList = new ArrayList<HashMap<String, String>>(); public ArrayList<HashMap<String, String>> getPlayList(){ System.out.println(" -- "+MEDIA_PATH); File home = new File(MEDIA_PATH); if (home.listFiles(new

Play song on default music player - android

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 20:50:16
问题 My app show list of song from sd card. I want to be able to play the song on the default player. I've got all the data about the song: id, title, album, artist, path... Is there a way to launch the default player to play the song? What I've tried: Using Intent.CATEGORY_APP_MUSIC . I can launch the default player, but can't set the song. Intent.makeMainSelectorActivity(Intent.ACTION_MAIN, Intent.CATEGORY_APP_MUSIC) open the default music app. However intent.setData(Uri.withAppendedPath

Display Album and Artist in listview with LoaderManager and CursorLoader

妖精的绣舞 提交于 2019-12-05 19:34:44
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 inflater, ViewGroup container, Bundle savedInstanceState) { View myFragmentView = inflater.inflate(R.layout

My App is not working in API 23

一世执手 提交于 2019-12-05 18:57:26
The music app which is <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="23" /> , it works on API 16 , but not in API 23. The listview is not loaded with songs, it shows empty when checked in API23, working fine in API16. In API22 also working fine import java.io.File; import java.util.ArrayList; import java.util.HashMap; import android.app.ListActivity; import android.content.Context; import android.content.Intent; import android.graphics.Color; import android.os.Bundle; import android.os.Environment; import android.view.ContextMenu; import android.view.MenuInflater; import

how to play sound Over background music

不想你离开。 提交于 2019-12-04 21:18:41
I have an application that has single activity and I know How to play a background music using the Media player. As I have only one activity so I think I really do not need to play this music in the service. so I have little confusion so this is what I want. What I want : In my app I have a single activity and some buttons in it. I want to play sounds of different length on button click. But Mean while I really do not want to stop the back ground music it should play in background on the same time. So my Question are (based on my upper given requirements) Is it possible to play two sounds in