Android - NullPointerException on ViewPager

view full story

http://stackoverflow.com – I am trying to create dialog with fragment but when I call the setAdapter method I have a Java NullPointerException, and I can't find the error. Java Code: public class MainActivity extends FragmentActivity { Context myContext; private MyAdapter mAdapter; private ViewPager mPager; String TAG = "Dialog"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); myContext = this; findViewById(R.id.button1).setOnClickListener(new OnClickListener() { @Override public v (HowTos)