Skip to content Skip to sidebar Skip to footer

Accessing Viewpager Child Elements For Clicking And Diplaying Another View Pager Elements In A Small Window

I called the fragements as List fragments = new Vector(); fragments.add(Fragment.instantiate(context, Fragment1.class.getName

Solution 1:

It looks like you are not completely understand the meaning of inflater.inflate, it was the same problem in your previous question.

When calling inflater.inflate it creat new View object from the xml you give it.

In this code:

Viewv= inflater.inflate(R.layout.fragment1, container, false);
btn = (ImageButton) v.findViewById(R.id.btn);
btn.setOnTouchListener(newOnTouchListener() {}

You created new view object, than you found it's button and add a touch listener event to it. Unless you are going to add this view to the fragment, the event will never fire.

I think what you meant to do is finding your view using findViewById() inside your fragment class.

Post a Comment for "Accessing Viewpager Child Elements For Clicking And Diplaying Another View Pager Elements In A Small Window"