如何通過列表視圖圖像我有問題的代碼:通過另一項活動
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = getLayoutInflater();
View row = inflater.inflate(R.layout.row, parent, false);
TextView textview = (TextView) row.findViewById(R.id.tvTop);
ImageView imageview = (ImageView) row.findViewById(R.id.list_image);
textview.setText(data_topText[position]);
imageview.setImageResource(data_image[position]);
row.setOnClickListener(new OnClickListener() {
public void onClick(View row) {
TextView textview = (TextView) row.findViewById(R.id.tvTop);
ImageView imageview = (ImageView) row.findViewById(R.id.list_image);
String product = textview.getText().toString();
int images = imageview.getId();
Intent i = new Intent(getApplicationContext(),
SecondScreenActivity.class);
i.putExtra("name", product);
i.putExtra("zurag", images);
startActivity(i);
贏得的傳球圖像另一項活動。 SecondScreenActivity.java:
TextView txtName = (TextView) findViewById(R.id.txtName);
ImageView images = (ImageView) findViewById(R.id.image);
Intent intent = getIntent();
String name = intent.getStringExtra("name");
int pic =intent.getIntExtra("zurag", 0);
txtName.setText(name);
images.setImageResource(pic);
}
使用自定義適配器的設置和獲取文本和圖像... – NagarjunaReddy
是的,這是我的customadapter – user1303250
我們點擊列表視圖圖像相同圖像和文字顯示在下一個活動.....? – NagarjunaReddy