0

my problem is connected with listviews. From Menu im going to first activity where I am able to click on item, what let's me go to secondary activity where I have second listview. My problem ocures there because I am unable to clikc anything in second activity apart from Back button. I have custom made adapter, but it's regular row list adapter. After clicking on item on secondary listview I want to go to next third activity. Is there any solution? Help please.

Adapter:

public class listviewAdapter4 extends BaseAdapter {
public ArrayList<Operation4> productList2;
Activity activity;
public listviewAdapter4(Activity activity,ArrayList<Operation4> productList2){
    super();
    this.activity = activity;
    this.productList2 = productList2;
}

@Override
public int getCount() {
    return productList2.size();
}

@Override
public Object getItem(int position) {
    return productList2.get(position);
}

@Override
public long getItemId(int position) {
    return position;
}
private class ViewHolder{
    Textviews...
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    LayoutInflater inflater = activity.getLayoutInflater();
    if (convertView == null) {
        convertView = inflater.inflate(R.layout.activity_listview_row4, null);
        holder = new ViewHolder();
        holders...
        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
    }
    Operation4 item = productList2.get(position);
    holders...
    return convertView;
}

Click listeners:

1)

   lvPositions.setOnItemClickListener(new AdapterView.OnItemClickListener () {
       @Override
       public void onItemClick(AdapterView<?> parent, View view, int position, long id) { /*code starting new activity */ }
   });
   lvPositions2.setOnItemClickListener(new AdapterView.OnItemClickListener () {
       @Override
       public void onItemClick(AdapterView<?> parent, View view, int position, long id) { /*code starting new activity */ }
   });
CoolMind
  • 26,736
  • 15
  • 188
  • 224
JohnBaron
  • 31
  • 4
  • Please, show an adapter. Where a click listener is bound? – CoolMind Jul 14 '21 at 08:50
  • @CoolMind done :D onItemClickListener is used in activity, by lvPostions.setOnItemClickListener... – JohnBaron Jul 14 '21 at 09:01
  • Thanks. Please, show click listener, see also https://stackoverflow.com/questions/7645880/listview-with-onitemclicklistener. – CoolMind Jul 14 '21 at 09:09
  • @CoolMind lvPositions.setOnItemClickListener(new AdapterView.OnItemClickListener() { @ Override public void onItemClick(AdapterView> parent, View view, int position, long id) { //code starting new activity } }); lvPositions2.setOnItemClickListener(new AdapterView.OnItemClickListener() { @ Override public void onItemClick(AdapterView> parent, View view, int position, long id) { //code starting new activity } }); – JohnBaron Jul 14 '21 at 09:26
  • @CoolMind first lvPositions is in first actvitiy, second one is in second activity. But second one doesn't work in my case. And blockDescedants also doesn't work. I'm not sure if i put it in right place, but It doesn't work – JohnBaron Jul 14 '21 at 09:34
  • If you didn't make a mistake (called required method, bound in right place, filled the adapter ans so on), there may be other problems discribed in that topic. First I thought you didn't bind item click listener in right place. – CoolMind Jul 14 '21 at 09:48
  • @CoolMind I setOnItemClickListener in OnCreate, after .setAdapter – JohnBaron Jul 14 '21 at 09:53
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/234851/discussion-between-johnbaron-and-coolmind). – JohnBaron Jul 14 '21 at 09:57

0 Answers0