I am posting some code to understand which array can be used globally in any activity and the array may be needed in any activity.
Intent intent = getIntent();
JSONArray beaconsArray = null;
String jsonArray = intent.getStringExtra("activeBeaconsArray");
try
{
beaconsArray = new JSONArray(jsonArray);
System.out.println(beaconsArray.toString(2));
}
catch (JSONException e) { e.printStackTrace();}
Should i store beaconsArray in any static array variable in a separate class so that I can use it any activity wherever needed OR should I make parent class that will be super class of all those classes which need this array (beaconsArray ) ?
I do not want to fetch it again and again from database!
Create a class which extends Application class and add your data to it. Any data you add to it will be persistent till the app ends.
A good example can be found here,
Using the Android Application class to persist data
http://www.helloandroid.com/tutorials/maintaining-global-application-state
or you can go for Sharedperefernce. But you have to understand that data added to them are persistent unless you overwrite it.