I seem to have struck a wall with this problem of mine. Basically i'm working on an app which syncs your google tasks with the Google Tasks API. Everything is going great so far in my first activity. But now I want to create a new activity to show the users task lists. So to get the tasklists I need the connection object in this new activity. Normally I just give variables with i.putExtra() or something similiar but ofcourse this does not work with (custom) objects. I already tried to use Parceable and Serializable on a custom made class which had the object wrapped in it, but I keep getting errors about how the class (from Google API) itself does not implement these. It's also impossible to pass the parameters for creating a new instance of the class because they are themselfs custom objects from Google. Does anyone have an idea or experience with this?
It's the service object I need to pass to a new activity:
final HttpTransport httpTransport = AndroidHttp.newCompatibleTransport();
final JsonFactory jsonFactory = GsonFactory.getDefaultInstance();
credential = GoogleAccountCredential.usingOAuth2(this, Collections.singleton(TasksScopes.TASKS));
credential.setSelectedAccountName(settings.getString(PREF_ACCOUNT_NAME, null));
// Tasks Client
service = new com.google.api.services.tasks.Tasks.Builder(httpTransport, jsonFactory, credential).setApplicationName("Test").build();
Thanks in advance!