Skip to content

Instantly share code, notes, and snippets.

@tiann
tiann / BetterAsyncTask.java
Last active April 3, 2021 13:35
Better AsyncTask: 1. deal AbortPolicy 2. can run in thread 3. run in parallel 4. avoid crash
package com.example.test.app;/*
* Copyright (C) 2008 The Android Open Source Project
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@ypresto
ypresto / FragmentItemIdStatePagerAdapter.java
Created July 13, 2015 14:28
Modified FragmentStatePagerAdapter which correctly handles reordering of items and saved states. Original issue: https://code.google.com/p/android/issues/detail?id=37990
/*
* Copyright (C) 2011 The Android Open Source Project
* Copyright (C) 2015 Yuya Tanaka
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@bryanstern
bryanstern / OkHttpStack.java
Last active April 24, 2022 03:17
An OkHttp backed HttpStack for Volley
/**
* The MIT License (MIT)
*
* Copyright (c) 2015 Circle Internet Financial
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is