如何在SQLite中从ImageAdapter保存StringArray

时间:2019-01-07 02:22:24

标签: java android arrays android-fragments android-sqlite

我能够从RecyclerView删除图像,但是我正在v-model.number="price_list[findPriceIndex(part.n_bubble)]['size_'+part.bubble_size]" 上完成图像,并且运行良好。但是,删除图像后,我将从其余图像中获取文件名,并将其保存到单个字符串中以保存在SQLite中。但是问题是我在片段活动中而不是从ImageAdapter将数据保存到数据库中。如何使用ImageAdapter按钮将此String文件保存在数据库中?

我的backpress

imageAdapter

这是我保存图像的文本,标题和字符串的片段

   bpAdapter.remove(currentPosition);
                    z.delete();
                    ImageFileArrayAfterDelete.remove(currentPosition);
                    toSingleString();
                    notifyItemRemoved(currentPosition);
                    notifyItemRangeChanged(currentPosition, bpAdapter.size());
                    Integer arrayLength = (Integer) ImageFileArrayAfterDelete.size();
                    Log.d("TAG_", "After Delete image size and name: " + arrayLength);
                }
            })
            .setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) {
                    // do nothing
                }
            })
            .setIcon(android.R.drawable.ic_menu_delete)
            .show();
}
private void toSingleString(){
    StringBuffer result = new StringBuffer();
    for (int i = 0; i < ImageFileArrayAfterDelete.size(); i++) {
        result.append( ImageFileArrayAfterDelete.get(i));
        result.append( ",");
    }
    stringForArray = result.toString();

0 个答案:

没有答案