java - Android/OkHttp Get source code -


i want source code of page, "http://wankil.fr/dons", , print in textview, nothing printed don't know why, need please.

on code, want name of donater, , comment of every donation. information in code source nothing printed on textview test, don't understand why...

public class main extends actionbaractivity { private listview                        vue; private vector<vector<string>>          listdons = new vector<vector<string>>(); private list<hashmap<string, string>>   listhash = new arraylist<hashmap<string, string>>(); private url                             url; private okhttpclient                    client = new okhttpclient();  public void oncreate(bundle savedinstancestate) {     try {         super.oncreate(savedinstancestate);         setcontentview(r.layout.activity_main);         vue = (listview) findviewbyid(r.id.listview);         this.createnewdonation("raphael t.", "vous etes trop fort");         toast.maketext(this, "mystring", toast.length_short).show();         listadapter adapter = new simpleadapter(this,                 listhash,                 android.r.layout.simple_list_item_2,                 new string[]{"text1", "text2"},                 new int[]{android.r.id.text1, android.r.id.text2});         vue.setadapter(adapter);     } catch (exception e) {         e.printstacktrace(system.err);     } }  public string run(string url) throws ioexception {     request request = new request.builder()             .url(url)             .build();      response response = client.newcall(request).execute();     return response.body().string(); }  public boolean isonline() {     connectivitymanager cm =             (connectivitymanager) getsystemservice(context.connectivity_service);     networkinfo netinfo = cm.getactivenetworkinfo();     log.d("isonline", "i'm in");     return netinfo != null && netinfo.isconnectedorconnecting(); }  public void printtext(view v) {     try {         log.d("here", "i'm in");         if (this.isonline() == true) {             log.d("status:", "i'm online");             string str;             str = this.run("http://wankil.fr/dons");             textview textview = (textview) findviewbyid(r.id.textview);             textview.settext(str);             //this.createnewdonation(str.substring(0, 10), str.substring(10, 20));         } else             log.d("status:", "i'm not online");     } catch (exception e) {         e.printstacktrace();     } } @override public boolean oncreateoptionsmenu(menu menu) {     getmenuinflater().inflate(r.menu.menu_main, menu);     return true; }  @override public boolean onoptionsitemselected(menuitem item) {     int id = item.getitemid();     if (id == r.id.action_settings) {         return true;     }     return super.onoptionsitemselected(item); }  public void     createnewdonation(string text1, string text2){     try {         stringbuilder newdons = new stringbuilder();         vector<string> tmp = new vector<string>();         hashmap<string, string> element = new hashmap<>();          tmp.add(text1);         tmp.add(text2);         listdons.add(tmp);         element.put("text1", listdons.get(0).get(0));         element.put("text2", listdons.get(0).get(1));         listhash.add(element);     } catch (exception e) {         e.printstacktrace(system.err);     } } 

}

error:

07-11 15:49:48.696    8109-8109/com.dot.wankilapp w/system.err﹕ android.os.networkonmainthreadexception 07-11 15:49:48.696    8109-8109/com.dot.wankilapp w/system.err﹕ @ android.os.strictmode$androidblockguardpolicy.onnetwork(strictmode.java:1147) 07-11 15:49:48.696    8109-8109/com.dot.wankilapp w/system.err﹕ @ java.net.inetaddress.lookuphostbyname(inetaddress.java:418) 07-11 15:49:48.696    8109-8109/com.dot.wankilapp w/system.err﹕ @ java.net.inetaddress.getallbynameimpl(inetaddress.java:252) 07-11 15:49:48.696    8109-8109/com.dot.wankilapp w/system.err﹕ @ java.net.inetaddress.getallbyname(inetaddress.java:215) 07-11 15:49:48.696    8109-8109/com.dot.wankilapp w/system.err﹕ @ com.squareup.okhttp.internal.network$1.resolveinetaddresses(network.java:29) 07-11 15:49:48.696    8109-8109/com.dot.wankilapp w/system.err﹕ @ com.squareup.okhttp.internal.http.routeselector.resetnextinetsocketaddress(routeselector.java:188) 07-11 15:49:48.696    8109-8109/com.dot.wankilapp w/system.err﹕ @ com.squareup.okhttp.internal.http.routeselector.nextproxy(routeselector.java:157) 07-11 15:49:48.696    8109-8109/com.dot.wankilapp w/system.err﹕ @ com.squareup.okhttp.internal.http.routeselector.next(routeselector.java:100) 07-11 15:49:48.696    8109-8109/com.dot.wankilapp w/system.err﹕ @ com.squareup.okhttp.internal.http.httpengine.createnextconnection(httpengine.java:357) 07-11 15:49:48.696    8109-8109/com.dot.wankilapp w/system.err﹕ @ com.squareup.okhttp.internal.http.httpengine.nextconnection(httpengine.java:340) 07-11 15:49:48.696    8109-8109/com.dot.wankilapp w/system.err﹕ @ com.squareup.okhttp.internal.http.httpengine.connect(httpengine.java:330) 07-11 15:49:48.696    8109-8109/com.dot.wankilapp w/system.err﹕ @ com.squareup.okhttp.internal.http.httpengine.sendrequest(httpengine.java:248) 07-11 15:49:48.696    8109-8109/com.dot.wankilapp w/system.err﹕ @ com.squareup.okhttp.call.getresponse(call.java:273) 07-11 15:49:48.697    8109-8109/com.dot.wankilapp w/system.err﹕ @ com.squareup.okhttp.call$applicationinterceptorchain.proceed(call.java:230) 07-11 15:49:48.697    8109-8109/com.dot.wankilapp w/system.err﹕ @ com.squareup.okhttp.call.getresponsewithinterceptorchain(call.java:201) 07-11 15:49:48.697    8109-8109/com.dot.wankilapp w/system.err﹕ @ com.squareup.okhttp.call.execute(call.java:81) 07-11 15:49:48.697    8109-8109/com.dot.wankilapp w/system.err﹕ @ com.dot.wankilapp.main.run(main.java:78) 07-11 15:49:48.697    8109-8109/com.dot.wankilapp w/system.err﹕ @ com.dot.wankilapp.main.printtext(main.java:96) 07-11 15:49:48.697    8109-8109/com.dot.wankilapp w/system.err﹕ @ java.lang.reflect.method.invoke(native method) 07-11 15:49:48.697    8109-8109/com.dot.wankilapp w/system.err﹕ @ java.lang.reflect.method.invoke(method.java:372) 07-11 15:49:48.697    8109-8109/com.dot.wankilapp w/system.err﹕ @ android.view.view$1.onclick(view.java:4015) 07-11 15:49:48.697    8109-8109/com.dot.wankilapp w/system.err﹕ @ android.view.view.performclick(view.java:4780) 07-11 15:49:48.697    8109-8109/com.dot.wankilapp w/system.err﹕ @ android.view.view$performclick.run(view.java:19866) 07-11 15:49:48.697    8109-8109/com.dot.wankilapp w/system.err﹕ @ android.os.handler.handlecallback(handler.java:739) 07-11 15:49:48.697    8109-8109/com.dot.wankilapp w/system.err﹕ @ android.os.handler.dispatchmessage(handler.java:95) 07-11 15:49:48.697    8109-8109/com.dot.wankilapp w/system.err﹕ @ android.os.looper.loop(looper.java:135) 07-11 15:49:48.697    8109-8109/com.dot.wankilapp w/system.err﹕ @ android.app.activitythread.main(activitythread.java:5257) 07-11 15:49:48.697    8109-8109/com.dot.wankilapp w/system.err﹕ @ java.lang.reflect.method.invoke(native method) 07-11 15:49:48.697    8109-8109/com.dot.wankilapp w/system.err﹕ @ java.lang.reflect.method.invoke(method.java:372) 07-11 15:49:48.697    8109-8109/com.dot.wankilapp w/system.err﹕ @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:903) 07-11 15:49:48.697    8109-8109/com.dot.wankilapp w/system.err﹕ @ com.android.internal.os.zygoteinit.main(zygoteinit.java:698) 


Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -