In recent api get Renren. OpenUrl Util found under the procedure call () function will always pack IOException error. No detailed error information. Preliminary judgment is conn.connect () method is executed when the error
occurCode:
public static String openUrl (String url, String method, Bundle params) {
if (method.equals ("GET")) {
url = url + + encodeUrl (params) "?";
}
String response = "";
try {
URL urll = new URL (url);
URLConnection rulConnection = urll.openConnection ();
HttpURLConnection conn = (HttpURLConnection) rulConnection;
conn.setRequestProperty ("User-Agent", USER_AGENT_SDK);
if (method.equals ("POST")) {
conn.setDoOutput (true);
conn.setDoInput (true);
conn.setUseCaches (false);
conn.setRequestMethod ("POST");
conn.setConnectTimeout (5000);
conn.setInstanceFollowRedirects (true);
try {
conn.connect (); / / / ①
} Catch (Exception e) {
e.printStackTrace ();
}
/ / Try {
/ / Conn.getOutputStream () write (encodeUrl (params) getBytes ("UTF-8").);.
/ /} Catch (Exception e) {
/ / E.printStackTrace ();
/ /}
}
InputStream is = null;
int responseCode = conn.getResponseCode ();
if (responseCode == 200) {
is = conn.getInputStream ();
} Else {
is = conn.getErrorStream ();
}
response = read (is);
} Catch (Exception e) {
throw new RuntimeException (e.getMessage (), e);
}
return response;
}
In ① Department will throw IOException. Only: java.io.IOException. No detailed error information. Rookie I was very puzzled. Great God wanted to ask you, before you connect to what http headers to be set. Url for that network to provide everyone, I should be wrong.
Ask God to help solve big ah. .
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
Number two is good. No one can take their own points. .
Silly × a. After the 4.0 system which can not be done in the main thread and other network connections. The deal put Runnable inside it. But why a previously reported error is IOException it? Rookie understand. .
Reply:
I also tangled this, ask the landlord specifically how to solve.
new Thread (new Runnable () {
public void run () {
Looper.prepare ();
renren.authorize (
BindAccountActivity.this, null,
listener, 0);
Looper.loop ();
}
.}) Start ();
Still some problems when logging pop webwiew will print out some warnings circulating log
05-10 18:50:02.215: W / webview (26084): java.lang.Throwable: Warning:. A WebView method was called on thread 'Thread-1331' All WebView methods must be called on the UI thread Future versions. of WebView may not support use on other threads.
05-10 18:50:02.215: W / webview (26084): at android.webkit.WebView.checkThread (WebView.java: 13888)
05-10 18:50:02.215: W / webview (26084): at android.webkit.WebView.getSettings (WebView.java: 5337)
05-10 18:50:02.215: W / webview (26084): at android.webkit.WebView $ 10.run (WebView.java: 5380)
05-10 18:50:02.215: W / webview (26084): at android.os.Handler.handleCallback (Handler.java: 605)
05-10 18:50:02.215: W / webview (26084): at android.os.Handler.dispatchMessage (Handler.java: 92)
05-10 18:50:02.215: W / webview (26084): at android.os.Looper.loop (Looper.java: 137)
05-10 18:50:02.215: W / webview (26084): at com.hoperun.gymboree.more.BindAccountActivity $ 2 $ 1.run (BindAccountActivity.java: 83)
05-10 18:50:02.215: W / webview (26084): at java.lang.Thread.run (Thread.java: 856)
05-10 18:50:02.220: W / webview (26084): java.lang.Throwable: Warning:. A WebView method was called on thread 'Thread-1331' All WebView methods must be called on the UI thread Future versions. of WebView may not support use on other threads.
05-10 18:50:02.220: W / webview (26084): at android.webkit.WebView.checkThread (WebView.java: 13888)
05-10 18:50:02.220: W / webview (26084): at android.webkit.WebView.getSettings (WebView.java: 5337)
05-10 18:50:02.220: W / webview (26084): at android.webkit.WebView $ 10.run (WebView.java: 5380)
05-10 18:50:02.220: W / webview (26084): at android.os.Handler.handleCallback (Handler.java: 605)
05-10 18:50:02.220: W / webview (26084): at android.os.Handler.dispatchMessage (Handler.java: 92)
05-10 18:50:02.220: W / webview (26084): at android.os.Looper.loop (Looper.java: 137)
05-10 18:50:02.220: W / webview (26084): at com.hoperun.gymboree.more.BindAccountActivity $ 2 $ 1.run (BindAccountActivity.java: 83)
05-10 18:50:02.220: W / webview (26084): at java.lang.Thread.run (Thread.java: 856)
05-10 18:50:02.220: W / webview (26084): java.lang.Throwable: Warning:. A WebView method was called on thread 'Thread-1331' All WebView methods must be called on the UI thread Future versions. of WebView may not support use on other threads.
05-10 18:50:02.220: W / webview (26084): at android.webkit.WebView.checkThread (WebView.java: 13888)
05-10 18:50:02.220: W / webview (26084): at android.webkit.WebView.destroy (WebView.java: 2473)
05-10 18:50:02.220: W / webview (26084): at android.webkit.WebView $ 10.run (WebView.java: 5383)
05-10 18:50:02.220: W / webview (26084): at android.os.Handler.handleCallback (Handler.java: 605)
05-10 18:50:02.220: W / webview (26084): at android.os.Handler.dispatchMessage (Handler.java: 92)
05-10 18:50:02.220: W / webview (26084): at android.os.Looper.loop (Looper.java: 137)
05-10 18:50:02.220: W / webview (26084): at com.hoperun.gymboree.more.BindAccountActivity $ 2 $ 1.run (BindAccountActivity.java: 83)
05-10 18:50:02.220: W / webview (26084): at java.lang.Thread.run (Thread.java: 856)
Also Util.java file read method, the system will be more than 2.2 error, BufferedInputStream is closed, which is said to android2.3 and above versions of a bug, egg pain
Reply:

No comments:
Post a Comment