How to use server data in MaterialViewPager?
<p>I use this library. <strong>com.github.florent37:materialviewpager:1.1.3@aar</strong>
How to use data that come from server in MaterialViewPager? Here, Kitchen", "Pork", "Fish", "Soup" are static, I want to change data that come from server; api. </p>

<pre><code>mViewPager.getViewPager().setAdapter(new FragmentStatePagerAdapter(getSupportFragmentManager()) {

        String[] categories = new String[]{"Kitchen", "Pork", "Fish", "Soup"}; // static, wanna come from server

        @Override
        public Fragment getItem(int position) {
            switch (position % 4) {

                default:
                    return RecyclerViewFragment.newInstance();
            }
        }

        @Override
        public int getCount() {
            return categories.length;
        }

        @Override
        public CharSequence getPageTitle(int position) {
            return categories[position];
        }
    });
</code></pre>

<p>Here, retrofit; data come from server;</p>

<pre><code>NetworkEngine.getInstance().getFoodCategory(new Callback&lt;FoodCategory&gt;() {

        @Override
        public void success(FoodCategory foodCategory, Response response) {
        }

        @Override
        public void failure(RetrofitError error) {
        }
    });
</code></pre>

<p>here, api</p>

<pre><code>[
  {
    "id": 1,
    "name": "Sea Foods",
    "description": "-",
    "icon": "photo_20160503084933_277342661make_money.png",
    "background": "photo_20160503084933_754915524make_money.png",
    "color": "#000FFF",
    "created_at": "2016-05-03 08:48:01",
    "updated_at": "2016-05-03 08:49:33",
    "deleted_at": null
  }
]
</code></pre>

<p>FoodCategory.java</p>

<pre><code>public class FoodCategory implements Serializable{

    @SerializedName("id")
    @Expose
    private Integer id;
    @SerializedName("name")
    @Expose
    private String name;
    @SerializedName("description")
    @Expose
    private String description;
    @SerializedName("icon")
    @Expose
    private String icon;
    @SerializedName("background")
    @Expose
    private String background;
    @SerializedName("color")
    @Expose
    private String color;
    @SerializedName("created_at")
    @Expose
    private String createdAt;
    @SerializedName("updated_at")
    @Expose
    private String updatedAt;
    @SerializedName("deleted_at")
    @Expose
    private Object deletedAt;

    /**
     * @return The id
     */
    public Integer getId() {
        return id;
    }

    /**
     * @param id The id
     */
    public void setId(Integer id) {
        this.id = id;
    }

    /**
     * @return The name
     */
    public String getName() {
        return name;
    }

    /**
     * @param name The name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return The description
     */
    public String getDescription() {
        return description;
    }

    /**
     * @param description The description
     */
    public void setDescription(String description) {
        this.description = description;
    }

    /**
     * @return The icon
     */
    public String getIcon() {
        return icon;
    }

    /**
     * @param icon The icon
     */
    public void setIcon(String icon) {
        this.icon = icon;
    }

    /**
     * @return The background
     */
    public String getBackground() {
        return background;
    }

    /**
     * @param background The background
     */
    public void setBackground(String background) {
        this.background = background;
    }

    /**
     * @return The color
     */
    public String getColor() {
        return color;
    }

    /**
     * @param color The color
     */
    public void setColor(String color) {
        this.color = color;
    }

    /**
     * @return The createdAt
     */
    public String getCreatedAt() {
        return createdAt;
    }

    /**
     * @param createdAt The created_at
     */
    public void setCreatedAt(String createdAt) {
        this.createdAt = createdAt;
    }

    /**
     * @return The updatedAt
     */
    public String getUpdatedAt() {
        return updatedAt;
    }

    /**
     * @param updatedAt The updated_at
     */
    public void setUpdatedAt(String updatedAt) {
        this.updatedAt = updatedAt;
    }

    /**
     * @return The deletedAt
     */
    public Object getDeletedAt() {
        return deletedAt;
    }

    /**
     * @param deletedAt The deleted_at
     */
    public void setDeletedAt(Object deletedAt) {
        this.deletedAt = deletedAt;
    }

}
</code></pre>