OkHTTP代码无法正常工作

时间:2015-02-19 21:15:47

标签: java android okhttp

我的MainActivity类下有当前的内容,我看不出为什么s和post会返回错误?

public class MainActivity extends ActionBarActivity {


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        new AsyncTask<String, Integer, String> (){

            @Override
            protected String doInBackground(String... params) {
                // TODO Auto-generated method stub
                try {
                    OkHttpClient client = new OkHttpClient();
                    s = post("https://raw.github.com/square/okhttp/master/README.md","");
                } catch (Exception e) {
                    // TODO: handle exception
                    e.printStackTrace();
                }
                return null;
            }

            @Override
            protected void onPostExecute(String result) {
                super.onPostExecute(result);
                Log.e("ANSWER", "" + s);

我不确定为什么它不起作用

0 个答案:

没有答案