Skip to content

Instantly share code, notes, and snippets.

Jeff McKnight JeffMcKnight

Block or report user

Report or block JeffMcKnight

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
jesty /
Last active Aug 26, 2019
Share cookies between WebView and OkHttpClient 3 / Retrofit 2. In the example I did the login on a web page in a WebView component and then I used the cookie to invoke a service from an activity
//Setup the client
OkHttpClient client = new OkHttpClient.Builder()
.cookieJar(new CookieJar() {
public void saveFromResponse(HttpUrl url, List<Cookie> cookies) {
hamakn /
Created Apr 6, 2015
Android: Get height of status, action, navigation bar (pixels)
// status bar height
int statusBarHeight = 0;
int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
statusBarHeight = getResources().getDimensionPixelSize(resourceId);
// action bar height
int actionBarHeight = 0;
final TypedArray styledAttributes = getActivity().getTheme().obtainStyledAttributes(
franmontiel /
Last active Nov 13, 2019
A persistent CookieStore implementation for use in Android with HTTPUrlConnection or OkHttp 2. -- For a OkHttp 3 persistent CookieJar implementation you can use this library:
* Copyright (c) 2015 Fran Montiel
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing, software
You can’t perform that action at this time.