まず、私の下手な英語で申し訳ありません。私はアンドロイドで非常に単純なアプリケーションを持っています。ListView を開始する 4 つのボタンがあります。私がやりたいことは、リスト項目を押すと、インターネットからダウンロードされた画像を持つ新しいレイアウトを開くことです。最新の問題は、リスト内の各アイテムを取得してレイアウトを開くことです。
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?