I'm still getting NPE but now it's from my onCreate(). When I remove the buttons everything works fine though.Here are the XML(each table rows are from separate XMLs): \[code\]<TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="50dp" > <Button android:id="@+id/doneP1" android:layout_width="50dp" android:layout_height="wrap_content" android:text="Done" /> <Button android:id="@+id/resetP1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Reset" /> </TableRow><TableRow android:id="@+id/tableRow1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="50dp" > <Button android:id="@+id/doneP2" android:layout_width="50dp" android:layout_height="wrap_content" android:text="Done" /> <Button android:id="@+id/resetP2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Reset" /> </TableRow>\[/code\]Here's the code: \[code\]@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.tictactoegame); /*doneP1 = (Button) this.findViewById(R.id.doneP1); doneP2 = (Button) this.findViewById(R.id.doneP2); resetP1 = (Button) this.findViewById(R.id.resetP1); resetP2 = (Button) this.findViewById(R.id.resetP2); checkTurn(); //starts the game //buttons doneP1.setOnClickListener(this); doneP2.setOnClickListener(this); resetP1.setOnClickListener(this); resetP2.setOnClickListener(this);*/ //commented out }\[/code\]and outside the onCreate\[code\]@Overridepublic void onClick(View v) { switch(v.getId()) { case R.id.doneP1: checkTurn(); break; case R.id.doneP2: checkTurn(); break; case R.id.resetP1: break; case R.id.resetP2: break; }}\[/code\]here is the checkturn\[code\]public void checkTurn() { if(turn == 1) { changeLayout(turn); turn = 2; } else { changeLayout(turn); turn = 1; } }\[/code\]here is the changelayout(EDIT: new changeLayout, I just reinitialized each buttons inside the method but still no effect, am I doing it right?)\[code\]public void changeLayout(int turn){ FragmentManager fm = getSupportFragmentManager(); Fragment fragment = fm.findFragmentById(R.id.fragment_container); FragmentTransaction ft; if(turn == 1) //if its player 1's turn { doneP1 = (Button) this.findViewById(R.id.doneP1); resetP1 = (Button) this.findViewById(R.id.resetP1); doneP1.setOnClickListener(this); resetP1.setOnClickListener(this); if(fragment == null) //checks wether the current framelayout contains a fragment or not { ft = fm.beginTransaction(); ft.add(R.id.fragment_container, new PlayerTurn1()); ft.commit(); //setPlayer1(); } else { ft = fm.beginTransaction(); ft.replace(R.id.fragment_container, new PlayerTurn1()); ft.commit(); } } else { doneP2 = (Button) this.findViewById(R.id.doneP2); resetP2 = (Button) this.findViewById(R.id.resetP2); doneP2.setOnClickListener(this); resetP2.setOnClickListener(this); if(fragment == null) { ft = fm.beginTransaction();; ft.add(R.id.fragment_container, new PlayerTurn2()); ft.commit(); //setPlayer2(); } else { ft = fm.beginTransaction();; ft.replace(R.id.fragment_container, new PlayerTurn2()); ft.commit(); } }}\[/code\]and here's the logcat\[quote\] 03-24 07:51:55.954: E/AndroidRuntime(5092): Caused by: java.lang.NullPointerException 03-24 07:51:55.954: E/AndroidRuntime(5092): at As2.packageTK.TicTacToeGame.onCreate(TicTacToeGame.java:88)\[/quote\]line 88 is:\[code\]doneP1.setOnClickListener(this);\[/code\]I've been working on this for about 4 hours now and I still can't fix a simple problem. My head is drooling and I'm really tired, I want to fix this before I go to sleep so I'll appreciate a fast response. I cleaned and rebuilt my problem... nothing. Everything seems fine but no... NPE always has to bust in.