volley-Java.lang.RuntimeException: Bad URL

问题描述

Java.lang.RuntimeException: Bad URL


在别人调用网页图片的程序 嵌入了自己的程序中 有时候图片会显示不出来 有时候能显示出来 求告知

 JSONArray ports = new JSONArray(postsstr);
                for(int i = 0;i<ports.length();i++){
                    port = ports.getJSONObject(i);

                    id = port.getString("id");
                    title = port.getString("title");
                    custom_fields = port.getString("custom_fields");
//                  System.out.print(custom_fields);
                    picJson = new JSONObject(custom_fields);
                    if(picJson.has("slider_pic") == true){
                        slider_pic_URL=picJson.getString("slider_pic");
                        System.out.println("图片链接"+slider_pic_URL);
                        picList = new JSONArray(slider_pic_URL);
                            for (int j =0; j<picList.length(); j++) {
                            slider_pic_URL = picList.getString(j);
                            HealthMap.put("key",slider_pic_URL);//放入URL
                            System.out.println(slider_pic_URL);//输出URL正确

下面放入

 private  void initViews()  {
              llAdvertiseBoard = (LinearLayout) this.findViewById(R.id.llAdvertiseBoard);
            JSONArray advertiseArray = new JSONArray();
            try{
                JSONObject head_img0 = new JSONObject();
                head_img0.put("head_img", HealthMap.get("key", isContinue));//取出URL
                advertiseArray.put(head_img0);
            }catch (Exception e) {
                e.printStackTrace();
        };
    llAdvertiseBoard.addView(new Advertisements(this, true, inflater, 3000).initView(advertiseArray));

下面是原来的方法 原来的方法可行

 try {
            JSONObject head_img0 = new JSONObject();
            head_img0.put("head_img","http://www.zjhaining.com/wp-content/uploads/2015/10/byf1118.jpg");
        advertiseArray.put(head_img0);

下面是所用的 put get 方法

 public static  class HealthMap {

        private static  Map<String, Object> map = new ConcurrentHashMap<String, Object>();

        /**
         * 传值
         * @param key
         * @param obj
         */
        public static void put(String key, Object obj) {
            map.put(key, obj);
        }
        /**
         * 取值  默认删除内存引用
         * @param key
         * @return
         */
        public static Object get(String key) {
            return map.remove(key);
        }

        /**
         * 取值   自定义是否删除内存引用
         * @param key
         * @param isDelete
         * @return
         */
        public static Object get(String key, boolean isDelete) {
            if (isDelete) {
                return get(key);
            } else {
                return map.get(key);
            }
        }

    }

求大神解答 !!!

解决方案

**求大神来帮忙 在线等 急 **

解决方案二:

url地址不对,请检查你的url地址,或者你的服务器崩掉了

解决方案三:

看动态生成的获取图片URL对不

解决方案四:

来人啊 求大神

解决方案五:

江湖救急!!!!!!!!!!!!!!!!!!!!!!!!!!

时间: 2024-05-06 14:56:23

volley-Java.lang.RuntimeException: Bad URL的相关文章

java.lang.RuntimeException: java.net.ConnectException: Connection timed out: con

问题描述 报这个错误java.lang.RuntimeException:java.net.ConnectException:Connectiontimedout:connectatorg.jasig.cas.client.util.CommonUtils.getResponseFromServer(CommonUtils.java:346)atorg.jasig.cas.client.util.CommonUtils.getResponseFromServer(CommonUtils.java

Android中调用startActivity结果导致:java.lang.RuntimeException: Unable to start activity ComponentInfo{xxx}

Android中调用startActivity结果导致:上网查了一下,总结如下: 第一种情况:java.lang.RuntimeException: Unable to start activity ComponentInfo{xxx}: java.lang.NullPointerException 错误代码: private int defaultDrawable=R.drawable.radio; private String defaultTitle=getString(R.string.

WebService CXF版本频繁调用时,出现java.lang.RuntimeException: org.apache.c

问题描述 java.lang.RuntimeException:org.apache.cxf.interceptor.Fault:异常org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:102)org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInter

FAILED: Hive Internal Error: java.lang.RuntimeException(Error while making MR scratch directory异常的解决

hive> select * from dummy; FAILED: Hive Internal Error: java.lang.RuntimeException(Error while making MR scratch directory - check filesystem config (null)) java.lang.RuntimeException: Error while making MR scratch directory - check filesystem config

安卓开发闪退-安卓开发中java.lang.RuntimeException: Unable to start activity ComponentInfo问题

问题描述 安卓开发中java.lang.RuntimeException: Unable to start activity ComponentInfo问题 package com.example.test; import android.app.ActivityGroup;import android.app.LocalActivityManager;import android.content.Intent;import android.os.Bundle;import android.vi

nutch Exception in thread &amp;amp;quot;main&amp;amp;quot; java.lang.RuntimeException: job failed: name=ge

问题描述 stone@stone-virtual-machine:~/apache-nutch-2.2.1/runtime/local$bin/nutchcrawlurls/seed.txt-dircrawl-depth3-topN5InjectorJob:Usingclassorg.apache.gora.memory.store.MemStoreastheGorastorageclass.InjectorJob:totalnumberofurlsrejectedbyfilters:0Inje

Android开发中java.lang.RuntimeException: Unable to start activity ComponentInfo{xxx}: java.lang.NullPoi

错误信息字符串:Java.lang.RuntimeException: Unable to start activity ComponentInfo{com.first/com.first.Game}: java.lang.NullPointerException 一般都会在Activity  onCreate()方法里的setContentView(XXX)发生此错误,网上查阅了很多原因,大概有四种重要可能的原因: 原因一:xxx的错误,若为R.layout.main  那么应该是main.x

我的Android进阶之旅------&amp;gt;Android中MediaRecorder.stop()报错 java.lang.RuntimeException: stop failed.

今天在调用MediaRecorder.stop(),报错了,java.lang.RuntimeException: stop failed. E/AndroidRuntime(7698): Cause by: java.lang.RuntimeException: stop failed. E/AndroidRuntime(7698): at android.media.MediaRecorder.stop(Native Method) E/AndroidRuntime(7698): at co

nutch 2.2.1 运行报错InjectorJob: java.lang.RuntimeException: job failed: name=inject

问题描述 在windows下的eclipse中运行报错,如下,求各位大神帮帮忙,本人小白一个,急急急急InjectorJob:startingat2014-06-2615:45:36InjectorJob:InjectingurlDir:urlsInjectorJob:Usingclassorg.apache.gora.memory.store.MemStoreastheGorastorageclass.****file:/D:/workspace/nutchTest/urlsInjectorJ