I would like to update a different thread which I have created with some code that I have written which is not working . I am trying to parse my information, after sending the post request, [[user from: "Andrew"], {"user": "Jimmy"}]
I like those users to pick, and add them to the list view. Here is my code to send HTTP code and then my code is trying to parse it and keep it in the adapter.
string temp = ""; String ar []; HTTP Client HTTP Client = New DefaultHttpClient (); Http post http post = new html post (htmlUrl); & Lt; NameValuePair & gt; NameValuePair = New ArrayList & lt; NameValuePair & gt; (); NameValuePair.add (New BasicNameValuePair ("user name", "brock")); {Try HttpPost.setEntity (New UrlEncodedFormEntity (nameValuePair)); } Hold (unsupported encoding exception e) {e.printStackTrace (); } Try {HttpResponse response = httpClient.execute (httpPost); // Writing feedback to log logs log ("HTPP response:", response.toString ()); } Catch (ClientProtocolException E) {// log e Write an exception for the exception. } Hold (IOException e) {// log e Write an exception for the exception. } Try {JSONObject Pending User = New JSONObject ("$ myArray"); } Hold (JasonX Express E) {e.printStackTrace (); } // Read the reply to the string {BufferedReader Reader = New BufferedReader (New InputStreamRadder ("UTF-8"), 8); Stringbilder sb = new stringbiller (); String line = null; While ((line = reader. Readline ())! = Null () {sb.append (row + "\ n"); } is close(); Result = sb.toString (); System.out.print (results); } Hold (exception e) {return tap; } // try to convert the string object {JSONArray jArray = new JSONArray (result); Int count = jArray.length (); For (int i = 0; i & lt; count; i ++) {JSONObject json_data = jArray.getJSONObject (i); Temp + = json_data.getString ("user user") + ":"; } Arr = temp.split (":"); } Hold (JasonX Express E) {e.printStackTrace (); }} "Update" return; } Public string [] getStringForAdapter () {return arr; }}
This is where I try to get it and put it on my list to go
HTTPSend Post postender = new HTTPSendPost ( ); Post sender.setup (500, 050, "tiest", htmlUrl); PostSender.execute (); String [] Pending RequestArray = postSender.getStringForAdapter (); ArrayAdapter & LT; String & gt; Adapter = new array adapter & lt; String & gt; (This, R. L. activity_friend, pending request); PendingRequestsListView.setAdapter (adapter);
When I try my app, I do not get any results on the list view, any help would be appreciated. Sorry for Repost, but I have so much more information and code the next time I ask a question without the code Nhinuँga which I tried. I get the error
java.lang.RuntimeException: Unable to start the activity ComponentInfo {com.skyrealm.brockyy.findmypeepsapp /com.skyrealm.brockyy.findmypeepsapp.FriendsActivity}: java.lang .NullPointerException: storage == null
No comments:
Post a Comment