Breaking News
Home / Android / Android Snippets / How to create an Intent to launch audio in Android?

How to create an Intent to launch audio in Android?

  1. String audioUrl = "Your Audio URL mp3 file/stream here";
  2. Intent audioIntent = new Intent();
  3. Uri audioData = Uri.parse(audioUrl);
  4. audioIntent.setDataAndType(audioData, "audio/mp3");
  5.                         audioIntent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
  6. startActivity(audioIntent);
[pb_builder]

Check Also

How to check if an Android device can connect to Internet?

The following code snippet shows how to check if an Android device can connect to …

Advertisment ad adsense adlogger