1

I've been struggling to get an inflate button to work. Here's the code:

LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);

View editBtn = layoutInflater.inflate(R.layout.list_item, null);
Button editTaskBtn = (Button) editBtn.findViewById(R.id.editTaskbutton);
editTaskBtn.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        Intent intent1 = new Intent(v.getContext(), Activity8.class);
        startActivityForResult(intent1,0);
    }
});

Any ideas on how to get the button to work?

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Kyle Barry
  • 44
  • 1
  • 6
  • It is unclear where you have the button... It is attached to some view? You do inflate the view, but without adding it to some other view, then how to do you expect to click it? Can you provide a [mcve]? – OneCricketeer May 10 '16 at 19:36

0 Answers0