Example usage for android.widget SimpleAdapter notifyDataSetChanged

List of usage examples for android.widget SimpleAdapter notifyDataSetChanged

Introduction

In this page you can find the example usage for android.widget SimpleAdapter notifyDataSetChanged.

Prototype

public void notifyDataSetChanged() 

Source Link

Document

Notifies the attached observers that the underlying data has been changed and any View reflecting the data set should refresh itself.

Usage

From source file:com.woodblockwithoutco.beretainedexample.widget.support.RecyclerViewFragment.java

public void setItems(CharSequence[] items) {
    mItems = items;//from  w  ww . ja v  a2s .  com

    if (mRecyclerView != null) {
        SimpleAdapter adapter = (SimpleAdapter) mRecyclerView.getAdapter();
        adapter.setItems(items);
        adapter.notifyDataSetChanged();
    }
}

From source file:org.adaway.ui.adware.AdwareFragment.java

/**
 * Display the installed adware.// w w w  .j  ava  2 s  .  c  om
 *
 * @param data The adware to show.
 */
private void displayAdware(List<AdwareInstall> data) {
    // Create adapter
    String[] from = new String[] { AdwareInstall.APPLICATION_NAME_KEY, AdwareInstall.PACKAGE_NAME_KEY };
    int[] to = new int[] { R.id.checkbox_list_text, R.id.checkbox_list_subtext };
    SimpleAdapter adapter = new SimpleAdapter(this.getContext(), data, R.layout.list_two_entries, from, to);
    // Update list
    adapter.notifyDataSetChanged();
    // Show the list
    this.mListView.setAdapter(adapter);
    this.mStatusText.setVisibility(View.GONE);
    this.mListView.setVisibility(View.VISIBLE);
}

From source file:com.fangyuan.vpngate.MainActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);//from  w w w. ja v a2  s.  c  o  m

    mContext = this;

    mListView = (ListView) findViewById(R.id.vpn_list);
    mListView.setDividerHeight(16);

    mListItems = new ArrayList<HashMap<String, Object>>();
    SimpleAdapter adapter = new SimpleAdapter(this, mListItems, R.layout.vpn_summary,
            new String[] { "country", "ip" }, new int[] { R.id.country, R.id.ip });
    mListView.setAdapter(adapter);

    hosts = getSharedPreferences("vpngate", MODE_PRIVATE).getString("hosts", null);
    if (hosts != null) {
        parseHostsString(hosts);
    }

    mHandler = new Handler() {
        public void handleMessage(Message msg) {
            hosts = msg.getData().getString("hosts");
            if (hosts != null) {
                if (parseHostsString(hosts)) {
                    SimpleAdapter adapter = (SimpleAdapter) mListView.getAdapter();
                    adapter.notifyDataSetChanged();
                }

            }
            getActionBarHelper().setRefreshActionItemState(false);
        }
    };
}