Android: Cannot access public static function or public variables from another class

view story

http://stackoverflow.com – Here is the declaration in 'MainActivity.java' private static String competition = null; I've created a setter function which adds value to it. public static void setCompetition(String competition1) { competition = competition1; } I've created a getter function to get the value in another class from the same package: public static String getCompetition() { return competition; } However it returns null. Here is how I tried to use it in a function public void onReceive(Context context, Intent intent) { with in the class AlarmNotify which extends BroadcastReceiver: fin (HowTos)