Listview: How To Notify The User About New Fetched Data With Sound And Vibration?
I've added my MainActivity below, the application fetches data from a database and refreshes automatically and on swipe down. My question is, how on earth can it notify the user ab
Solution 1:
After you fetch new data, there is a place you need to call notifyDataSetChanged()
to let the listview update its content.
right after that call, you can use Vibrator to start a vibration
Vibratorv= (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
// Vibrate for 500 milliseconds
v.vibrate(500);
see: http://developer.android.com/reference/android/os/Vibrator.html
To play sound, you need a MediaPlayer:
MediaPlayermp= MediaPlayer.create(this, yourSoundFile);
mp.start();
Post a Comment for "Listview: How To Notify The User About New Fetched Data With Sound And Vibration?"