clean Up View Adapter - Android User Interface

Android examples for User Interface:View

Description

clean Up View Adapter

Demo Code

import android.view.View;
import android.widget.AdapterView;

public class Main {

  @SuppressWarnings({ "unchecked", "rawtypes" })
  private static void cleanUpAdapter(View view) {
    if (view instanceof AdapterView) {
      try {//from   ww  w. j av a  2s .  co m
        ((AdapterView) view).setAdapter(null);
      } catch (IllegalArgumentException e) {
      } catch (NullPointerException e) {
      }
    }
  }
}

Related Tutorials