01-26 20:46:18.110: E/AndroidRuntime(1706): FATAL EXCEPTION: main
01-26 20:46:18.110: E/AndroidRuntime(1706): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.nth/com.nth.JLocation}: java.lang.InstantiationException: can't instantiate class com.nth.JLocation; no empty constructor
01-26 20:46:18.110: E/AndroidRuntime(1706):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1892)
01-26 20:46:18.110: E/AndroidRuntime(1706):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1993)
01-26 20:46:18.110: E/AndroidRuntime(1706):  at android.app.ActivityThread.access$600(ActivityThread.java:127)
01-26 20:46:18.110: E/AndroidRuntime(1706):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1159)
01-26 20:46:18.110: E/AndroidRuntime(1706):  at android.os.Handler.dispatchMessage(Handler.java:99)
01-26 20:46:18.110: E/AndroidRuntime(1706):  at android.os.Looper.loop(Looper.java:137)
01-26 20:46:18.110: E/AndroidRuntime(1706):  at android.app.ActivityThread.main(ActivityThread.java:4512)
01-26 20:46:18.110: E/AndroidRuntime(1706):  at java.lang.reflect.Method.invokeNative(Native Method)
01-26 20:46:18.110: E/AndroidRuntime(1706):  at java.lang.reflect.Method.invoke(Method.java:511)
01-26 20:46:18.110: E/AndroidRuntime(1706):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:794)
01-26 20:46:18.110: E/AndroidRuntime(1706):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:561)
01-26 20:46:18.110: E/AndroidRuntime(1706):  at dalvik.system.NativeStart.main(Native Method)
01-26 20:46:18.110: E/AndroidRuntime(1706): Caused by: java.lang.InstantiationException: can't instantiate class com.nth.JLocation; no empty constructor
01-26 20:46:18.110: E/AndroidRuntime(1706):  at java.lang.Class.newInstanceImpl(Native Method)
01-26 20:46:18.110: E/AndroidRuntime(1706):  at java.lang.Class.newInstance(Class.java:1319)
01-26 20:46:18.110: E/AndroidRuntime(1706):  at android.app.Instrumentation.newActivity(Instrumentation.java:1026)
01-26 20:46:18.110: E/AndroidRuntime(1706):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1883)
01-26 20:46:18.110: E/AndroidRuntime(1706):  ... 11 more

java  소스

 

package com.nth;

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;

import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.ImageView;

public class JLocation extends View {

private Bitmap formulaImg;
 
 public JLocation(Context context){
  super(context);
  setFocusable(true);
  formulaImg = downLoadBitmap("");
 }

private Bitmap downLoadBitmap(String urlname) {
 // TODO 자동 생성된 메소드 스텁
 URL url = null;
 Bitmap Result = null;
 try {
  url = new URL("http://postfiles7.naver.net/20130125_118/nth_0115_1359106863982NoGoN_PNG/test.png?type=w2");
   Result = BitmapFactory.decodeStream(url.openStream());
}catch (MalformedURLException e) {
 Result = null;
}catch(IOException e){
 Result = null ;
}
 return Result;


}
}

 

 

//////////////////////////////////////////////////////////////

 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <ImageView
        android:id="@+id/ImageViewURL"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        ></ImageView>
</LinearLayout>