2014-04-23 2 views
-1

사용자에게 이미지를 보내려고합니다. 이미지 URL을 검색 할 수 있습니까? 내가 유니버설 이미지 로더를 사용하여 이미지 뷰에 추가 할 때QuickBlox 1 : 1 채팅 전송 이미지

public void displayImage(String imageurl, ImageView img) 
{ 
     Log.d("Chat ImageUrl", imageurl); 

     DisplayImageOptions options = new DisplayImageOptions.Builder() 
       .cacheInMemory().cacheOnDisc() 
       .imageScaleType(ImageScaleType.IN_SAMPLE_POWER_OF_2) 
       .displayer(new RoundedBitmapDisplayer(20)).build(); 

     // Load and display image 
     ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
       this).defaultDisplayImageOptions(options).build(); 
     ImageLoader.getInstance().init(config); 
     ImageLoader.getInstance().displayImage(imageurl, img); 
    } 

04-23 12:38:46.600: E/AndroidRuntime(664): FATAL EXCEPTION: main 
04-23 12:38:46.600: E/AndroidRuntime(664): java.lang.NullPointerException 
04-23 12:38:46.600: E/AndroidRuntime(664): at android.content.ContextWrapper.getApplicationContext(ContextWrapper.java:100) 
04-23 12:38:46.600: E/AndroidRuntime(664): at com.quickblox.sample.chat.ui.activities.ChatActivity.displayImage(ChatActivity.java:167) 
04-23 12:38:46.600: E/AndroidRuntime(664): at com.quickblox.sample.chat.ui.adapters.ChatAdapter.applyImg(ChatAdapter.java:97) 
04-23 12:38:46.600: E/AndroidRuntime(664): at com.quickblox.sample.chat.ui.adapters.ChatAdapter.getView(ChatAdapter.java:81) 
04-23 12:38:46.600: E/AndroidRuntime(664): at android.widget.AbsListView.obtainView(AbsListView.java:1430) 
04-23 12:38:46.600: E/AndroidRuntime(664): at android.widget.ListView.makeAndAddView(ListView.java:1745) 
04-23 12:38:46.600: E/AndroidRuntime(664): at android.widget.ListView.fillSpecific(ListView.java:1290) 
04-23 12:38:46.600: E/AndroidRuntime(664): at android.widget.ListView.layoutChildren(ListView.java:1588) 
04-23 12:38:46.600: E/AndroidRuntime(664): at android.widget.AbsListView.onLayout(AbsListView.java:1260) 
04-23 12:38:46.600: E/AndroidRuntime(664): at android.view.View.layout(View.java:7175) 
04-23 12:38:46.600: E/AndroidRuntime(664): at android.widget.RelativeLayout.onLayout(RelativeLayout.java:912) 
04-23 12:38:46.600: E/AndroidRuntime(664): at android.view.View.layout(View.java:7175) 
04-23 12:38:46.600: E/AndroidRuntime(664): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1254) 
04-23 12:38:46.600: E/AndroidRuntime(664): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1130) 
04-23 12:38:46.600: E/AndroidRuntime(664): at android.widget.LinearLayout.onLayout(LinearLayout.java:1047) 
04-23 12:38:46.600: E/AndroidRuntime(664): at android.view.View.layout(View.java:7175) 
04-23 12:38:46.600: E/AndroidRuntime(664): at android.widget.FrameLayout.onLayout(FrameLayout.java:338) 
04-23 12:38:46.600: E/AndroidRuntime(664): at android.view.View.layout(View.java:7175) 
04-23 12:38:46.600: E/AndroidRuntime(664): at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1254) 
04-23 12:38:46.600: E/AndroidRuntime(664): at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1130) 
04-23 12:38:46.600: E/AndroidRuntime(664): at android.widget.LinearLayout.onLayout(LinearLayout.java:1047) 
04-23 12:38:46.600: E/AndroidRuntime(664): at android.view.View.layout(View.java:7175) 
04-23 12:38:46.600: E/AndroidRuntime(664): at android.widget.FrameLayout.onLayout(FrameLayout.java:338) 
04-23 12:38:46.600: E/AndroidRuntime(664): at android.view.View.layout(View.java:7175) 
04-23 12:38:46.600: E/AndroidRuntime(664): at android.view.ViewRoot.performTraversals(ViewRoot.java:1140) 
04-23 12:38:46.600: E/AndroidRuntime(664): at android.view.ViewRoot.handleMessage(ViewRoot.java:1859) 
04-23 12:38:46.600: E/AndroidRuntime(664): at android.os.Handler.dispatchMessage(Handler.java:99) 
04-23 12:38:46.600: E/AndroidRuntime(664): at android.os.Looper.loop(Looper.java:130) 
04-23 12:38:46.600: E/AndroidRuntime(664): at android.app.ActivityThread.main(ActivityThread.java:3683) 
04-23 12:38:46.600: E/AndroidRuntime(664): at java.lang.reflect.Method.invokeNative(Native Method) 
04-23 12:38:46.600: E/AndroidRuntime(664): at java.lang.reflect.Method.invoke(Method.java:507) 
04-23 12:38:46.600: E/AndroidRuntime(664): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 
04-23 12:38:46.600: E/AndroidRuntime(664): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 
04-23 12:38:46.600: E/AndroidRuntime(664): at dalvik.system.NativeStart.main(Native Method) 

이 Assitance 코드가 마침내 일

답변

1

하십시오 다음과 같은 오류를 발생시킵니다. Null Pointer를 없앴습니다.