1

I am working on a project in which I am saving data in a class with a filename and data attached to a folder on the sdcard. I need another class to display a list of all the filenames and when you click on them it opens the saved data (text) in an editor or something. I am somewhat new to android, sorry if I am missing something obvious here.

So basically I need to display the file names of data that I have saved in a list view and when you click on them, it takes the data and sends it (Probably using shared prefs or BroadcastReceiver) to a class where you can edit it. I could also use a database if that would be easier.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Code_Insanity
  • 2,648
  • 3
  • 17
  • 21

2 Answers2

3

See First way is to make variable as static so you can access by class name.
second Use file for data storage it is easy to create file.
third is use Share preference i.e.mobile seeting
fourth you can use SQlite to store data.

Ronak Mehta
  • 5,971
  • 5
  • 42
  • 69
0

There are different ways to store the required data:

  • Shared Preference (If the data is lesser say for example login creadentials etc).

    • Internal\External Storage (we can store data images,files etc .Your sd card case is of external storage)

    • Database (SQL Lite is present and stores structured data in a private database.)

Study the link for storage options.Choose the best options as per requirement and need.

http://developer.android.com/guide/topics/data/data-storage.html

Arpit Garg
  • 8,476
  • 6
  • 34
  • 59