title: add the item from json feed to action bar spinner
body: <p>I have a problem on action bar spinner. I have successfully created the spinner by adding the item from static array.</p>
  
  <p>Now I want to add dynamic item to the spinner from json feed instead of this   . </p>
  
  <p>I can add the static item from array to spinner, but dont know how to add the item to spinner that i am getting from json feed. I have successfully downloaded the json but problem is this how to add this downloaded json to spinner.</p>
  
  <p>Please give some help.</p>
  
  <p><strong>MainActivity</strong></p>
  
  <pre><code>public class MainActivity extends Activity implements
          ActionBar.OnNavigationListener {
  
  
      private ActionBar actionBar;
  
  
      private ArrayList&lt;SpinnerNavItem&gt; navSpinner;
  
  
      private TitleNavigationAdapter adapter;
  
      public MenuItem refreshMenuItem;
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
          StrictMode.setThreadPolicy(policy); 
  
          setContentView(R.layout.activity_main);
  
          actionBar = getActionBar();
  
  
          actionBar.setDisplayShowTitleEnabled(false);
  
  
          actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
  
          navSpinner = new ArrayList&lt;SpinnerNavItem&gt;();
          navSpinner.add(new SpinnerNavItem("News", R.string.color));
          navSpinner.add(new SpinnerNavItem("nate", R.string.color));
          navSpinner.add(new SpinnerNavItem("Home", R.string.color));
          navSpinner.add(new SpinnerNavItem("Admin", R.string.color));
          navSpinner.add(new SpinnerNavItem("Pol", R.string.color));
          navSpinner.add(new SpinnerNavItem("Sunday", R.string.color));
  
  
          adapter = new TitleNavigationAdapter(getApplicationContext(),
                  navSpinner);
  
  
          actionBar.setListNavigationCallbacks(adapter, this);
  
  
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          MenuInflater inflater = getMenuInflater();
          inflater.inflate(R.menu.activity_main_actions, menu);
  
          return super.onCreateOptionsMenu(menu);
      }
  
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
  
          switch (item.getItemId()) {
  
          case R.id.refresh:
              // refresh
              refreshMenuItem = item;
  
  
  
              new SyncData().execute();
              return true;
  
          default:
              return super.onOptionsItemSelected(item);
          }
      }
  
  
      @Override
      public boolean onNavigationItemSelected(int itemPosition, long itemId) {
          // Action to be taken after selecting a spinner item
          if (itemPosition == 1) {
              Intent i = new Intent(getApplicationContext(),Test.class);
              startActivity(i);
  
          }
          return true;
      }
  
  
      public class SyncData extends AsyncTask&lt;String, Void, String&gt; {
          @Override
          protected void onPreExecute() {
              // set the progress bar view
  
              refreshMenuItem.expandActionView();
  
          }
  
          @Override
          protected String doInBackground(String... params) {
  
              try {
                  Thread.sleep(1000);
              } catch (InterruptedException e) {
                  e.printStackTrace();
              }
              return null;
          }
  
          @Override
          protected void onPostExecute(String result) {
              refreshMenuItem.collapseActionView();
              // remove the progress bar view
              refreshMenuItem.setActionView(null);
          }
      };
  
  
  }
  </code></pre>
  
  <p>Thanks in advance.</p>