I called the fragements as
List fragments = new Vector();
fragments.add(Fragment.instantiate(context, Frag
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:
View v = inflater.inflate(R.layout.fragment1, container, false);
btn = (ImageButton) v.findViewById(R.id.btn);
btn.setOnTouchListener(new OnTouchListener() {}
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.