title: ActionBar - PullToRefresh Implement Programatically without using Styles
body: <p>Currently I am using Styles.xml combined with java code for defining the PullToRefresh customisations. I want to do all the customisations only through java code, rather than defining them in XML. Can I implement all the customisations programatically?</p>
  
  <p>Here is my xml customisation:</p>
  
  <pre><code>&lt;!-- PullToRefresh Customizations --&gt;
  &lt;style name="Theme.Holo.CustomPtrHeader" parent="Theme.Sherlock"&gt;
      &lt;item name="ptrHeaderStyle"&gt;@style/Widget.Custom.PtrHeader&lt;/item&gt;
  &lt;/style&gt;
  
  &lt;style name="Widget.Custom.PtrHeader" parent="android:Widget"&gt;
  
      &lt;!-- The background of the header view --&gt;
      &lt;item name="ptrHeaderBackground"&gt;#FF69B4&lt;/item&gt;
  
      &lt;!-- Color to tint the progress bar --&gt;
      &lt;item name="ptrProgressBarColor"&gt;#FF69B4&lt;/item&gt;
  
      &lt;!-- The strings to be displayed at the various states --&gt;
      &lt;item name="ptrPullText"&gt;Pull To Refresh&lt;/item&gt;
      &lt;item name="ptrRefreshingText"&gt;Refreshing News&lt;/item&gt;
      &lt;item name="ptrReleaseText"&gt;Loading...&lt;/item&gt;
  &lt;/style&gt;
  </code></pre>
  
  <p>Java code:</p>
  
  <pre><code>@Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
      super.onViewCreated(view, savedInstanceState);
      ViewGroup viewGroup = (ViewGroup) view;
  
      mPullToRefreshLayout = new PullToRefreshLayout(activity);
      ActionBarPullToRefresh
              .from(activity)
              .insertLayoutInto(viewGroup)
              .theseChildrenArePullable(R.id.gridview_news_grid,
                      android.R.id.empty).listener(this)
              .setup(mPullToRefreshLayout);
  }
  
  
  @Override
  public void onRefreshStarted(View view) {
  
      if (Const.DEBUGGING)
          Log.d(Const.DEBUG, "PullToRefresh Started");
  
      gridview.setVisibility(View.INVISIBLE);
  
      new AsyncTask&lt;Void, Void, Void&gt;() {
  
          @Override
          protected Void doInBackground(Void... params) {
              getDataFromServer();
              return null;
          }
  
          @Override
          protected void onPostExecute(Void result) {
              super.onPostExecute(result);
  
              mPullToRefreshLayout.setRefreshComplete();
              if (getView() != null) {
                  gridview.setVisibility(View.VISIBLE);
              }
          }
      }.execute();
  }
  </code></pre>
  
  <p>I think i can use Options() for doing this, but not sure how to do it correctly. Can someone help me out regarding this.</p>