title: Programmatically set ActionBarTab background color with tab selector line color at bottom with user chosen color in ActionBarTab?
body: <p>I want to change my ActionBar's Tabs background color with tabs selector line at bottom color.</p>
  
  <p>I want to do that by using java code not xml.</p>
  
  <p>I have tried creating ActionBar tabs ..</p>
  
  <pre><code>actionBar = getActionBar();
  
  
  // Hide the action bar title
             ActionBar actionBar.setDisplayShowTitleEnabled(false);
  
          // Enabling Spinner dropdown navigation
          actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
  
           ActionBar.Tab PlayerTab = actionBar.newTab().setText("Fragment A");
            ActionBar.Tab StationsTab = actionBar.newTab().setText("Fragment B");
  
            //create the two fragments we want to use for display content
           //////////////////////// Fragment PlayerFragment = new AFragment();
           /////////////////// Fragment StationsFragment = new BFragment();
  
            //set the Tab listener. Now we can listen for clicks.
            ///////////////////PlayerTab.setTabListener(new MyTabsListener(PlayerFragment));
           ///////////////// ////StationsTab.setTabListener(new MyTabsListener(StationsFragment));
  
            //add the two tabs to the actionbar
            actionBar.addTab(PlayerTab);
            actionBar.addTab(StationsTab);
  </code></pre>
  
  <p>Now when I try to set background color with tabs line selector color, I get the error <code>Java.lang.NullPointException</code></p>
  
  <p>My OnTabSelcted() method ..</p>
  
  <pre><code>@Override
  public void onTabSelected(Tab tab, FragmentTransaction ft) {
  // TODO Auto-generated method stub
  RelativeLayout tabLayout = (RelativeLayout) tab.getCustomView();
  
  //tab.setCustomView(getResources().getDrawable(R.drawable.tabs_selector_blue));
  
       System.out.println("Tab position is " +tab.getPosition());
       try{
       if(tab.getCustomView() == null){
  
  tabLayout.setBackgroundResource(TABS_BACKGROUND[tab.getPosition()]);
           tab.setCustomView(tabLayout);
       }else{
           Toast.makeText(getApplicationContext(), "check for tabs", Toast.LENGTH_SHORT).show();
       }
       }catch(Exception e){
           e.printStackTrace();
       }
  
  }
  </code></pre>
  
  <p>I have defined a custom selector for background and need to inflate it.</p>
  
  <p>I am getting on line <code>tabLayout.setBackgroundResource(TABS_BACKGROUND[tab.getPosition()]);</code></p>
  
  <p>Please let show me where's my error.</p>