通过抓包获取内涵段子的接口

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_23195583/article/details/54287167

先声明,技术研究不涉及商业
本人喜欢看笑话和gif动图,内涵段子是个不错的选择,但是广告有点多,然后我就抓了一下他的接口
效果图:
图片太大,我放到github上了
https://github.com/1181631922/Recreation/blob/master/ScreenShots/videos1.gif
这是接口:

http://is.snssdk.com/neihan/stream/mix/v1/?mpic=1&webp=1&essence=1&content_type=-101&message_cursor=-1&longitude=116.4121485&latitude=39.9365054&am_longitude=116.41828&am_latitude=39.937848&am_city=%E5%8C%97%E4%BA%AC%E5%B8%82&am_loc_time=1483686438786&count=30&min_time=1483929653&screen_width=1080&iid=7164180604&device_id=34822199408&ac=wifi&channel=baidu&aid=7&app_name=joke_essay&version_code=590&version_name=5.9.0&device_platform=android&ssmix=a&device_type=Nexus%2B5&device_brand=google&os_api=25&os_version=7.1&uuid=359250050588035&openudid=12645e537a2f0f25&manifest_version_code=590&resolution=1080*1776&dpi=480&update_version_code=5903

接口用的get,我没有管header,但是请求成功了,说明没有在header中添加验证,只是上传了一些设备,地址信息,这里我自己看而已,然后就定死了,但是数据时随机的,然后多抓了几次,里面有个时间的参数是当前的秒,long类型的,每次传的时候获取一下时间就可以了,再看一下数据结构:

