Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

116
Vistas
Cómo configurar para mostrar el nombre de la música y en mi teléfono

Tengo una pregunta ahora intento crear una aplicación de música en mi teléfono. ahora puedo ver la canción de mi archivo, pero el nombre que se muestra en la aplicación es la dirección del archivo. y si quiero reproducir la música de archivo en esta aplicación. ¿Qué código necesito agregar para obtener el nombre de la música y reproducirla en mi teléfono? muchas gracias

 @Override public void onClick(View view) { mp.pause(); play.setEnabled(true); stop.setEnabled(true); pause.setEnabled(false); } }); stop.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (mp != null) { mp.stop(); try { mp.prepare(); } catch (IOException e) { e.printStackTrace(); } //mp.release() play.setEnabled(true); play.setEnabled(true); stop.setEnabled(false); } } });

enviar.setOnClickListener(nueva Vista.OnClickListener() {

 //List<Intent> intentShareList = new ArrayList<Intent>(); @Override public void onClick( View view ) { msgs = msg.getText().toString(); System.out.print("msgs " + msgs); // make line message Log.d(TAG, "Txt " + msgs); Intent shareIntent = new Intent(); String userId = ""; String sendText = "line://ti/p/~" + userId; //shareIntent = null; try { shareIntent = Intent.parseUri(sendText, Intent.URI_INTENT_SCHEME); } catch (URISyntaxException e) { e.printStackTrace(); } shareIntent.setAction(Intent.ACTION_SEND); shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); shareIntent.putExtra(Intent.EXTRA_TEXT,msgs); shareIntent.setType("text/plain"); startActivity(shareIntent); } });

} Y

 public class Songs { //private private String songTitle; private String songAddress; public Songs(String title){ //songID = id; songTitle = title; } /*public long getSongID(){ return songId; */ public String getSongTitle(){ return songTitle; }

}

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

ahora puedo ver la canción de mi archivo, pero el nombre que se muestra en la aplicación es la dirección del archivo.

Creo que te refieres a la " Ruta " del archivo, por ejemplo:

/storage/emulated/0/song.mp3 (ruta estilo Unix)

C:\Songs\song.mp3 (ruta de estilo de ventana)

Si desea analizar (descubrir) el nombre del archivo, use el siguiente código:

 String filePath = "/storage/emulated/0/song.mp3"; File f = new File(filePath); String fileName = f.getName(); // fileName == "song.mp3"

En tu caso:

 public class Songs { private String title; // renamed from "songTitle" private String path; // renamed from "songAddress" private String fileName; // the file name of the song public Songs(String title, String path){ this.title = title; this.path = path; File file = new File(path); String fileName = f.getName(); this.fileName = fileName; } public String getTitle(){ return title; } public String getPath(){ return path; } public String getFileName(){ return fileName; } }
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda