I'm trying to implement a basic login in my app. What I want to do is set a "Global" variable as true / false if user is logged in.
I've followed this tutorial. So this is my code now:
import android.app.Application;
public class GlobalParameters extends Application{
    private boolean loggedIn;
    public boolean isLoggedIn() {
    return loggedIn;
    }
    public void setLoggedIn(boolean loggedIn) {
    this.loggedIn = loggedIn;
    }
}
And this is on my onCreate:
GlobalParameters gp = ((GlobalParameters)getApplicationContext());
gp.setLoggedIn(false);
But GlobalParameters gp = ... throws this exception:
ClassCastException
I've added this too in my manifest:
<application android:name=".GlobalParameters" 
   android:icon="@drawable/ic_launcher" 
   android:label="@string/app_name">
</application>
Any idea?
Thanks.
 
     
     
    