|
1 package org.hedgewars.hedgeroid.Downloader; |
|
2 |
|
3 import android.app.ListActivity; |
|
4 import android.os.Bundle; |
|
5 import android.view.View; |
|
6 import android.widget.AdapterView; |
|
7 import android.widget.AdapterView.OnItemClickListener; |
|
8 import android.widget.ArrayAdapter; |
|
9 |
|
10 public class DownloadListActivity extends ListActivity implements OnItemClickListener{ |
|
11 |
|
12 |
|
13 public void onCreate(Bundle savedInstanceState){ |
|
14 super.onCreate(savedInstanceState); |
|
15 |
|
16 DownloadTask[] tasks = new DownloadTask[3]; |
|
17 tasks[0] = new DownloadTask("url1", "/home/path/1", 1, "entry 1"); |
|
18 tasks[1] = new DownloadTask("url2", "/home/path/2", 1, "entry 2"); |
|
19 tasks[2] = new DownloadTask("url3", "/home/path/3", 1, "entry 3"); |
|
20 |
|
21 ArrayAdapter<DownloadTask> adapter = new ArrayAdapter<DownloadTask>(this, android.R.layout.simple_list_item_1, tasks); |
|
22 this.setListAdapter(adapter); |
|
23 this.getListView().setOnItemClickListener(this); |
|
24 |
|
25 } |
|
26 |
|
27 public void onItemClick(AdapterView<?> arg0, View arg1, int position, long arg3) { |
|
28 DownloadTask task = (DownloadTask)arg0.getAdapter().getItem(position); |
|
29 } |
|
30 |
|
31 // public static class Dialog extends DialogFragment{ |
|
32 |
|
33 // } |
|
34 |
|
35 } |
|
36 |