小编use*_*133的帖子

JSONArray无法转换为JSONObject错误

在获取json数据时,我收到错误:

JSONArray无法转换为JSONObject

生成json的代码:

JSONObject parent = new JSONObject();
DatabaseHandler dbh = new DatabaseHandler(getApplicationContext());  
            for(int i=0; i < allEds.size(); i++){
                String edsText = allEds.get(i).getText().toString();                                           
               //spinner = allSpns.get(i);
               String spinSelected=allSpns.get(i).getSelectedItem().toString();                  
               try
                {
                   JSONObject json = new JSONObject();          
                   json.put("Id", i);
                   json.put("FieldName", edsText);
                   json.put("FieldType",spinSelected);
                   parent.accumulate("data", json);



                }
                catch (JSONException e)
                {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }                   

            }
Generated json is   
            {"data":
[{"FieldType":"Account Number","FieldName":"r","Id":0},
  {"FieldType":"Net      Banking Id","FieldName":"tt","Id":1}
 ]}
code for json read
------------------
JSONObject jsonObj = new JSONObject(folderStructure);
        JSONObject data = jsonObj.getJSONObject("data"); 
        String …
Run Code Online (Sandbox Code Playgroud)

parsing android json

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

android中的图像按钮样式

嗨我很困惑与android中的图像按钮选项.我用以下xml创建了三个图像按钮

<ImageButton
        android:id="@+id/imageButton1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:src="@drawable/folder_add" />

    <ImageButton
        android:id="@+id/imageButton4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/imageButton1"
        android:layout_toLeftOf="@+id/imageButton1"
        android:src="@drawable/search" />

    <ImageButton
        android:id="@+id/imageButton2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignTop="@+id/imageButton4"
        android:layout_toLeftOf="@+id/imageButton4"
        android:src="@drawable/advancedsettings" 
        style="?android:attr/borderlessButtonStyle" />
Run Code Online (Sandbox Code Playgroud)

但是外面就像是带有图像的按钮..请帮我将图像仅显示为按钮..提前完成!

android button

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

标签 统计

android ×2

button ×1

json ×1

parsing ×1