0

This is my problem : Im trying to read a HTML file from asset folder but
i've got this error :

 file:/android_asset/Tuberculin.html: open failed: ENOENT (No such file or directory)

In my class am extending BaseAdapter

public class medic_ListViewAdapter extends BaseAdapter {

and this is my code :

String   path = "file:///android_asset/Tuberculin.html";
   final Scanner scanner= new Scanner(new File(path));
    int i =0;
    while (scanner.hasNextLine()) {
        i++;
         String lineFromFile = scanner.nextLine();

        if(lineFromFile.toLowerCase(Locale.getDefault()).contains(search)) {
            String a= String.valueOf(i);

            // a match!
            yes=true;
            scanner.close();
            break;
        }

    }

    scanner.close();

Is there a way to read asset files without extending activity ?

Jam msi
  • 23
  • 2
  • You can still use `AssetManager`. Just pass a `Context` into your adapter. – 323go Oct 21 '15 at 03:46
  • Possible duplicate of [Android access to resources outside of activity](http://stackoverflow.com/questions/10081339/android-access-to-resources-outside-of-activity) – Hungry Coder Oct 21 '15 at 03:55

0 Answers0