This publication is part of the " LookThisCode ". (is Spanish) Code public void IniciarMusica() { try { Uri archivo = Uri.parse("http://nicolasbortolotti.com.ar/mp3/Corelli%20-%20Preludio.mp3"); mp = MediaPlayer.create(this, archivo); mp.start(); } catch(Exception ex) { Log.e("Depurar", "falla en el archivo de audio",ex); } } [1] To call from a button handler. [2] Media handling for Android. [3] For specification of the code. Concepts MediaPlayer.create() Create a new object MediaPlayer. MediaPlayer.start() Starts playback. MediaPlayer.stop() Stops playback. Uri.parser() To analyze and format to "URI" character string. Look Code Important lines of code that deserve detailed explanation. Line 1: mp = MediaPlayer.create(this, archivo); This line creates the playback mechanism, stating the context and passing the"URI" mp3 file. Line 2: mp.sta
Innovation, Technology, Research & Tech Communities