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

120
Vistas
How set to show the name of music and it on my phone

I have a question now i try create a music app on my phone. now I can see my file song But the name shown in the app is the file address instead. and if i want to play the file music in this app. What code do I need to add for get the name of music and play it on my phone? thank a lot

  @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);
            }
        }
});

send.setOnClickListener(new View.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);
    }
});

} AND

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

now I can see my file song But the name shown in the app is the file address instead

I think you are referring to the "Path" of the file, for example:

/storage/emulated/0/song.mp3 (Unix style path)

C:\Songs\song.mp3 (Window style path)

If you would like to parse (find out) the name of the file, use the following code:

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

In your case:

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