In your onClick method, you are passing false as last parameter to inflate. This prevents the inflated layout from being attached to the root. Try passing true as last parameter, as shown below:
public void onClick(View v) {
if(v.getId() == R.id.button1)
{
mainLayout.removeAllViews();
main_inflater.inflate(R.layout.viewpager_layout, mainLayout, true);
}
if(v.getId() == R.id.button2)
{
mainLayout.removeAllViews();
main_inflater.inflate(R.layout.person_info, mainLayout, true);
}
Toast.makeText(getBaseContext() , "id : "+v.getId() ,Toast.LENGTH_SHORT ).show();
}