首先抱歉我的英语不好。 我在android中有一个非常简单的应用程序。它有4个启动ListView的按钮。我想要做的是,当您按下列表项时,将打开一个新的布局,其中包含从Internet下载的图像。 我对最新的问题,获取列表中的每个项目以打开布局。
this is my class for control the list
public class precat extends ListActivity {
public static ImageView imageView;
EditText filterEditText;
//ulo contains my links
String[] urlo = {"links of my images"};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.precat);
imageView = (ImageView) findViewById(R.id.image_view);
String[] precat = getResources().getStringArray(R.array.precat);
final ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, precat);
setListAdapter(adapter);
filterEditText = (EditText) findViewById(R.id.filterText);
filterEditText.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before,
int count) {
adapter.getFilter().filter(s.toString());
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
}
@Override
public void afterTextChanged(Editable s) {
}
});
}
@Override
protected void onListItemClick(ListView listView, View view, int position,
long id) {
super.onListItemClick(listView, view, position, id);
Object o = getListAdapter().getItem(position);
String url = urlo[position];
//This method show the image. And for now it works XD
Main.downloadFile(imageView, url);
}
}
precat.xml is my xml file that contains the ListView an a ImageView to prove that I can see the image.
so... What can i do?