{
            "group": {
                "user": {
                    "user_id": 6151682767,
                    "name": "\u534e\u5357\u6c6a\u5bb6\u519b\u603b\u53f8\u4ee4",
                    "followings": 0,
                    "user_verified": false,
                    "ugc_count": 1,
                    "avatar_url": "http://p3.pstatp.com/thumb/ef40017ab932fec9852",
                    "followers": 10,
                    "is_following": false,
                    "is_pro_user": false
                },
                "text": "\u6211\u5973\u53cb\uff0c\u54c8\u54c8\uff0c\u5355\u8eab\u72d7\u4eec\uff0c\u5b64\u72ec\u7684\u6253\u98de\u673a\u53bb\u5427\u3002\u256d(\u256f\u03b5\u2570)\u256e",
                "neihan_hot_start_time": "00-00-00",
                "dislike_reason": [{
                    "type": 2,
                    "id": 10,
                    "title": "\u5427:\u7206\u7b11GIF"
                }, {
                    "type": 4,
                    "id": 0,
                    "title": "\u5185\u5bb9\u91cd\u590d"
                }, {
                    "type": 3,
                    "id": 6151682767,
                    "title": "\u4f5c\u8005:\u534e\u5357\u6c6a\u5bb6\u519b\u603b\u53f8\u4ee4"
                }],
                "create_time": 1483790338,
                "id": 53909265109,
                "favorite_count": 17,
                "go_detail_count": 4475,
                "user_favorite": 0,
                "share_type": 1,
                "max_screen_width_percent": 0.6,
                "is_can_share": 1,
                "comment_count": 259,
                "share_url": "http://m.neihanshequ.com/share/group/53909265109/?iid=7164180604&app=joke_essay",
                "label": 4,
                "content": "\u6211\u5973\u53cb\uff0c\u54c8\u54c8\uff0c\u5355\u8eab\u72d7\u4eec\uff0c\u5b64\u72ec\u7684\u6253\u98de\u673a\u53bb\u5427\u3002\u256d(\u256f\u03b5\u2570)\u256e",
                "category_type": 1,
                "id_str": "53909265109",
                "media_type": 2,
                "share_count": 318,
                "type": 3,
                "status": 102,
                "has_comments": 1,
                "large_image": {
                    "width": 480,
                    "r_height": 640,
                    "r_width": 480,
                    "url_list": [{
                        "url": "http://p3.pstatp.com/large/13b500030ca9e95eea99"
                    }, {
                        "url": "http://pb2.pstatp.com/large/13b500030ca9e95eea99"
                    }, {
                        "url": "http://pb3.pstatp.com/large/13b500030ca9e95eea99"
                    }],
                    "uri": "large/13b500030ca9e95eea99",
                    "height": 640
                },
                "user_bury": 0,
                "activity": {},
                "status_desc": "\u5df2\u53d1\u8868\uff0c\u7c89\u4e1d\u7b2c\u4e00\u65f6\u95f4\u53ef\u89c1",
                "quick_comment": false,
                "display_type": 0,
                "neihan_hot_end_time": "00-00-00",
                "is_gif": 1,
                "user_digg": 0,
                "online_time": 1483790338,
                "category_name": "\u7206\u7b11GIF",
                "category_visible": true,
                "bury_count": 131,
                "is_anonymous": false,
                "repin_count": 17,
                "min_screen_width_percent": 0.167,
                "is_neihan_hot": false,
                "digg_count": 542,
                "gifvideo": {
                    "360p_video": {
                        "width": 360,
                        "url_list": [{
                            "url": "http://ic.snssdk.com/neihan/video/playback/?video_id=090d865fd9e04043b4de2e0550798e56&quality=360p&line=0&is_gif=1"
                        }, {
                            "url": "http://ic.snssdk.com/neihan/video/playback/?video_id=090d865fd9e04043b4de2e0550798e56&quality=360p&line=1&is_gif=1"
                        }],
                        "uri": "360p/090d865fd9e04043b4de2e0550798e56",
                        "height": 480
                    },
                    "origin_video": {
                        "width": 360,
                        "url_list": [{
                            "url": "http://ic.snssdk.com/neihan/video/playback/?video_id=090d865fd9e04043b4de2e0550798e56&quality=origin&line=0&is_gif=1"
                        }, {
                            "url": "http://ic.snssdk.com/neihan/video/playback/?video_id=090d865fd9e04043b4de2e0550798e56&quality=origin&line=1&is_gif=1"
                        }],
                        "uri": "origin/090d865fd9e04043b4de2e0550798e56",
                        "height": 480
                    },
                    "720p_video": {
                        "width": 360,
                        "url_list": [{
                            "url": "http://ic.snssdk.com/neihan/video/playback/?video_id=090d865fd9e04043b4de2e0550798e56&quality=720p&line=0&is_gif=1"
                        }, {
                            "url": "http://ic.snssdk.com/neihan/video/playback/?video_id=090d865fd9e04043b4de2e0550798e56&quality=720p&line=1&is_gif=1"
                        }],
                        "uri": "720p/090d865fd9e04043b4de2e0550798e56",
                        "height": 480
                    },
                    "mp4_url": "http://ic.snssdk.com/neihan/video/playback/?video_id=090d865fd9e04043b4de2e0550798e56&quality=480p&line=0&is_gif=1.mp4",
                    "video_height": 480,
                    "480p_video": {
                        "width": 360,
                        "url_list": [{
                            "url": "http://ic.snssdk.com/neihan/video/playback/?video_id=090d865fd9e04043b4de2e0550798e56&quality=480p&line=0&is_gif=1"
                        }, {
                            "url": "http://ic.snssdk.com/neihan/video/playback/?video_id=090d865fd9e04043b4de2e0550798e56&quality=480p&line=1&is_gif=1"
                        }],
                        "uri": "480p/090d865fd9e04043b4de2e0550798e56",
                        "height": 480
                    },
                    "cover_image_uri": "14d80007227542782f3c",
                    "duration": 7.4,
                    "video_width": 360
                },
                "has_hot_comments": 1,
                "allow_dislike": true,
                "image_status": 1,
                "user_repin": 0,
                "neihan_hot_link": {},
                "group_id": 53909265109,
                "middle_image": {
                    "width": 480,
                    "r_height": 640,
                    "r_width": 480,
                    "url_list": [{
                        "url": "http://p3.pstatp.com/w480/13b500030ca9e95eea99.webp"
                    }, {
                        "url": "http://pb2.pstatp.com/w480/13b500030ca9e95eea99.webp"
                    }, {
                        "url": "http://pb3.pstatp.com/w480/13b500030ca9e95eea99.webp"
                    }],
                    "uri": "w480/13b500030ca9e95eea99",
                    "height": 640
                },
                "category_id": 10
            },
            "comments": [{
                "text": "\u770b\u7740\u5979\uff0c\u6211\u89c9\u5f97\u6211\u7684\u53f3\u624b\u90fd\u7709\u6e05\u76ee\u79c0\u7684",
                "create_time": 1483921038,
                "user_verified": false,
                "user_bury": 0,
                "user_id": 6223077938,
                "bury_count": 0,
                "share_url": "http://m.neihanshequ.com/share/group/53909265109/?comment_id=53999432007",
                "id": 53999432007,
                "platform": "feifei",
                "is_digg": 0,
                "user_name": "\u767d\u9a6c\u975e\u9a6c\u5357\u67ef\u4e00\u68a6",
                "user_profile_image_url": "http://p1.pstatp.com/thumb/ef60017cce705ef7697",
                "status": 5,
                "description": "",
                "user_digg": 0,
                "user_profile_url": "",
                "share_type": 1,
                "digg_count": 1453,
                "is_pro_user": false,
                "platform_id": "feifei",
                "avatar_url": "http://p1.pstatp.com/thumb/ef60017cce705ef7697",
                "group_id": 53909265109
            }],
            "type": 1,
            "display_time": 1483929654,
            "online_time": 1483929654
        }

