如何将此列表视图数组传递给下一个活动?

时间:2017-12-13 15:26:51

标签: listview android-intent

public void onTaskCompleted(String response, int serviceCode) {
    Log.d("responsejson", response.toString());
    switch (serviceCode) {
        case jsoncode:

            if (parseContent.isSuccess(response)) {
                AndyUtils.removeSimpleProgressDialog();  //will remove progress dialog
                playersModelArrayList = parseContent.getInfo(response);
                customeAdapter = new CustomeAdapter(this,playersModelArrayList);
                listView.setAdapter(customeAdapter);

                listView.setOnItemClickListener(new AdapterView.OnItemClickListener(){
                    @Override
                    public void onItemClick(AdapterView<?> parent, View view, int position, long id) {


                        Intent intent = new Intent(ViewKid.this,ViewMap.class);

                        intent.putExtras();
                        startActivity(intent);
                    }
                });
            }else {
                Toast.makeText(ViewKid.this, parseContent.getErrorMessage(response), Toast.LENGTH_SHORT).show();
            }
    }
}

}

我想将列表视图数据传递给另一个活动,有人可以帮忙吗?我应该把什么放在intent.putExtras();

1 个答案:

答案 0 :(得分:0)

我并不完全明白你想要做什么..如果你想传递整个数组列表数据只需使用:

Intent.putArrayListExtra(playersModelArrayList);

如果您想传递用户选择的项目:

Intent.putExtra(playersModelArrayList.get(position));