Example usage for android.widget BaseAdapter notifyDataSetInvalidated

List of usage examples for android.widget BaseAdapter notifyDataSetInvalidated

Introduction

In this page you can find the example usage for android.widget BaseAdapter notifyDataSetInvalidated.

Prototype

public void notifyDataSetInvalidated() 

Source Link

Document

Notifies the attached observers that the underlying data is no longer valid or available.

Usage

From source file:com.wly.net.PortScannerActivity.java

@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
    boolean result = true;
    if (actionId == EditorInfo.IME_ACTION_NEXT || actionId == EditorInfo.IME_ACTION_DONE) {
        // the user is done typing.

        switch (v.getId()) {
        case R.id.host_name_text:
            Toast.makeText(this, "In host_name_text case statement.", Toast.LENGTH_SHORT).show();
            host = ((EditText) v).getText().toString();
            if (validateUrl(host))
                Toast.makeText(this, "The url " + host + " is valid.", Toast.LENGTH_SHORT).show();
            if (validateIp(host))
                Toast.makeText(this, "The ip address " + host + " is valid.", Toast.LENGTH_SHORT).show();
            break;
        case R.id.port_range_text:
            parsePorts(((EditText) v).getText().toString());
            BaseAdapter adapter = (BaseAdapter) ((PortListFragment) getSupportFragmentManager()
                    .findFragmentById(R.id.port_list_fragment)).getListAdapter();

            adapter.notifyDataSetInvalidated();
            adapter.notifyDataSetChanged();

            break;
        default://w ww . ja v a2s  .co m
            result = false;
            break;

        }

    }
    return result; // pass on to other listeners. 

}