错误图像下载Android 3.0

时间:2012-05-15 14:15:51

标签: java android eclipse image download

我有一个让我发疯的问题,

我正在做一个下载xml参数的应用程序,这些参数是图像路径,例如:

除其他外

但我的问题本身是在下载图片,我会在这里发布代码,它在Android 2.1和其他版本的手机上100%工作,但本周我决定在平板电脑上测试Android 3.1和没有办法工作,遵循代码:

public void comeca(){
        copiaArr = arraysIAD.imagem.clone();

        for(i=0; i< copiaArr.length; i++){
            param_img = copiaArr[i];
            try{

                pathBanner = (BitmapFactory.decodeStream((InputStream)new URL(param_img).getContent()));
                bannerhash.put(i+"", pathBanner);

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


            if( (i+1) >= copiaArr.length){
                passaBanner();
            }
        }//fim do loop
    }
奇怪的是,有时它运行并下载所有图像,但大多数时候崩溃应用程序,我NullPointerExeption的错误,但只有在平板电脑的版本,移动没有这个错误。

以下错误:

> 05-15 11:11:12.900: E/AndroidRuntime(31452): FATAL EXCEPTION: main
> 05-15 11:11:12.900: E/AndroidRuntime(31452):
> java.lang.NullPointerException 05-15 11:11:12.900:
> E/AndroidRuntime(31452):    at
> com.spoledge.aacplayer.AACPlayerActivity.comeca(AACPlayerActivity.java:348)
> 05-15 11:11:12.900: E/AndroidRuntime(31452):    at
> com.spoledge.aacplayer.AACPlayerActivity$DownloadXMLBanner.onPostExecute(AACPlayerActivity.java:485)
> 05-15 11:11:12.900: E/AndroidRuntime(31452):    at
> com.spoledge.aacplayer.AACPlayerActivity$DownloadXMLBanner.onPostExecute(AACPlayerActivity.java:1)
> 05-15 11:11:12.900: E/AndroidRuntime(31452):    at
> android.os.AsyncTask.finish(AsyncTask.java:590) 05-15 11:11:12.900:
> E/AndroidRuntime(31452):    at
> android.os.AsyncTask.access$600(AsyncTask.java:149) 05-15
> 11:11:12.900: E/AndroidRuntime(31452):  at
> android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:603)
> 05-15 11:11:12.900: E/AndroidRuntime(31452):    at
> android.os.Handler.dispatchMessage(Handler.java:99) 05-15
> 11:11:12.900: E/AndroidRuntime(31452):  at
> android.os.Looper.loop(Looper.java:132) 05-15 11:11:12.900:
> E/AndroidRuntime(31452):    at
> android.app.ActivityThread.main(ActivityThread.java:4028) 05-15
> 11:11:12.900: E/AndroidRuntime(31452):  at
> java.lang.reflect.Method.invokeNative(Native Method) 05-15
> 11:11:12.900: E/AndroidRuntime(31452):  at
> java.lang.reflect.Method.invoke(Method.java:491) 05-15 11:11:12.900:
> E/AndroidRuntime(31452):    at
> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
> 05-15 11:11:12.900: E/AndroidRuntime(31452):    at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602) 05-15
> 11:11:12.900: E/AndroidRuntime(31452):  at
> dalvik.system.NativeStart.main(Native Method)

0 个答案:

没有答案