这里只是列出了单个item,进行相应的处理就可以了,里面有图片,问题,还有视频,我的里面暂时没有加视频,以后会考虑的。
这里写图片描述
然后看一下代码结构:
bean,代码中加了相应的注释

package com.fanyafeng.recreation.bean;

import android.os.Parcel;
import android.os.Parcelable;

import com.fanyafeng.recreation.util.StringUtil;

import org.json.JSONObject;


public class MainItemBean implements Parcelable {

    private String title;   //title有可能为空
    private String image;   //http://p3.pstatp.com/需要加此前缀
    private long id;        //id
    private String content; //text 有就显示没有就不显示
    private String mp4Url;  //mp4_url

    public MainItemBean(JSONObject jsonObject) {
        JSONObject group = jsonObject.optJSONObject("group");
        setContent("此处为广告,已为您过滤");
        if (group != null) {
            setTitle(group.optString("title"));
            setId(group.optLong("id"));
            setContent(group.optString("content"));

            if (!StringUtil.isNullOrEmpty(group.optString("mp4_url"))) {
                setMp4Url(group.optString("mp4_url"));
            }
            JSONObject gifvideo = group.optJSONObject("gifvideo");
            if (gifvideo != null) {
                setMp4Url(group.optString("mp4_url"));
            }

            JSONObject middle_image = group.optJSONObject("middle_image");
            if (middle_image != null) {
                setImage("http://p3.pstatp.com/" + middle_image.optString("uri"));
            }
            JSONObject large_image = group.optJSONObject("large_image");
            if (large_image != null) {
                setImage("http://p3.pstatp.com/" + large_image.optString("uri"));
            }
        }
    }


    protected MainItemBean(Parcel in) {
        title = in.readString();
        image = in.readString();
        id = in.readLong();
        content = in.readString();
        mp4Url = in.readString();
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(title);
        dest.writeString(image);
        dest.writeLong(id);
        dest.writeString(content);
        dest.writeString(mp4Url);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<MainItemBean> CREATOR = new Creator<MainItemBean>() {
        @Override
        public MainItemBean createFromParcel(Parcel in) {
            return new MainItemBean(in);
        }

        @Override
        public MainItemBean[] newArray(int size) {
            return new MainItemBean[size];
        }
    };

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getMp4Url() {
        return mp4Url;
    }

    public void setMp4Url(String mp4Url) {
        this.mp4Url = mp4Url;
    }

    @Override
    public String toString() {
        return "MainItemBean{" +
                "title='" + title + '\'' +
                ", image='" + image + '\'' +
                ", id=" + id +
                ", content='" + content + '\'' +
                ", mp4Url='" + mp4Url + '\'' +
                '}';
    }
}

adapter:

package com.fanyafeng.recreation.adapter;

import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.facebook.drawee.view.SimpleDraweeView;
import com.fanyafeng.recreation.R;
import com.fanyafeng.recreation.activity.PreviewActivity;
import com.fanyafeng.recreation.bean.MainItemBean;
import com.fanyafeng.recreation.network.Urls;
import com.fanyafeng.recreation.refreshview.recyclerview.BaseRecyclerAdapter;
import com.fanyafeng.recreation.util.ControllerListenerUtil;
import com.fanyafeng.recreation.util.DpPxConvert;
import com.fanyafeng.recreation.util.MyUtils;
import com.fanyafeng.recreation.util.StringUtil;

import java.util.ArrayList;
import java.util.List;

/**
 * Author: fanyafeng
 * Data: 16/11/9 14:52
 * Email: fanyafeng@live.cn
 */
public class MainAdapter extends BaseRecyclerAdapter<MainAdapter.MainViewHolder> {

    private Context context;
    private List<MainItemBean> mainItemBeanList;

    public MainAdapter(Context context, List<MainItemBean> mainItemBeanList) {
        this.context = context;
        this.mainItemBeanList = mainItemBeanList;
    }

    @Override
    public MainViewHolder getViewHolder(View view) {
        return new MainViewHolder(view);
    }

    @Override
    public MainViewHolder onCreateViewHolder(ViewGroup parent, int viewType, boolean isItem) {
        View view = LayoutInflater.from(context).inflate(R.layout.item_main_layout, parent, false);
        return new MainViewHolder(view);
    }

