Sunday 15 July 2012

Read out list of objects in Java -


Hello, I am trying to read the following object:

Can someone help me how I want to value the project?

I tried to do this already:

 for  (i int = 0; i & lt; ((object []) retired .length; I ++) {Map & LT; String, Object & gt; Map2 = (map & lt; string, object & gt;) ret [i]; Int x = 0; {// Store data in the list if (x == 0) {println (entry.getKey () + "/" + Entry: (map2.entrySet (), string, object & gt entry.Map.Entry & lt) For .getValue ()); X ++; } If (x == 1) {// read projectid}}}  

I try to find value for production: PROJECT_ID / [Ljava.lang.Object; @ 41,923,200

Edit:

Showing data in the list view:

  Private Sequence ListViewLoaderTask AsyncTask & lt Spread String, Zero, SimpleAdapter & gt; ; {@Override Protected SimpleAdapter doInBackground (string ... strJson) {connector = new GetBaseContext ()); Connector.config (); Current_page + = 1; ListOffValues ​​= getListOffFieldValues ​​(current_page, inaccurate, hidden); String {] from = {"project_id"}; Int [] to = {R.id.tv_project_id}; Simple Adapter Adapter = New Simple Adapter (getBaseContext (), ListoffValues, R.Lay Out.Liv_GPS_Layout, from, with); Return adapter; } / ** is executed by Android on "doInBackground" * / @Override protected void onPostExecute (Final SimpleAdapter Optimizer) // installation adapter for list view mListView.setAdapter (adapter); For (int i = 0; i & lt; adapter.getCount (); i ++) {Hashmap & lt; String, object []> Hm = (Hashmap & lt; string; Object [] & gt;) adapter.getItem (i); String project id = (string) hm.get ("project_id") [1] .toString (); Hashmap & lt; String, string & gt; HmDownload = new Hashmap & lt; String, string & gt; (); HmDownload.put ("PROJECT_ID", projectID); Adapter.notifyDataSetChanged (); MListViewksetOnItemClickListener (new Adaptrwu. Onitemkliklistr () {public void Aitemklik (Adaptrwu & lt ;? & Gt; parents, views, int position, long id) {string List name; Hasmap & lt; string, string & gt; HM Download = New Hashmap  (); listname = hmDownload.get ("PROJECT_ID"); myIntent = new intent (MainActivity.this, YardActivity.class); MainActivity.this.startActivity (myIntent) ;}}); } Progress.dismiss (); Log D. ("/ ****", "data has expired from Odu"); }}  

I am quite confused with your normal types and what is the ret is.

I think your problem is that you do not value objects in your map, but Srnian of objects - Show & lt; String, object []> . "[Ljava.lang.Object; @ 41923200" , because the arrays have no toString () method.

You should hm.get ( "PROJECT_ID") [1] instead of (that assuming HM is defined on the map & lt, string, [] & gt object; and Maps & lt; string, object & gt; .


No comments:

Post a Comment