Code example for WeakReference

  private final WeakReference<HistoryManager> historyManagerRef;
  private final List<Spannable> newContents;
  private final List<String[]> newHistories;
  SupplementalInfoRetriever(TextView textView, HistoryManager historyManager) {
    textViewRef = new WeakReference<TextView>(textView);
    historyManagerRef = new WeakReference<HistoryManager>(historyManager);
    newContents = new ArrayList<Spannable>();
    newHistories = new ArrayList<String[]>();
  public final Object doInBackground(Object... args) {
    try { 
    } catch (IOException e) {
      Log.w(TAG, e);
    return null; 
Connect your IDE to all the code out there  Get Codota for Java