android - okhttp问题
PHPz
PHPz 2017-04-17 18:00:00
0
1
318

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

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);
                        }
                    });

            }
        });
PHPz
PHPz

学习是最好的投资!

Antworte allen(1)
Ty80

先url编码一下

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage