【问题标题】:how to copy content from text file to database in android如何将内容从文本文件复制到android中的数据库
【发布时间】:2019-10-15 19:20:46
【问题描述】:

我目前正在开发一个应用程序,用户在给定的 editText 字段中输入一行数据并将数据添加到数据库中。

如果要添加多行(例如 50 行),我希望允许用户通过带有分隔符的特定格式的文本文件提供数据。

如何选择文件或获取用户提供的文本文件的文件路径 然后在我的应用程序中使用它来将数据添加到数据库?

【问题讨论】:

    标签: android


    【解决方案1】:

    How can I read a text file from the SD card in Android?

    How to read text file in Android?

    Android read text raw resource file

    查看这些答案以了解如何将文件加载到您的应用程序。关于将输入保存到数据库,您可以使用经典的 for 循环并遍历每一行并将其保存到数据库

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-08-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-02
      • 2020-02-16
      • 2013-10-06
      相关资源
      最近更新 更多