Android Base Activity: Base's Global Variables, Can't get from some activites -


i'm taking android class now, new android app development.

my first assumption base activity it's global variables , it's values available activities. have found available main activity, not activities after that.

in base activity storing arraylist of objects. load data xml in there adds objects arraylist. once in main activity still have access arraylist , it's values. use fill list. when go next activity, knows arraylist thinks empty.

do need create methods in base activity retrieve arraylist , add objects array list?

any appreciated.

thank you,

michelle

global variables need declared static. accessible class. example:

public class globals { public static string mystring; } 

any class can read/write mystring this:

globals.mystring = "foo"; 

or

string bar = globals.mystring; 

Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

c++ - Accessing inactive union member and undefined behavior? -

php - Get uncommon values from two or more arrays -