lunes, 23 de septiembre de 2013

Show ActionBar items within fragments

To enable OnCreateOptionsMenu, onPrepareOptionsMenu, onOptionsItemSelected, in fragment, you have to call setHasOptionsMenu within the fragment’s onCreate() method:
setHasOptionsMenu(true);

martes, 3 de septiembre de 2013

ProgressBar in ActionBar

For using the indeterminate progress bar in the actionbar, just a few steps:

Put requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); before setContentView();

@Override
protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 
 requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
 setContentView(R.layout.extern_main);
}


and use the function setProgressBarIndeterminateVisibility(true); for start the spining and setProgressBarIndeterminateVisibility(false); to stop