我是安卓新手。我正在显示具有单击事件的列表视图。当我单击任何行时,它会转到 ext 活动。当我按下返回按钮时,我遇到了问题,列表视图不再可点击。我在标签组下有这个逻辑。谁能解释一下怎么做?
public class MyCustomAdapter extends BaseAdapter {
String[] data_text;
int[] data_image;
int k;
MyCustomAdapter(String[] text, int[] image) {
data_text = data_text;
data_image = data_image;
}
MyCustomAdapter(ArrayList text, ArrayList image) {
data_text = new String[text.size()];
data_image = new int[image.size()];
for (int i = 0; i < text.size(); i++) {
System.out.println("In adapter2");
data_text[i] = text.get(i).toString();
data_image[i] = (Integer) image.get(i);
Log.e("",data_image[i]+"");
}
}
public int getCount()
{
return data_text.length;
}
public String getItem(int position)
{
return null;
}
public long getItemId(int position)
{
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
LayoutInflater inflater = getLayoutInflater();
View row;
row = inflater.inflate(R.layout.list_item_review, parent, false);
TextView textview = (TextView) row.findViewById(R.id.TextView01);
ImageView imageview = (ImageView) row.findViewById(R.id.ImageView01);
textview.setText(data_text[position]);
imageview.setImageResource(data_image[position]);
return (row);
}
@Override
public void notifyDataSetChanged() {
// TODO Auto-generated method stub
super.notifyDataSetChanged();
}
}
这是点击代码
listview.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View v1,int position, long id) {
Intent i = new Intent(ReviewTab.this, ReviewDetail.class);
View view = ReviewTabGroup.group.getLocalActivityManager().startActivity("com.MyITAssessment.ApplicationCodes.ReviewDetail",i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)).getDecorView();
ReviewTabGroup.group.replaceView(view);
}
});