Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Only call onCreateOptionsMenu() in the main activity (I mean Sliding fragment activity).No need of calling onCreateOptionsMenu() from every fragment.I am giving a sample snippet below.</p> <pre><code>Call from fragment (whenerver loading starts and end) yourSlidingFragmnetActivity.refresh = true/false; (u can have this logic of your own) getActivity().supportInvalidateOptionsMenu(); @Override public boolean onCreateOptionsMenu(Menu menu) { menu.add(BaseListActivity.DEFAULT_GROUP_ID, BaseListActivity.MENU_ITEM_RELOAD_LIST, BaseListActivity.DEFAULT_ORDER, "Refresh").setIcon(R.drawable.ic_menu_refresh_new) .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.getItemId() == BaseListActivity.MENU_ITEM_RELOAD_LIST) { item.setActionView(R.layout.progressbar_layout); item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS); return true; } return true; } public static boolean refresh = false; @Override public boolean onPrepareOptionsMenu(Menu menu) { MenuItem item = menu.getItem(0); if (refresh) { item.setActionView(R.layout.progressbar_layout); } else { item.setIcon(R.drawable.ic_menu_refresh_new); } return true; } R.layout.progressbar_layout: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:addStatesFromChildren="true" android:focusable="true" android:paddingLeft="4dp" android:paddingRight="4dp" android:gravity="center" style="?attr/actionButtonStyle"&gt; &lt;ProgressBar android:layout_width="wrap_content" android:layout_height="wrap_content" android:focusable="true" style="@android:style/Widget.ProgressBar.Small"/&gt; &lt;/LinearLayout&gt; </code></pre> <p>I am also using jfeinstein10 slidingmenu lib , I am not adding or removing fragments , I am always replace them and in oncreate menthod iam using like this</p> <pre><code>private Fragment mContent; if(mContent == null){ mContent = new SampleFragment(); } // set the Above View setContentView(R.layout.content_frame); getSupportFragmentManager() .beginTransaction() .replace(R.id.content_frame,mContent) .commit(); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload