StringBuffer
数据代码:
StringBuffer finalbufferdata = new StringBuffer();
for (int i = 0; i < parentarray.length(); i++) {
JSONObject finalobj = parentarray.getJSONObject(i);
String id = finalobj.getString("student_id");
String name = finalobj.getString("first_name");
String m_name = finalobj.getString("middle_name");
String l_name = finalobj.getString("last_name");
finalbufferdata.append(id+" "+name+" "+m_name+" "+l_name+"\n");
}
答案 0 :(得分:0)
嗯,这实际上取决于你的目标是什么。您可以像这样传递String
(这是我的首选方式):
StringBuffer finalbufferdata = new StringBuffer();
....
Intent intent = new Intent();
intent.putExtra("YOUR_KEY_HERE", finalbufferdata.toString());
如果您真的需要它,StringBuffer
会实现Serializable
和CharSequence
,所以您应该只能选择一个并将其直接添加到意图中,如下所示:
StringBuffer finalbufferdata = new StringBuffer();
....
Intent intent = new Intent();
intent.putExtra("YOUR_KEY_HERE", (Serializable) finalbufferdata);
如果您对您的需求更具体,我可以提供更多帮助。