This is showing a dialog to the user to tell them to enter a path. You should handle if path = "" after they close the dialog as well.
On Tue, Jan 6, 2009 at 7:54 PM, Honest <[email protected]> wrote: > > I am learning API related to sound playing. I was understanding code > for it. The code is as below. > > private void playAudio(Integer media) { > try { > switch (media) { > case LOCAL_AUDIO: > /** > * TODO: Set the path variable to a local audio > file path. > */ > path = ""; > if (path == "") { > // Tell the user to provide an audio file URL. > Toast.makeText( > MediaPlayerDemo_Audio.this, > "Please edit MediaPlayer_Audio > Activity, " > + "and set the path > variable to your audio file path." > + " Your audio file > must be stored on sdcard.", > Toast.LENGTH_LONG).show(); > > } > mMediaPlayer = new MediaPlayer(); > mMediaPlayer.setDataSource(path); > mMediaPlayer.prepare(); > mMediaPlayer.start(); > break; > > > I could not understand the block of code after the condition if > (path==""). > > What Toast.makeText() will do ? FRom my understanding it is not > intializing any value to path variable so at the end of that code > block the value of path will be ""(blank) after that there is a code > to play file by giving path but the value of path is blank so will > there be any exception ? > > > I hope some one will give reply. > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---