    @Override
    public void onBindViewHolder(MainViewHolder holder, int position, boolean isItem) {
        MainViewHolder mainViewHolder = holder;
        final MainItemBean mainItemBean = mainItemBeanList.get(position);
        mainViewHolder.tvMainItem.setText(mainItemBean.getContent());
        mainViewHolder.sdvMainItem.setVisibility(View.GONE);
        if (!StringUtil.isNullOrEmpty(mainItemBean.getImage())) {
            mainViewHolder.sdvMainItem.setVisibility(View.VISIBLE);
            final String img = mainItemBean.getImage();
            ControllerListenerUtil.setControllerListener(mainViewHolder.sdvMainItem, img,
                    (int) (MyUtils.getScreenWidth(context) - DpPxConvert.dip2px(context, 60)));
            mainViewHolder.sdvMainItem.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    ArrayList<String> list = new ArrayList<String>();
                    list.add(img + mainItemBean.getImage());
                    Intent intent = new Intent(context, PreviewActivity.class);
                    intent.putStringArrayListExtra("list", list);
                    context.startActivity(intent);
                }
            });
        } else {
            mainViewHolder.sdvMainItem.setVisibility(View.GONE);
        }
    }

    @Override
    public int getAdapterItemCount() {
        return mainItemBeanList.size();
    }

    class MainViewHolder extends RecyclerView.ViewHolder {

        TextView tvMainItem;
        SimpleDraweeView sdvMainItem;

        public MainViewHolder(View itemView) {
            super(itemView);
            tvMainItem = (TextView) itemView.findViewById(R.id.tvMainItem);
            sdvMainItem = (SimpleDraweeView) itemView.findViewById(R.id.sdvMainItem);
        }
    }
}

fragment:

package com.fanyafeng.recreation.fragment;

import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.Nullable;
import android.support.design.widget.FloatingActionButton;
import android.support.v4.app.Fragment;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.Toolbar;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Toast;

import com.fanyafeng.recreation.R;
import com.fanyafeng.recreation.adapter.MainAdapter;
import com.fanyafeng.recreation.bean.MainItemBean;
import com.fanyafeng.recreation.network.NetUtil;
import com.fanyafeng.recreation.network.Urls;
import com.fanyafeng.recreation.refreshview.XRefreshView;
import com.fanyafeng.recreation.refreshview.XRefreshViewFooter;
import com.fanyafeng.recreation.util.StringUtil;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;

public class OneFragment extends BaseFragment {
    private Toolbar toolbar_one;

    private RecyclerView rvMain;
    private XRefreshView refreshMain;
    private List<MainItemBean> mainItemBeanList = new ArrayList<>();
    private MainAdapter mainAdapter;

    private FloatingActionButton fabMainToTop;

    private FragmentDialogInterface fragmentDialogInterface;

