1

I am attempting to create a progress bar spinner in my actionbar and getting an error when removing the spinner:

Here is my code

  public void setRefreshActionButtonState(final RefreshState state) {
    //new ActionButtonState(state).execute();
    if (optionsMenu != null) {
      final MenuItem refreshItem = optionsMenu
          .findItem(R.id.menuRefresh);
      if (refreshItem != null) {
        if (state == RefreshState.REFRESHING) {
          refreshItem.setActionView(R.layout.progress);
        } else if (state == RefreshState.SUBSCRIPTION_ACTIVE) {
          refreshItem.setActionView(null);
          refreshItem.setIcon(R.drawable.ic_subscription_on_48dp);
        } else {
          refreshItem.setActionView(null);
          refreshItem.setIcon(R.drawable.ic_subscription_off_48dp);
        }
      }
    }

  }

If I remove refreshItem.setActionView(null); or comment out the errors go away.

here is my progress.xml

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
             android:layout_height="wrap_content"
             android:layout_width="56dp"
             android:minWidth="56dp">
  <ProgressBar android:layout_width="32dp"
               android:layout_height="32dp"
               android:layout_gravity="center"
      android:id="@+id/refreshing_progress"/>
</FrameLayout>

I tried using an AsyncTask to do this as well and got the same errors.

I got my original tutorial from http://www.michenux.net/android-refresh-item-action-bar-circular-progressbar-578.html

slackwars
  • 504
  • 5
  • 18

1 Answers1

0

It turns out there was another process that I had in my application that corresponded to that sequence of events and as causing the issue.

slackwars
  • 504
  • 5
  • 18