Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: Weird openStream on 4.0 ICS
    primarykey
    data
    text
    <p>I try to get text from website that I show in a textview.</p> <p>I Use:</p> <pre><code>try { textUrl = new URL("http://google.com"); BufferedReader bufferReader = new BufferedReader(new InputStreamReader(textUrl.openStream())); String StringBuffer; String stringText = ""; while ((StringBuffer = bufferReader.readLine()) != null) { stringText += StringBuffer; } bufferReader.close(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } </code></pre> <p>if I set <code>&lt;uses-sdk android:targetSdkVersion&gt;</code> to 15 (ICS 4.0.3) then my app crashes. if I delete that line ( means that target is 1.6 I guess) then it works fine but my app is scales weird on my phone.</p> <p>Logcat just tells me that it cannot start Activity.</p> <p>//Pew Labs</p> <p>LOG:</p> <pre><code>03-21 17:12:42.874: E/AndroidRuntime(2101): at android.widget.TabHost$IntentContentStrategy.getContentView(TabHost.java:703) 03-21 17:12:42.874: E/AndroidRuntime(2101): at android.widget.TabHost.setCurrentTab(TabHost.java:350) 03-21 17:12:42.874: E/AndroidRuntime(2101): at android.widget.TabHost$2.onTabSelectionChanged(TabHost.java:154) 03-21 17:12:42.874: E/AndroidRuntime(2101): at android.widget.TabWidget$TabClickListener.onClick(TabWidget.java:540) 03-21 17:12:42.874: E/AndroidRuntime(2101): at android.view.View.performClick(View.java:3549) 03-21 17:12:42.874: E/AndroidRuntime(2101): at android.view.View$PerformClick.run(View.java:14400) 03-21 17:12:42.874: E/AndroidRuntime(2101): at android.os.Handler.handleCallback(Handler.java:605) 03-21 17:12:42.874: E/AndroidRuntime(2101): at android.os.Handler.dispatchMessage(Handler.java:92) 03-21 17:12:42.874: E/AndroidRuntime(2101): at android.os.Looper.loop(Looper.java:154) 03-21 17:12:42.874: E/AndroidRuntime(2101): at android.app.ActivityThread.main(ActivityThread.java:4944) 03-21 17:12:42.874: E/AndroidRuntime(2101): at java.lang.reflect.Method.invokeNative(Native Method) 03-21 17:12:42.874: E/AndroidRuntime(2101): at java.lang.reflect.Method.invoke(Method.java:511) 03-21 17:12:42.874: E/AndroidRuntime(2101): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784) 03-21 17:12:42.874: E/AndroidRuntime(2101): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551) 03-21 17:12:42.874: E/AndroidRuntime(2101): at dalvik.system.NativeStart.main(Native Method) 03-21 17:12:42.874: E/AndroidRuntime(2101): Caused by: android.os.NetworkOnMainThreadException 03-21 17:12:42.874: E/AndroidRuntime(2101): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1178) 03-21 17:12:42.874: E/AndroidRuntime(2101): at java.net.InetAddress.lookupHostByName(InetAddress.java:394) 03-21 17:12:42.874: E/AndroidRuntime(2101): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:245) 03-21 17:12:42.874: E/AndroidRuntime(2101): at java.net.InetAddress.getAllByName(InetAddress.java:220) 03-21 17:12:42.874: E/AndroidRuntime(2101): at libcore.net.http.HttpConnection.&lt;init&gt;(HttpConnection.java:71) 03-21 17:12:42.874: E/AndroidRuntime(2101): at libcore.net.http.HttpConnection.&lt;init&gt;(HttpConnection.java:50) 03-21 17:12:42.874: E/AndroidRuntime(2101): at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:351) 03-21 17:12:42.874: E/AndroidRuntime(2101): at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:86) 03-21 17:12:42.874: E/AndroidRuntime(2101): at libcore.net.http.HttpConnection.connect(HttpConnection.java:128) 03-21 17:12:42.874: E/AndroidRuntime(2101): at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:308) 03-21 17:12:42.874: E/AndroidRuntime(2101): at libcore.net.http.HttpEngine.connect(HttpEngine.java:303) 03-21 17:12:42.874: E/AndroidRuntime(2101): at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:282) 03-21 17:12:42.874: E/AndroidRuntime(2101): at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:232) 03-21 17:12:42.874: E/AndroidRuntime(2101): at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:80) 03-21 17:12:42.874: E/AndroidRuntime(2101): at com.pewlabs.sunds.Food.downloadFile(Food.java:64) 03-21 17:12:42.874: E/AndroidRuntime(2101): at com.pewlabs.sunds.Food.onCreate(Food.java:45) 03-21 17:12:42.874: E/AndroidRuntime(2101): at android.app.Activity.performCreate(Activity.java:4524) 03-21 17:12:42.874: E/AndroidRuntime(2101): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1071) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload