I want to send this 'list' to the next class(HomeActivity).But i was trying to do it by sending extras but couldn't somebody please help me to fix this

code

protected void onPostExecute(final List<HashMap<String,String>> list) {
                // Get json response status
                 status = "OK";

                 // updating UI from Background Thread
                runOnUiThread(new Runnable() {
                    public void run() {


                        if(status.equals("OK")){

                            int list_size = list.size();

                                        i = new Intent(getApplicationContext(),
                                                HomeActivity.class);
    startActivity(new);
    }
    }
    });
    }
有帮助吗?

解决方案

You have to prepare/seralize your list data for example in JSON format and then pass it to intent as string extra

JSONArray list = new JSONArray(); list.put(new JSONObject().put("id",1).put("name", "placeNmae"));

intent.putStringExtra("places", list.toString());

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top