Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

117
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!