java - Check file, always return true -


i tried code below , if rename music-file musik_stk100.mp3 if still returns true?

what doing wrong?

string filepath = "file:///mnt/sdcard/data/musikapp/"; final file musicfile = new file(filepath  + "/" + "musik_stk100.mp3"); final imageview imagetrue = (imageview) findviewbyid(r.id.imagetrue); final imageview imagefalse = (imageview) findviewbyid(r.id.imagefalse);      if (musicfile.exists()){         imagetrue .setvisibility(view.visible);         imagefalse .setvisibility(view.gone);     } else {         imagefalse .setvisibility(view.visible);         imagetrue .setvisibility(view.gone);     } 

solution

string filepath = (environment.getexternalstoragedirectory() + "/data/musikapp/"); final file musicfile = new file(filepath  + "musik_stk100.mp3"); final imageview imagetrue = (imageview) findviewbyid(r.id.imagetrue); final imageview imagefalse = (imageview) findviewbyid(r.id.imagefalse);      if (musicfile.exists()){         imagetrue .setvisibility(view.visible);         imagefalse .setvisibility(view.gone);     } else {         imagefalse .setvisibility(view.visible);         imagetrue .setvisibility(view.gone);     } 


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -