Code example for WeakReference

Methods: clear, get

0
			return false; 
		} 
 
		protected void onPostExecute(Boolean result) {
			if (result == false) {
				Toast.makeText(ref.get().getApplicationContext(), "Oops! There was an error", Toast.LENGTH_LONG);
			} 
			 
			detach(); 
		} 
 
		public void attach(CreateFinderActivity a) {
			ref = new WeakReference<CreateFinderActivity>(a);
		} 
 
		public void detach() { 
			ref.clear();
		} 
 
	} 
 
	private static class SubmitFinder