In my android app, I have a GoogleApiClient mGoogleApiClient;
object. I want to pass it from the login.java class to MainActivity.java class.
I have tried to use Serializable and Parcelable.
Intent mainIntent = new Intent(this, MainActivity.class);
mainIntent.putExtra("googleapi", (Serializable) mGoogleApiClient);
startActivity(mainIntent);
I get this error java.lang.ClassCastException: com.google.android.gms.common.api.c cannot be cast to java.io.Serializable
.
Now if I try to pass a string, it works. I can understand that I can't cast a GoogleAPIClient class to Serializable.
How should I send this object to other class?