Example usage for android.widget TextView setOnEditorActionListener

List of usage examples for android.widget TextView setOnEditorActionListener

Introduction

In this page you can find the example usage for android.widget TextView setOnEditorActionListener.

Prototype

public void setOnEditorActionListener(OnEditorActionListener l) 

Source Link

Document

Set a special listener to be called when an action is performed on the text view.

Usage

From source file:com.yek.keyboard.ui.dev.DeveloperToolsFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ((TextView) view.findViewById(R.id.dev_title))
            .setText(DeveloperUtils.getAppDetails(getActivity().getApplicationContext()));

    mFlipper = (Button) view.findViewById(R.id.dev_flip_trace_file);
    mProgressIndicator = view.findViewById(R.id.dev_tracing_running_progress_bar);
    mShareButton = view.findViewById(R.id.dev_share_trace_file);

    view.findViewById(R.id.memory_dump_button).setOnClickListener(this);
    view.findViewById(R.id.dev_share_mem_file).setOnClickListener(this);
    view.findViewById(R.id.dev_flip_trace_file).setOnClickListener(this);
    view.findViewById(R.id.dev_share_trace_file).setOnClickListener(this);
    view.findViewById(R.id.show_logcat_button).setOnClickListener(this);
    view.findViewById(R.id.share_logcat_button).setOnClickListener(this);

    TextView textWithListener = (TextView) view.findViewById(R.id.actionDoneWithListener);
    textWithListener.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        @Override// w w w.  ja  v  a  2s .c o m
        public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
            Toast.makeText(getContext().getApplicationContext(), "OnEditorActionListener i:" + i,
                    Toast.LENGTH_SHORT).show();
            return true;
        }
    });
}