0

I have about 60 Markers for about 20 different locations in text files on my lap. I also have a string-array contains the names of the locations displayed on RecyclerView when a location is clicked a map is opened at that location with the given Markers added. My question is where to save the lng,lat of these Markers so I can get them at runtime when needed.

EDIT: Database is my last choice, as I am new with it and I have little time.I hope there is a way to save these values to xml arrays.

Ahmed Mostafa
  • 918
  • 1
  • 12
  • 20

2 Answers2

0

You can save them in database along with the names so that you can retrieve later easily.

    public class CustomDataItem {
    String var1;

    public CustomDataItem(String var1) {
        this.var1 = var1;
    }

    public String getVar1() {
        return var1;
    }

    public void setVar1(String var1) {
        this.var1 = var1;
    }

}
Jas
  • 3,207
  • 2
  • 15
  • 45
  • Thank you, I think database is my last choice, as time is important.I hope there is a way to save them in xml arrays. – Ahmed Mostafa Sep 30 '15 at 04:03
  • Database is the last and best choice.Or else you can create a custom datatype and create an ArrayList of that type so that you can retrieve the values using simple getter and setter methods. – Jas Sep 30 '15 at 04:14
  • That was my choice, but the question still how to save these values to my project and how to get them back when I need them. – Ahmed Mostafa Sep 30 '15 at 04:18
  • See my edited answer.You can call the set method for setting your required value and can use get method to retrieve wherever required. – Jas Sep 30 '15 at 04:39
  • Create an ArrayList of this custom type and use it – Jas Sep 30 '15 at 04:50
0

The best way to do it is to store it in your SQLite database. Then you can use a cursor to retrieve the all the data at runtime.
For saving time there are a lot of resources on Git hub which you can use. Look up for BoD content provider to quickly save/retrieve your data.

Kaveesh Kanwal
  • 1,753
  • 17
  • 16