jeudi 1 juin 2017

if statement return false for no reason

Can anyone please tell me why this block of code is not working?

It's driving me crazy now. The if statement shows that both entries are Equal and it refuses to accept it as true for no reason.

if (isStoragePermissionGranted()) { File sdcard = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS); for (File f:sdcard.listFiles()) { if (f.isFile()){ String name = f.getName(); // String[] splited = name.split("."); StringTokenizer string = new StringTokenizer(name,"."); String frst = string.nextToken(); String scnd = string.nextToken().toLowerCase(); // String scnd=splited[1]; String jpg ="jpg"; if (scnd==jpg) { files.add(f); fileNames.add(name); }

Aucun commentaire:

Enregistrer un commentaire