Category : android-mediaplayer

I have an application which will record audio as soon as the activity is launched and after recording for 15 seconds, it will stop and the audio will be saved in phone’s storage and will be uploaded to firebase as well. But whenever I call mediarecorder.stop(); function, it gives error of null object reference. Please ..

Read more

public class SongPlayerActivity extends AppCompatActivity implements MediaPlayer.OnCompletionListener { static MediaPlayer mediaPlayer; TextView songName, artistName, albumName, durationPlayed, totalDuration; ImageView next, previous, songImage, shuffle, repeat; SharedPreferences sharedPreferences; SharedPreferences.Editor editor; SeekBar seekBar; FloatingActionButton floatingActionButton; List<Song> songList = new ArrayList<>(); Handler handler = new Handler(); Thread playPauseThread, nextThread, previousThread; private Uri uri; private int position; boolean shuffleBoolean, repeatBoolean; @Override ..

Read more

I have a settings activity in my Android app that selects a sound from a choice of files in the res/raw folder. There are other settings too but the essential part of the settings_pref.xml file is <PreferenceCategory android:title="Pager Tone"> <ListPreference android:defaultValue="pager1" android:entries="@array/pagerName" android:entryValues="@array/pagerFile" android:key="pagerSound" android:title="Select Pager Tone" app:useSimpleSummaryProvider="true" /> </PreferenceCategory> Then the SettingsFragment.java is import ..

Read more