如何在资源文件夹下的文件中的android? [英] How to access file under assets folder in android?
本文介绍了如何在资源文件夹下的文件中的android?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我们浏览,我们发现有一个名为一个文件夹assets.Now我想programatically.so访问该文件夹,我应该如何进行的,任何APK?(输入程序将apk文件/只应用程序的名称)。
When we browse any apk we found there is one folder named assets.Now i want to access that folder programatically.so how should i proceed for that?(input for the program will be apk file/just app name).
推荐答案
如果你想从资产的文件夹中使用文件的访问以下code:
If you want access file from assets folder use following code:
InputStream is = getAssets().open("contacts.csv");
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpGet httpGet = new HttpGet(is);
HttpContext localContext = new BasicHttpContext();
HttpResponse response =httpClient.execute(httpGet, localContext);
BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
这篇关于如何在资源文件夹下的文件中的android?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文