I have been reading the first answer here to setup a class to hold my global variables. I have created the following class within my applications java file, my main activity follows it:
class GlobalStore extends Application {
String str;
}
public class todo extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
GlobalStore appState = (GlobalStore) getApplicationContext();
String tmpstr = appState.str;
}
}
My manifest.xml file has the following tag:
<application android:icon="@drawable/icon"
android:label="@string/app_name"
android:name="GlobalStore">
I'm pretty sure I followed the instructions correctly however my app force closes when it starts. Hopefully someone can point out what I have done wrong as I can't work it out. Thanks.