【发布时间】:2018-02-27 18:14:00
【问题描述】:
我在 sqlit 数据库中有数据,所以我用它来存储类别和项目 我像这样在arraylist中得到它:
public ArrayList showDataItems(String id_cate){
ArrayList<Items> arrayListItems = new ArrayList<>();
SQLiteDatabase db = this.getReadableDatabase();
Cursor cr = db.rawQuery("select * from items where id_cate = "+id_cate,null);
cr.moveToFirst();
while (cr.isAfterLast() == false){
String item_id = cr.getString(0);
String ItemName = cr.getString(1);
String Item_quantity = cr.getString(2);
String icon = cr.getString(3);
int isDone = Integer.parseInt(cr.getString(5));
arrayListItems.add(new Items(item_id,ItemName,Item_quantity,R.drawable.shopicon,icon,isDone));
cr.moveToNext();
}
return arrayListItems;
}
所以我需要获取这些数据并将其转换为字符串并以自定义格式将其共享给其他应用程序,例如 whatsapp:
1- 第一个 *
2- 第二个 *
3-....
所以我使用此代码发送数据
Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT,"hello world");
intent.setType("text/plain");
startActivity(Intent.createChooser(intent,"send items i need all
data here"));
所以我们可以使用字符串生成器或其他东西来获取一个字符串中的数据 请帮帮我!
【问题讨论】:
-
你想发送什么数据到whatsapp?
标签: java android string arraylist