Example usage for android.widget TextView clearFocus

List of usage examples for android.widget TextView clearFocus

Introduction

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

Prototype

public void clearFocus() 

Source Link

Document

Called when this view wants to give up focus.

Usage

From source file:ch.eitchnet.android.mabea.activity.SettingsFragment.java

public void updateUi() {
    if (this.rootView == null)
        return;// w ww  .j a va 2 s .  co  m

    MabeaContext context = MabeaApplication.getContext();
    Setting setting = context.getSetting();
    TextView textView;
    textView = (TextView) this.rootView.findViewById(R.id.settingMabeaName);
    textView.clearFocus();
    textView.setText(setting.getName());
    textView = (TextView) this.rootView.findViewById(R.id.settingMabeaUrl);
    textView.setText(setting.getUrl());
    textView = (TextView) this.rootView.findViewById(R.id.settingMabeaUsername);
    textView.setText(setting.getUsername());

    debugChk.setChecked(context.isDebugEnabled());
    statusTxt.setText(context.getConnectionStateMsg());
    statusTxt.requestFocus();
}

From source file:mobisocial.bento.todo.ui.TodoDetailFragment.java

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

    // extract UUID from intent
    mTodoUuid = getActivity().getIntent().getStringExtra(EXTRA_TODO_UUID);

    // View/* w w  w  . j  av  a  2  s  .c om*/
    mRootView = (ViewGroup) inflater.inflate(R.layout.fragment_todo_detail, container);

    mTitle = (EditText) mRootView.findViewById(R.id.todo_title);
    mDescription = (EditText) mRootView.findViewById(R.id.todo_description);
    mDescription.setOnEditorActionListener(new EditText.OnEditorActionListener() {
        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
            if (actionId == EditorInfo.IME_ACTION_SEARCH || actionId == EditorInfo.IME_ACTION_DONE
                    || event.getAction() == KeyEvent.ACTION_DOWN
                            && event.getKeyCode() == KeyEvent.KEYCODE_ENTER) {
                Log.d(TAG, "onEditorAction");
                // clear focus
                v.clearFocus();

                // close keyboard
                InputMethodManager mgr = (InputMethodManager) getActivity()
                        .getSystemService(Context.INPUT_METHOD_SERVICE);
                mgr.hideSoftInputFromWindow(mDescription.getWindowToken(), 0);

                return true;
            }
            return false;
        }
    });
    mImageView = (ImageView) mRootView.findViewById(R.id.todo_image);

    // retrieve Todo data
    if (mTodoUuid != null) {
        mTodoItem = mManager.getTodoListItem(mTodoUuid);
        if (mTodoItem != null) {
            mTitle.setText(mTodoItem.title);
            mDescription.setText(mTodoItem.description);
            if (mTodoItem.hasImage) {
                mImageView.setImageBitmap(mManager.getTodoBitmap(mTodoItem.uuid, IMG_WIDTH, IMG_HEIGHT, 0));
                mImageView.setVisibility(View.VISIBLE);
            } else {
                mImageView.setVisibility(View.GONE);
            }
        }
    }

    return mRootView;
}

From source file:org.dharmaseed.android.NavigationActivity.java

@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
    Log.i("onEditorAction", v.getText().toString());

    // Close keyboard
    InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.hideSoftInputFromWindow(v.getWindowToken(), 0);

    // Give up focus (which will invoke onFocusChange below to hide the cursor and keyboard)
    v.clearFocus();

    // Search for talks meeting the new criteria
    updateDisplayedData();/*from  w  ww . j  a va2s. c  om*/

    // Scroll to the top of the list
    resetListToTop();

    return false;
}

From source file:universe.constellation.orion.viewer.OrionViewerActivity.java

public void updatePageSeeker() {
    SeekBar pageSeek = (SeekBar) findMyViewById(R.id.page_picker_seeker);
    pageSeek.setProgress(controller.getCurrentPage());
    TextView view = (TextView) findMyViewById(R.id.page_picker_message);
    view.setText("" + (controller.getCurrentPage() + 1));
    view.clearFocus();
    view.requestFocus();//from w ww .  j  a  v  a  2s.c om

}