Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/198.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将json数据检索到android xml_Android_Mysql_Xml_Json - Fatal编程技术网

如何将json数据检索到android xml

如何将json数据检索到android xml,android,mysql,xml,json,Android,Mysql,Xml,Json,我正在做一个android项目,下面是我的教程 通过阅读上面的教程,我能够通过JSON将数据检索到列表活动,php代码运行良好,但问题在于我制作了一个表单,其中我只想将数据检索到一个简单的XML,没有几个简单的文本视图,但我无法更改代码。 下面是从JSON中检索数据以列出活动的代码。。 包com.example.policadda; 导入java.util.ArrayList; 导入java.util.HashMap; 导入java.util.List; 导入org.apache.http.Na

我正在做一个android项目,下面是我的教程

通过阅读上面的教程,我能够通过JSON将数据检索到列表活动,php代码运行良好,但问题在于我制作了一个表单,其中我只想将数据检索到一个简单的XML,没有几个简单的文本视图,但我无法更改代码。 下面是从JSON中检索数据以列出活动的代码。。 包com.example.policadda; 导入java.util.ArrayList; 导入java.util.HashMap; 导入java.util.List; 导入org.apache.http.NameValuePair; 导入org.apache.http.message.BasicNameValuePair; 导入org.json.JSONArray; 导入org.json.JSONException; 导入org.json.JSONObject; 导入android.app.ListActivity; 导入android.app.ProgressDialog; 导入android.content.Intent; 导入android.content.SharedReferences; 导入android.os.AsyncTask; 导入android.os.Bundle; 导入android.preference.PreferenceManager; 导入android.util.Log; 导入android.view.view; 导入android.widget.AdapterView; 导入android.widget.AdapterView.OnItemClickListener; 导入android.widget.ListAdapter; 导入android.widget.ListView; 导入android.widget.simpledapter; 公共类Mycomplaints扩展ListActivity{ 私人对话; JSONParser JSONParser=新的JSONParser; 私有静态最终字符串读取\u投诉\u URL=http://divaexample.honor.es/mycomplaints.php; 私有静态最终字符串TAG_TITLE=TITLE; 私有静态最终字符串标记_POSTS=POSTS; 私有静态最终字符串标记_USERNAME=USERNAME; 私有静态最终字符串标记_SUBJECT=SUBJECT; 私有JSONArray mComments=null; 私有数组列表mCommentList; @凌驾 受保护的void onCreateBundle savedInstanceState{ super.onCreatesavedInstanceState; setContentViewR.layout.my_投诉; } @凌驾 恢复时受保护的无效{ super.onResume; 新建LoadComments.execute; } 公共视图v { 意向i=新意向M投诉。本,投诉。类别; 斯塔维蒂; } 公共void updateJSONdata{ mCommentList=newarraylist; JSONParser-jParser=新的JSONParser; JSONObject json=jParser.getJSONFromUrlREAD\u URL; SharedReferences sp=PreferenceManager.GetDefaultSharedReferencesMyComplaints.this; 字符串post_username=sp.getStringusername,diva; 试一试{ 列表参数=新的ArrayList; params.addnew BasicNameValuePairusername,post_用户名; Log.drequest!,开始; JSONObject json1=jsonParser.makeHttpRequest 读取URL、帖子、参数; mComments=json1.getJSONArrayTAG_POSTS; 对于int i=0;i}您需要了解这一点,但不清楚,您是否希望将响应转换为xml?