Fragments won't show up in activity extending ActionBarActivity <p>I have a main activity extending ActionBarActivity. In my activity i create a fragment which isn't showing up. I modified the main activity to extend FragmentActivity and in this case the fragment is showing up. Why isn't the fragment showing up when my activity extends ActionBarActivity? I know that ActionBarActivity extends FragmentActivity so in theory ActionBarActivity should support fragments.</p> <p><strong>Edit: I resolved it. I wouldn't set any content view on my activity. Now that i set it it works when i extend ActionBarActivity. Still is weird that even if i don't set it, when i extend FragmentActivity it works.</strong></p> <p>This is my main activity code:</p> <pre><code>package com.example.yamba; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; //import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentTransaction; public class StatusActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if(savedInstanceState == null) { StatusFragment fragment = new StatusFragment(); FragmentTransaction fr = getSupportFragmentManager().beginTransaction(); fr.add(android.R.id.content, fragment); fr.commit(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.status, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } } </code></pre> <p>This is my fragment code:</p> <pre><code>package com.example.yamba; import android.graphics.Color; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; import android.widget.EditText; import android.widget.Toast; import android.os.AsyncTask; import android.text.TextWatcher; import android.text.Editable; import android.view.LayoutInflater; import android.view.ViewGroup; import android.support.v4.app.Fragment; import com.marakana.android.yamba.clientlib.YambaClient; import com.marakana.android.yamba.clientlib.YambaClientException; public class StatusFragment extends Fragment implements OnClickListener { private static final String TAG = "StatusFragment"; private EditText editStatus; private Button buttonTweet; private TextView textCount; private int defaultColor; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreate(savedInstanceState); View view = inflater.inflate(R.layout.activity_fragment, container, false); editStatus = (EditText) view.findViewById (R.id.editStatus); buttonTweet = (Button) view.findViewById (R.id.buttonTweet); textCount = (TextView) view.findViewById (R.id.textCount); buttonTweet.setOnClickListener(this); defaultColor = textCount.getTextColors().getDefaultColor(); editStatus.addTextChangedListener(new TextWatcher() { public void afterTextChanged (Editable s) { int count = 140 - editStatus.length(); textCount.setText(Integer.toString(count)); textCount.setTextColor(Color.GREEN); if(count&lt;20 &amp;&amp; count &gt;= 10) textCount.setTextColor(Color.YELLOW); else if (count&lt;10) textCount.setTextColor(Color.RED); else textCount.setTextColor(defaultColor); } public void beforeTextChanged(CharSequence s, int start, int count, int after){} public void onTextChanged (CharSequence s, int start, int b, int c){} }); return view; } public void onClick(View view) { String status = editStatus.getText().toString(); Log.d(TAG, "onClicked with status: " + status); new PostTask().execute(status); editStatus.getText().clear(); } private final class PostTask extends AsyncTask&lt;String, Void, String&gt; { protected String doInBackground(String... params) { YambaClient yambaCloud = new YambaClient("student", "password"); try { yambaCloud.postStatus(params[0]); return "Succesfuly posted!"; } catch (YambaClientException e) { e.printStackTrace(); return "Failed to post to yamba sevice!"; } } @Override protected void onPostExecute (String result) { super.onPostExecute(result); Toast.makeText(StatusFragment.this.getActivity(), result, Toast.LENGTH_LONG).show(); } } } </code></pre>