开发者

Android Assets - Unable to access

开发者 https://www.devze.com 2023-01-03 13:42 出处:网络
Using this code it should return a list of the assets. But it crashes, with a \"Source not found, Edit Source Lookup Path...\" message in the debugger when I call the list method:

Using this code it should return a list of the assets. But it crashes, with a "Source not found, Edit Source Lookup Path..." message in the debugger when I call the list method:

    @Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
开发者_如何学Go    setContentView(R.layout.main);

    AssetManager assets = this.getAssets();
    try { 
         //error happens on this next line
        String[] l = assets.list(null);
    } catch (IOException e) {

    }

}


Use this instead:

String[] arr = getAssets().list("");


Try passing a path to AssetManager#list(String) instead of null.

0

精彩评论

暂无评论...
验证码 换一张
取 消