Android 프로젝트의 "assets"폴더에 HTML 파일이있는 폴더가 있습니다. 애셋의 하위 폴더에있는 HTML 파일을 목록에 표시해야합니다. 이미이 목록을 작성하는 것에 대한 몇 가지 코드를 작성했습니다.assets 폴더 및 하위 폴더에있는 파일 목록
lv1 = (ListView) findViewById(R.id.listView);
// Insert array in ListView
// In the next row I need to insert an array of strings of file names
// so please, tell me, how to get this array
lv1.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, filel));
lv1.setTextFilterEnabled(true);
// onclick items in ListView:
lv1.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> a, View v, int position, long id) {
//Clicked item position
String itemname = new Integer(position).toString();
Intent intent = new Intent();
intent.setClass(DrugList.this, Web.class);
Bundle b = new Bundle();
//I don't know what it's doing here
b.putString("defStrID", itemname);
intent.putExtras(b);
//start Intent
startActivity(intent);
}
});
mContext는 무엇입니까? –
활동 또는 서비스에서이 작업을 수행하는 경우 mContext = getApplicationContext(); 또는 mContext = ActivityName.this; 또한 버릴 수도 있습니다. – Kammaar
이것은 Context 객체입니다 – Kammaar