I'm making an android application for my school project. This is my first project for android application. I want to know how to make an object that easily accessible by activities or dialog fragment. Should I use put Extra or static class object? or is there alternate way to do that?
public class Location
{
private string _name;
private string _address;
private string _description;
private List<Storage> _storages { get; set; }
private int _id;
public int Id
{
get { return _id; }
set { _id = value; }
}
public string Description
{
get { return _description; }
set { _description = value; }
}
public string Address
{
get { return _address; }
set { _address = value; }
}
public string Name
{
get { return _name; }
set { _name = value; }
}
public Location()
{
_storages = new List<Storage>();
}
public Location(string name, string address,string description)
{
Id =Id+1;
Name = name;
Address = address;
Description = description;
_storages = new List<Storage>();
}
}
In this code, I'm trying to save all the data that I get from web service. So I don't have to sync from web service every time I open activity.
Hope there is a way.. Thanks in advance :)