Code example for WeakReference

Methods: clear

0
		public void attach(WeaponActivity a) {
			ref = new WeakReference<WeaponActivity>(a);
		} 
 
		public void detach() { 
			ref.clear();
		} 
	} 
 
	public void updateAsyncTaskProgress(Weapon u) {
		weaponList.add(u);
		adapter.notifyDataSetChanged();
	} 
 
	/* 
	@Override 
	protected Dialog onCreateDialog(int id) { 
		AlertDialog.Builder builder = new AlertDialog.Builder(this); 
		builder.setMessage("Choose an option").setCancelable(true).setPositiveButton("Apply", new DialogInterface.OnClickListener() { 
			public void onClick(DialogInterface dialog, int id) {