Q:

android: Check the existence of a file in the application

I have few html files in assets folder of my application. My application loads these files depending on the device language. When I check for the existance of the file it say does not exist, but when I load that file using browser.loadUrl(filename), it loads it fine.
Following code will help you to understand my problem:
 String filename="file:///android_asset/actualfilemname.html";  
 File f = new File(filename);  
 if(!f.exist){  
    filename = "file:///android_asset/newfile.html";[Everytime it loads this file even though I have actualfilename.html in the folder]  
 }  
 browser.loadUrl(filename);

[it loads the newfile.html but not actualfilename.html]

A:

You can't use File for resources. You'll need to use the AssetManager for that.
(In the off-chance that File does handle resources, which I don't think it does, you'll have to convert the path to a URI first, for example using URI.create(). File(String) expects a path, not a URI.)

