最近、利用した時に、パワーアップさせたので、自分的メモ
public static final void cleanupView(View view) { try{ view.setBackgroundDrawable(null); }catch (Exception e) {} if (view instanceof ListView) { ListView lv = (ListView)view; lv.setAdapter(null); } if (view instanceof ImageView) { ImageView iv = (ImageView) view; iv.setOnClickListener(null); iv.setImageDrawable(null); try{ ((ViewGroup)view.getParent()).removeView(view); }catch (Exception e) {} }else if (view instanceof ViewGroup) { ViewGroup vg = (ViewGroup) view; while(vg.getChildCount()>0){ cleanupView(vg.getChildAt(0)); } try{ ((ViewGroup)view.getParent()).removeView(view); }catch (Exception e) {} }else{ try{ ((ViewGroup)view.getParent()).removeView(view); }catch (Exception e) {} } }