MainActivity shows a viewpager so there are 3 layout files:activity_main.xml、card1.xml and card2.xml Now I want to get view from card1.xml and set the listener. what should I do?
I tried using this:
LayoutInflater layout=this.getLayoutInflater();
View view=layout.inflate(R.layout.card1, null);
Button b=(Button)view.findViewById(R.id.b);
then set OnClickListener:
b.setOnClickListener(new MyClickListener(0));
but useless.