Ref: Android:- How to Make dynamic HashMap Accessible in whole application? I have set up a CustomHashMap (just a collection of 3 LinkedHashMaps) so that I can access it from 2 Activities, but I am unable to access it from the SecondActivity! The only way to remove red errors in Manifest.xml is to set the lines below. If I use android:name="com.example.intents.CustomHashMap" (following the online example) I get an error saying 'is not an enclosing class'.
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher_icon"
android:label="@string/app_name"
android:theme="@style/CustomActionBarTheme"
android:name="com.example.intents.MainActivity$CustomHashMap"> //--- The system added the $ parts here.
<activity
....
protected CustomHashMap thisMap;
....
thisMap = (MainActivity.CustomHashMap)getApplication();
In MainActivity I can do things like thisMap.getKeyValue(4) but from SecondActivity only null is returned. I feel as if I am missing something very simple here. Any ideas?