ȸ¿ø°¡ÀԡžÆÀ̵ð/ºñ¹øã±â
ȨÀ¸·Î

[Source] À̹ÌÁöÆÄÀÏ ´Ù¿î·Îµå
8³â Àü
// ImageDownloader.java

package co.kr.codein;

import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;

import android.app.Activity;
import android.app.ProgressDialog;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;

public class ImageDownloader extends Activity {
  Button imageBtn;
  ImageView image;
  ProgressDialog pd;
  Handler mHandler;
  Bitmap bmp;
  String Url;

  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.image_dowload);

    mHandler = new Handler();
    Url = "http://tvzonedoc15.media.daum.net/pcp_download.php?fhandle=N2dZWkRAdHZ6b25lZG9jMTUubWVkaWEuZGF1bS5uZXQ6L0EwMDAwMDQvMjgvMjgwMi5qcGc=&filename=1.jpg";
    imageBtn = (Button) findViewById(R.id.btn);
    imageBtn.setOnClickListener(new View.OnClickListener() {

      public void onClick(View v) {
        pd = ProgressDialog.show(ImageDownloader.this,
            "Downloading Image", "Please Wait..", false);

        Thread one = new Thread() {
          public void run() {
            getFile(Url);
            mHandler.post(mUpdateResults);
          }
        };
        one.start();
      }
    });

    image = (ImageView) findViewById(R.id.my_view);
  }

  void getFile(String fileurl) {
    URL myUrl = null;
    try {
      myUrl = new URL(fileurl);

    } catch (MalformedURLException e) {
      e.printStackTrace();
    }

    try {
      HttpURLConnection conn = (HttpURLConnection) myUrl.openConnection();
      conn.connect();
      InputStream is = conn.getInputStream();
      bmp = BitmapFactory.decodeStream(is);

    } catch (IOException e) {
      e.printStackTrace();
    }
  }

  final Runnable mUpdateResults = new Runnable() {
    public void run() {
      pd.dismiss();
      image.setImageBitmap(bmp);
      // imageBtn.setVisibility(View.INVISIBLE);
    }
  };

}

// image_dowload.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent">
<ImageView  
   android:id="@+id/my_view"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true">
  </ImageView>
  
<Button
android:id="@+id/btn"
android:layout_width="wrap_content"
android:layout_height="60dip"
android:text="Click"
android:textStyle="bold"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true">
</Button>

</RelativeLayout>
ÃßõÃßõ : 233 Ãßõ ¸ñ·Ï
¹øÈ£ Á¦¸ñ
1,076
Jscript 5.8 ¿ë º¸¾È ¾÷µ¥ÀÌÆ®(KB971961) ´Ù¿î·Îµå ¸µÅ© ÀÔ´Ï´Ù
1,075
Internet Explorer Ãß°¡ ±â´É ¹®Á¦ ÇØ°á
1,074
Internet Explorer ±âº» ¼³Á¤À» º¹±¸ (°³ÀÎ ¼³Á¤ »èÁ¦ ¿É¼ÇÀ» »ç¿ë)
1,073
½ºÅ¸ÀϽÃÆ®(css)¿¡¼­ A:link, A:visited, A:active, A:hover ¼³¸í
1,072
META TagÀÇ Á¾·ù¿Í »ç¿ë¹æ¹ý
1,071
ȨÆäÀÌÁö ·Îº¿ ¼³Á¤ ¹æ¹ý
1,070
·¹ÀÌ¾î »ó´Ü ¹«Á¶°Ç°íÁ¤
1,069
[jquery] alert¹Ú½º ¸»°í ·¹ÀÌ¾î ¹Ú½º¸¦ ¶ç¿öº¸¼¼¿ä
1,068
À©µµ¿ì ¾ÏÈ£ ºÐ½ÇÇßÀ»¶§ ..
1,067
[Windows] ÀÛ¾÷°ü¸®ÀÚ ½ÇÇà ÆÄÀÏ ÃÑÁ¤¸®
1,066
Áö±Ý À©µµ¿ì 7 â ¸ð¾çÀÌ À©µµ¿ì °íÀüÀ¸·Î ³ª¿Ã¶§..
1,065
°£´ÜÇÑ ¸í·É¾î·Î Á»ºñ PC È®ÀÎÇϱâ
1,064
Internet Explorer ȣȯ¼º ·»´õ¸µ ¸ðµå·Î º¸±â
1,063
div ·¹À̾ƿô Àâ±â!
1,062
Çϵåµð½ºÅ© ÆÄƼ¼Ç ¼û±â±â
1,061
¹ÙÀÌ¿À½º ºÎÆ® ÇÁ·Î¼¼½º
1,060
À©µµ¿ì XPÀÇ ºÎÆà °úÁ¤
1,059
ÇÁ·Î½ÃÀú ½ÃÀÛ ÁöÁ¡ _except_handler4_commonÀ»(¸¦) DLL msvcrt.dll¿¡¼­ ãÀ» ¼ö ¾ø½À´Ï´Ù
1,058
È°¼ºÆÄƼ¼ÇÀ» ºñÈ°¼ºÆÄƼ¼ÇÀ¸·Î º¯°æÇÏ´Â ¹æ¹ý
1,057
windows XP ÀÚµ¿½ÇÇà ²ô±â
1,056
À¯ÇØÇÑ »çÀÌÆ® ±¤°í¸Þ¼¼Áö°¡ ³ª¿ÀÁö ¾Ê°Ô Çϱâ
1,055
Á¦°¡ Âü°í·Î ÇÏ´Â ¹èÄ¡ÆÄÀÏ ÀÛ¼º¹ýµîÀÔ´Ï´Ù
1,054
À©µµ¿ì XP °øÀ¯Æú´õ ¾ÏÈ£°É±â
1,053
¹ÙÅÁÈ­¸éÀ» Dµå¶óÀ̺ê·Î!~!!!!!!
1,052
½Ã½ºÅÛÆÄÀÏ È®ÀåÀÚ!!
1,051
À¥Ç¥ÁØÀ» À§ÇÑ <iframe></iframe>
1,050
[CSS/À¥Ç¥ÁØ] DOCTYPE ¼±¾ð
1,049
CSS Àý´ë À§Ä¡¸¦ »ç¿ëÇÑ ÇÁ·¹ÀÓ È¿°ú
1,048
Recommended Doctype Declarations to use in your Web document
1,047
CSS ·¹À̾ƿô ÅÛÇø´ »çÀÌÆ®
¸ñ·Ï
¹ÂÁ÷Æ®·ÎÆ® ºÎ»ê±¤¿ª½Ã ºÎ»êÁø±¸ °¡¾ßµ¿ ¤Ó °³ÀÎÁ¤º¸Ãë±Þ¹æħ
Copyright ¨Ï musictrot All rights reserved.