suchen

Heim  >  Fragen und Antworten  >  Hauptteil

android - okhttp问题

链接里有“[”或者“]”应用就会闪退,求解决方法....
源码:

OkHttpClient o=new OkHttpClient();
 Request r=new                Request.Builder().url("XXXXXXXX").build();
  o.newCall(r).enqueue(new Callback()
        {
            @Override
            public void onFailure(Request p1, IOException p2)
            {
                runOnUiThread(new Runnable()
                    {
                        @Override
                        public void run()
                        {

                        }
                    });
            }

            @Override
            public void onResponse(final Response p1)  throws IOException
            {
                final String res=p1.body().string();
                runOnUiThread(new Runnable()
                    {

                        @Override
                        public void run()
                        {
                            t.setText(res);
                        }
                    });

            }
        });
PHPzPHPz2773 Tage vor322

Antworte allen(1)Ich werde antworten

  • PHP中文网

    PHP中文网2017-04-17 18:02:00

    先url编码一下

    Antwort
    0
  • StornierenAntwort