    public OneFragment() {
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_one, container, false);
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        initView();
        initData();
    }

    private void initView() {
        toolbar_one = (Toolbar) getActivity().findViewById(R.id.toolbar_one);
        toolbar_one.setTitle(getString(R.string.app_name));
        toolbar_one.setLogo(R.drawable.simle_logo_01);

        rvMain = (RecyclerView) getActivity().findViewById(R.id.rvMain);
        rvMain.setLayoutManager(new GridLayoutManager(getActivity(), GridLayoutManager.VERTICAL, 1, false));

        refreshMain = (XRefreshView) getActivity().findViewById(R.id.refreshMain);
        refreshMain.setPullLoadEnable(true);
        refreshMain.setAutoLoadMore(true);

        fabMainToTop = (FloatingActionButton) getActivity().findViewById(R.id.fabMainToTop);

        Log.d("time", "当前时间戳" + Integer.parseInt(getVersion(getActivity()).replace(".", "")));
        getVersion(getActivity()).replace(".", "");


    }

    public static String getVersion(Context context)//获取版本号
    {
        try {
            PackageInfo pi = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
            return pi.versionName;
        } catch (PackageManager.NameNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
            return context.getString(R.string.version_unknown);
        }
    }

    private void initData() {
        loadData();

        mainAdapter = new MainAdapter(getActivity(), mainItemBeanList);
        mainAdapter.setCustomLoadMoreView(new XRefreshViewFooter(getActivity()));
        rvMain.setAdapter(mainAdapter);

        refreshMain.setXRefreshViewListener(new XRefreshView.SimpleXRefreshListener() {
            @Override
            public void onRefresh() {
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        refreshData();
                    }
                }, 1000);
            }

            @Override
            public void onLoadMore(boolean isSilence) {
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        loadMoreData();
                    }
                }, 1000);
            }
        });

        fabMainToTop.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                new Handler().postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        if (mainItemBeanList.size() > 0)
                            rvMain.smoothScrollToPosition(0);
                    }
                }, 200);

            }
        });
    }

    private void refreshData() {
        new AsyncTask<String, String, String>() {
            @Override
            protected void onPreExecute() {
                super.onPreExecute();
            }

            @Override
            protected void onPostExecute(String s) {
                super.onPostExecute(s);
                mainItemBeanList.clear();
                refreshMain.stopRefresh();
                try {
                    if (!StringUtil.isNullOrEmpty(s)) {
                        JSONObject jsonObject = new JSONObject(s);
                        if (jsonObject != null) {
                            String message = jsonObject.optString("message");//判断请求状态
                            if (message.equals("success")) {
                                JSONObject data = jsonObject.optJSONObject("data");
                                if (data != null) {
                                    JSONArray dataArray = data.optJSONArray("data");
                                    int dataLength = dataArray.length();
                                    for (int i = 0; i < dataLength; i++) {
                                        MainItemBean mainItemBean = new MainItemBean(dataArray.optJSONObject(i));
                                        mainItemBeanList.add(mainItemBean);
                                    }
                                    mainAdapter.notifyDataSetChanged();
                                    return;
                                }
                            }
                        }
                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                }
                Toast.makeText(getActivity(), "数据加载失败", Toast.LENGTH_SHORT).show();

            }

            @Override
            protected String doInBackground(String... params) {
                return NetUtil.httpGetUtil(getActivity(), Urls.GET_ARTICLE_LIST + System.currentTimeMillis() / 1000 + Urls.GET_ARTICLE_LIST_END);
            }
        }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    }

    private void loadMoreData() {
        new AsyncTask<String, String, String>() {
            @Override
            protected void onPreExecute() {
                super.onPreExecute();
            }

            @Override
            protected void onPostExecute(String s) {
                super.onPostExecute(s);
                try {
                    if (!StringUtil.isNullOrEmpty(s)) {
                        JSONObject jsonObject = new JSONObject(s);
                        if (jsonObject != null) {
                            String message = jsonObject.optString("message");//判断请求状态
                            if (message.equals("success")) {
                                JSONObject data = jsonObject.optJSONObject("data");
                                if (data != null) {
                                    JSONArray dataArray = data.optJSONArray("data");
                                    int dataLength = dataArray.length();
                                    for (int i = 0; i < dataLength; i++) {
                                        MainItemBean mainItemBean = new MainItemBean(dataArray.optJSONObject(i));
                                        mainItemBeanList.add(mainItemBean);
                                    }
                                    mainAdapter.notifyDataSetChanged();
                                    refreshMain.stopLoadMore();
                                    return;
                                }
                            }
                        }
                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                }
                Toast.makeText(getActivity(), "数据加载失败", Toast.LENGTH_SHORT).show();
            }

            @Override
            protected String doInBackground(String... params) {
                return NetUtil.httpGetUtil(getActivity(), Urls.GET_ARTICLE_LIST + System.currentTimeMillis() / 1000 + Urls.GET_ARTICLE_LIST_END);
            }
        }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    }


    private void loadData() {
        new AsyncTask<String, String, String>() {
            @Override
            protected void onPreExecute() {
                super.onPreExecute();
            }

            @Override
            protected void onPostExecute(String s) {
                super.onPostExecute(s);
                try {
                    if (!StringUtil.isNullOrEmpty(s)) {
                        JSONObject jsonObject = new JSONObject(s);
                        if (jsonObject != null) {
                            String message = jsonObject.optString("message");//判断请求状态
                            if (message.equals("success")) {
                                JSONObject data = jsonObject.optJSONObject("data");
                                if (data != null) {
                                    JSONArray dataArray = data.optJSONArray("data");
                                    int dataLength = dataArray.length();
                                    for (int i = 0; i < dataLength; i++) {
                                        MainItemBean mainItemBean = new MainItemBean(dataArray.optJSONObject(i));
                                        mainItemBeanList.add(mainItemBean);
                                    }
                                    mainAdapter.notifyDataSetChanged();
                                    return;
                                }
                            }
                        }
                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                }
                Toast.makeText(getActivity(), "数据加载失败", Toast.LENGTH_SHORT).show();
            }

            @Override
            protected String doInBackground(String... params) {
                return NetUtil.httpGetUtil(getActivity(), Urls.GET_ARTICLE_LIST + System.currentTimeMillis() / 1000 + Urls.GET_ARTICLE_LIST_END);
            }
        }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    }

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        try {
            fragmentDialogInterface = (FragmentDialogInterface) context;
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页