imageview from url
<p>I use many ways of external imageview from url. but all the time activity stopped unfortunately. Do you know thats why. I have internet perimision in manifest file. But I could not solve it. is anyone can help me. ?</p>

<p>I use this ways in the link. but not working in my project. 
<a href="http://stackoverflow.com/questions/2989077/how-to-display-external-image-in-android">how to display external image in android?</a></p>

<pre><code>        public class MainActivity extends Activity{
            ImageView imgView;
            EditText inputUrl;
            OnClickListener getImageBtnOnClick = new OnClickListener() {
                public void onClick(View view) {
                    Context context = view.getContext();
                    Editable ed = inputUrl.getText();
                    Drawable image = ImageOperations(context,"http://www.cssnz.org/flower.jpg" ,"image.jpg");

                    imgView = (ImageView)findViewById(R.id.i1);
                    imgView.setImageDrawable(image);
                }
            };

            public void onCreate(Bundle icicle) {
                super.onCreate(icicle);
                setContentView(R.layout.activity_main);
                inputUrl = ((EditText)findViewById(R.id.imageURL));
                inputUrl.setSingleLine();
                inputUrl.setTextSize(11);
                Button getImageButton = (Button)findViewById(R.id.getImageButton);
                getImageButton.setOnClickListener(getImageBtnOnClick);

            }   

            private Drawable ImageOperations(Context ctx, String url, String saveFilename) {
                try {
                    InputStream is = (InputStream) this.fetch(url);
                    Drawable d = Drawable.createFromStream(is, "src");
                    return d;
                } catch (MalformedURLException e) {
                    e.printStackTrace();
                    return null;
                } catch (IOException e) {
                    e.printStackTrace();
                    return null;
                }
            }

            public Object fetch(String address) throws MalformedURLException,IOException {
                URL url = new URL(address);
                Object content = url.getContent();
                return content;
            }
        }
    xml file
    &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent" &gt;

        &lt;Button
            android:id="@+id/getImageButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="39dp"
            android:layout_marginTop="22dp" /&gt;

        &lt;ImageView
            android:id="@+id/i1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="106dp"
            android:src="@drawable/ic_action_search" /&gt;

        &lt;EditText
            android:id="@+id/imageURL"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ems="10" &gt;

            &lt;requestFocus /&gt;
        &lt;/EditText&gt;

    &lt;/LinearLayout&gt;


    android.manifest  

    &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.example.externalimageview"
        android:versionCode="1"
        android:versionName="1.0" &gt;

        &lt;uses-sdk
            android:minSdkVersion="8"
            android:targetSdkVersion="15" /&gt;
        &lt;uses-permission android:name="android.permission.INTERNET"/&gt;

        &lt;application
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
            android:theme="@style/AppTheme" &gt;
            &lt;activity
                android:name=".MainActivity"
                android:label="@string/title_activity_main" &gt;
                &lt;intent-filter&gt;
                    &lt;action android:name="android.intent.action.MAIN" /&gt;

                    &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
                &lt;/intent-filter&gt;
            &lt;/activity&gt;
        &lt;/application&gt;

    &lt;/manifest&gt;

log cat
09-14 19:56:31.409: W/dalvikvm(1097): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
09-14 19:56:31.459: E/AndroidRuntime(1097): FATAL EXCEPTION: main
09-14 19:56:31.459: E/AndroidRuntime(1097): android.os.NetworkOnMainThreadException
09-14 19:56:31.459: E/AndroidRuntime(1097):     at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1099)
09-14 19:56:31.459: E/AndroidRuntime(1097):     at java.net.InetAddress.lookupHostByName(InetAddress.java:391)
09-14 19:56:31.459: E/AndroidRuntime(1097):     at java.net.InetAddress.getAllByNameImpl(InetAddress.java:242)
09-14 19:56:31.459: E/AndroidRuntime(1097):     at java.net.InetAddress.getAllByName(InetAddress.java:220)
09-14 19:56:31.459: E/AndroidRuntime(1097):     at libcore.net.http.HttpConnection.&lt;init&gt;(HttpConnection.java:71)
09-14 19:56:31.459: E/AndroidRuntime(1097):     at libcore.net.http.HttpConnection.&lt;init&gt;(HttpConnection.java:50)
09-14 19:56:31.459: E/AndroidRuntime(1097):     at libcore.net.http.HttpConnection$Address.connect(HttpConnection.java:351)
09-14 19:56:31.459: E/AndroidRuntime(1097):     at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:86)
09-14 19:56:31.459: E/AndroidRuntime(1097):     at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
09-14 19:56:31.459: E/AndroidRuntime(1097):     at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:308)
09-14 19:56:31.459: E/AndroidRuntime(1097):     at libcore.net.http.HttpEngine.connect(HttpEngine.java:303)
09-14 19:56:31.459: E/AndroidRuntime(1097):     at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:282)
09-14 19:56:31.459: E/AndroidRuntime(1097):     at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:232)
09-14 19:56:31.459: E/AndroidRuntime(1097):     at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:80)
09-14 19:56:31.459: E/AndroidRuntime(1097):     at java.net.URLConnection.getContent(URLConnection.java:194)
09-14 19:56:31.459: E/AndroidRuntime(1097):     at java.net.URL.getContent(URL.java:447)
09-14 19:56:31.459: E/AndroidRuntime(1097):     at com.example.externalimageview.MainActivity.fetch(MainActivity.java:61)
09-14 19:56:31.459: E/AndroidRuntime(1097):     at com.example.externalimageview.MainActivity.ImageOperations(MainActivity.java:47)
09-14 19:56:31.459: E/AndroidRuntime(1097):     at com.example.externalimageview.MainActivity.access$0(MainActivity.java:45)
09-14 19:56:31.459: E/AndroidRuntime(1097):     at com.example.externalimageview.MainActivity$1.onClick(MainActivity.java:27)
09-14 19:56:31.459: E/AndroidRuntime(1097):     at android.view.View.performClick(View.java:3511)
09-14 19:56:31.459: E/AndroidRuntime(1097):     at android.view.View$PerformClick.run(View.java:14105)
09-14 19:56:31.459: E/AndroidRuntime(1097):     at android.os.Handler.handleCallback(Handler.java:605)
09-14 19:56:31.459: E/AndroidRuntime(1097):     at android.os.Handler.dispatchMessage(Handler.java:92)
09-14 19:56:31.459: E/AndroidRuntime(1097):     at android.os.Looper.loop(Looper.java:137)
09-14 19:56:31.459: E/AndroidRuntime(1097):     at android.app.ActivityThread.main(ActivityThread.java:4424)
09-14 19:56:31.459: E/AndroidRuntime(1097):     at java.lang.reflect.Method.invokeNative(Native Method)
09-14 19:56:31.459: E/AndroidRuntime(1097):     at java.lang.reflect.Method.invoke(Method.java:511)
09-14 19:56:31.459: E/AndroidRuntime(1097):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
09-14 19:56:31.459: E/AndroidRuntime(1097):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
09-14 19:56:31.459: E/AndroidRuntime(1097):     at dalvik.system.NativeStart.main(Native Method)
</code></pre>
