I believe you should not call startActivity() in onClick.
Instead, when user click on the button, notify the FragmentActivity containing this fragment. Inside the FragmentActivity, call ViewPager.setCurrentItem(position), where position is an int. The view pager will then scroll to the desired tab.
I am not sure if this is the best way to do it. But I tried this before and it works.
Add a function in your FragmentActivity, which is used to scroll to the desired tab.
public static void scroll(int pos){
mViewPager.setCurrentItem(pos); //mViewPager is the ViewPager you have in FragmentActivity
}
And this is the onClickListener
Button btn = (Button) v.findViewById(R.id.u1);
btn.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
//when button clicked, call the scroll function
MainActivity.scroll(position_of_unsafe1); //MainActivity is the FragmentActivity name
}
});