Ho alcune cartelle con file HTML nella cartella "assets" nel mio progetto Android. Devo mostrare questi file HTML dalle sottocartelle delle risorse in un elenco. Ho già scritto del codice per creare questa lista.Elenco dei file nella cartella delle risorse e nelle relative sottocartelle
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);
}
});
che cos'è mContext? –
se si esegue questa operazione da un'attività o un servizio, quindi mContext = getApplicationContext(); o mContext = ActivityName.this; Inoltre puoi scartarlo. – Kammaar
È Oggetto contesto – Kammaar