Adding Fragment to back stack (getting a blank screen on back press)
<p>I have two fragments, first is called Summer Jobs Fragment which contains a list of items and the second is called Summer Jobs Details Frgment which contains a the details of each item. Im trying to set back trace so that when I press the back button from Summer Jobs Detail Fragment I go back to Summer Jobs Fragment.</p>

<p>here is my code for the initial transition from SJF to SJDF:</p>

<pre><code>public void onItemClick(
                    AdapterView&lt;?&gt;parent,View view, int position, long id) {

                SummerJobDetailsFragment.mMyAppsBundle.
                        putInt("value", position);
                SummerJobDetailsFragment fragment =
                        new SummerJobDetailsFragment();
                FragmentManager fragmentManager =
                        getFragmentManager();
                list.setVisibility(parent.INVISIBLE);
                fragmentManager.beginTransaction().replace(R.id.displayjobs_detailed, fragment).
                        addToBackStack( "tag" ).commit();

            }
</code></pre>

<p>and here is how I modified the OnBackPressed() in the main:</p>

<pre><code>public void onBackPressed() {
        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        if (getFragmentManager().getBackStackEntryCount() &gt; 0 ) {
            getFragmentManager().popBackStack();

        } else {
            super.onBackPressed();

        }
    }
</code></pre>

<p>But when I press the back key from SJDF I get a blank screen :</p>

<p><a href="https://i.stack.imgur.com/dEZ9Z.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dEZ9Z.jpg" alt="list view details"></a>
<a href="https://i.stack.imgur.com/59pIu.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/59pIu.jpg" alt="After back is pressed"></a></p>