小编RCK*_*K69的帖子

JSONException:类型java.lang.String的值无法转换为JSONObject

我有一个带有2个JSON-Arrays的JSON文件:一个用于路由的数组和一个用于景点的数组.

路线应包含用户导航到的多个景点.不幸的是我收到错误:

JSONException:类型java.lang.String的值无法转换为JSONObject

这是我的变量和解析JSON文件的代码:

private InputStream is = null;
private String json = "";
private JSONObject jObj = null;

try {
    BufferedReader reader = new BufferedReader(new InputStreamReader(is, "iso-8859-1"), 8);
    StringBuilder sb = new StringBuilder();
    String line = null;
    while ((line = reader.readLine()) != null) {
        sb.append(line + "\n");
    }
    is.close();
    // hier habe ich das JSON-File als String
    json = sb.toString();
    Log.i("JSON Parser", json);
} catch (Exception e) {
    Log.e("Buffer Error", "Error converting result " + e.toString());
}

// try …
Run Code Online (Sandbox Code Playgroud)

parsing android json

59
推荐指数
7
解决办法
25万
查看次数

dojo教程:未定义dojo

我想用dojo获得startet.

因此我正在使用他们的教程:http://dojotoolkit.org/documentation/tutorials/1.8/hello_dojo/

最简单的教程显示此页面

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Tutorial: Hello Dojo!</title>
</head>
<body>
    <h1 id="greeting">Hello</h1>
    <!-- load Dojo -->
    <script src="//ajax.googleapis.com/ajax/libs/dojo/1.8.1/dojo/dojo.js"
               data-dojo-config="async: true"></script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

我现在打开页面(在他们的页面上尝试了localy和托管版本).当我写作

dojo.query("h1")
Run Code Online (Sandbox Code Playgroud)

在我的firebug控制台中,我收到消息:

ReferenceError:未定义dojo

请帮忙

html javascript dojo

2
推荐指数
1
解决办法
1万
查看次数

从 html 文件解析图像 url

我想搜索 html 文件,然后获取该页面上图像的 url。然后这个 url 应该被保存为一个字符串——仅此而已。问题是我真的不知道如何开始。

我的应用程序当然知道图像所在页面的 url。我们以这个 url 为例:


在此页面上,我需要大图像的 url 作为字符串。当我查看源代码时,我可以找到 url,但我不知道如何编码 - 这是我需要的 url:


(仅限引号内的文本)。

html java parsing android image

1
推荐指数
1
解决办法
7756
查看次数

标签 统计

android ×2

html ×2

parsing ×2

dojo ×1

image ×1

java ×1

javascript ×1

json ×1