android-music-player

Music(activity) restarts when rotating device…why does it happen?and how can i stop it from restarting?

穿精又带淫゛_ 提交于 2019-12-25 00:30:07
问题 well i think my question describes itself , anyways here is the code public class NowPlaying extends Activity implements Serializable { static MediaPlayer mp =new MediaPlayer(); String artist;ProgressDialog pd; int position; String key=null ; /*int z=0; SeekBar songProgressBar ; TextView songCurrentDurationLabel; TextView songTotalDurationLabel ; private Handler mHandler = new Handler(); private Utilities utils=new Utilities(); */ @SuppressLint("NewApi") protected void onCreate(Bundle

How to implement multiple buttons on Onitemclicklistener function interface? [closed]

て烟熏妆下的殇ゞ 提交于 2019-12-24 19:05:01
问题 Closed . This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago . I am not understanding here how to use this interface OnItemClickListener for multiple buttons package com.mtechviral.musicplayer; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view

Android : Launch Music Player via Service

两盒软妹~` 提交于 2019-12-24 07:58:04
问题 I am trying to launch the MediaPlayer from a service, and its not wroking as expected. I m getting the following exception, android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.MUSIC_PLAYER flg=0x10000000 } Please find the snippet of code that gets invoked in the service, Intent intent = new Intent(MediaStore.INTENT_ACTION_MUSIC_PLAYER); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); Android Manifest <service android

How to enqueue music to default android music player via app?

坚强是说给别人听的谎言 提交于 2019-12-24 05:31:30
问题 I am new to android app development, but I have good knowledge of programming in JAVA and in general. I am trying to write an app for android which can enqueue music files to default music player in android (like Google Play Music). My app decides which song to play when, but I don't want to write a full-blown music player app. I just want to feed the existing player app with new music. I am looking for something like "inter-app" communication (perhaps using Intent?) through which I can feed

Android MP3 file Filtering form sdcard

落爺英雄遲暮 提交于 2019-12-23 16:26:11
问题 I have developing the application to fetching data from sd card. I used this option for filtering but when I used logcat I found that I only get data of only file sdcard/some_dir But I have sound files into different folder so if possible give me universal code to fetch all the mp3 file form the sdcard. class FileExtensionFilter implements FilenameFilter { public boolean accept(File dir, String name) { return (name.endsWith(".mp3") || name.endsWith(".MP3")); } } 回答1: This is mine AudioFilter

How to know which music player is currently playing the song in android

*爱你&永不变心* 提交于 2019-12-23 03:55:30
问题 I want to know that which music player is currently playing the music. Also i want to know that at current time if music is paused. Actually, I want to play the music on connecting the headphone if any music is currently paused. I have succeeded in it but upto a little extent: 1. I am able to play music when I connect the headphone even if no music was paused at that time. 2. I set 2 music player at same time with different songs playing. When I removed headphone, the music stopped, but when

Start default music player with music playing by default

时光总嘲笑我的痴心妄想 提交于 2019-12-23 03:39:14
问题 I am developing an application where I need to start the default music app and play all the songs. I have tried a number of approaches, but nothing seems to work. Intent LaunchIntent = getPackageManager().getLaunchIntentForPackage( "com.android.music.MediaPlaybackActivityStarter"); startActivity( LaunchIntent ); and Intent intent = new Intent(); ComponentName comp = new ComponentName("com.android.music", "com.android.music.MediaPlaybackActivity"); intent.setComponent(comp); intent.setAction

Throwing null pointer exception in Android

眉间皱痕 提交于 2019-12-23 01:55:34
问题 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>>

How do you use MediaControllerCompat to control the current player?

混江龙づ霸主 提交于 2019-12-22 04:32:23
问题 My app is not the media player. I just want to be able to control the current media player using the new MediaControllerCompat class. Currently I am using MediaSessionManager but want to upgrade to the new compat classes. How do I instantiate the MediaControllerCompat class when I don't have a token or MediaSessionCompat to instantiate it with? I am hoping to get some example code. 回答1: I asked Ian Lake, the Google dev who did the video on MediaSessionCompat, who said it is not possible

How to convert audio from stereo to mono in Android?

大憨熊 提交于 2019-12-22 01:15:42
问题 I use the android.provider.MediaStore.Audio.Media.EXTERNAL_CONTENT_URI intent to load music files from the SD Card. Intent tmpIntent1 = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Audio.Media.EXTERNAL_CONTENT_URI); startActivityForResult(tmpIntent1, 0); and in onActivityResult Uri mediaPath = Uri.parse(data.getData().toString()); MediaPlayer mp = MediaPlayer.create(this, mediaPath); mp.start(); Now MediaPlayer plays the audio in stereo. Is there any way to convert the selected