Java Code Examples for android.widget.TextView.requestFocus()

The following are Jave code examples for showing how to use requestFocus() of the android.widget.TextView class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: open-rmbt   File: RMBTTermsCheckFragment.java   View Source Code Vote up 6 votes
@Override
public void onResume()
{
    super.onResume();
    final Activity activity = getActivity();
    final boolean tcAccepted = ConfigHelper.isTCAccepted(activity);
    if (tcAccepted)
    {
        final TextView buttonTermsAccept = (TextView) view.findViewById(R.id.termsAcceptButton);
        buttonTermsAccept.setFocusable(true); //set focus on button so that terms can be accepted on Android TV like devices (5-way-navigation)
        buttonTermsAccept.setFocusableInTouchMode(false);
        buttonTermsAccept.requestFocus();
        buttonTermsAccept.setText(R.string.terms_accept_button_continue);
        view.findViewById(R.id.termsAcceptText).setVisibility(View.GONE);
    }
}
 
Example 2
Project: FastAndroid   File: ContactDetailActivity.java   View Source Code Vote up 5 votes
private void initView() {
    mTargetPortrait = (AsyncImageView) findViewById(R.id.target_portrait);
    mTargetName = (TextView) findViewById(R.id.target_name);
    mArrow = (ImageView) findViewById(R.id.target_group_arrow);
    mContactName = (TextView) findViewById(R.id.contact_name);
    mMessage = (EditText) findViewById(R.id.message);
    mSend = (TextView) findViewById(R.id.send);
    mCancel = (TextView) findViewById(R.id.cancel);
    mViewAnimator = (ViewAnimator) findViewById(R.id.va_detail);
    mGridView = (GridView) findViewById(R.id.gridview);

    mCancel.requestFocus();
    this.setFinishOnTouchOutside(false);
}
 
Example 3
Project: sealtalk-android-master   File: ContactDetailActivity.java   View Source Code Vote up 5 votes
private void initView() {
    mTargetPortrait = (AsyncImageView) findViewById(R.id.target_portrait);
    mTargetName = (TextView) findViewById(R.id.target_name);
    mArrow = (ImageView) findViewById(R.id.target_group_arrow);
    mContactName = (TextView) findViewById(R.id.contact_name);
    mMessage = (EditText) findViewById(R.id.message);
    mSend = (TextView) findViewById(R.id.send);
    mCancel = (TextView) findViewById(R.id.cancel);
    mViewAnimator = (ViewAnimator) findViewById(R.id.va_detail);
    mGridView = (GridView) findViewById(R.id.gridview);

    mCancel.requestFocus();
    this.setFinishOnTouchOutside(false);
}
 
Example 4
Project: treetracker-android   File: ForgotPasswordFragment.java   View Source Code Vote up 3 votes
public void onClick(View v) {
	
	
	v.performHapticFeedback(HapticFeedbackConstants.VIRTUAL_KEY, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
	
	switch (v.getId()) {
		case R.id.fragment_forgot_password_submit:
			
		boolean validForm = true;
		TextView forgotEmail = (TextView) getActivity().findViewById(R.id.fragment_forgot_password_email_address);
		
		if (forgotEmail .getText().length() == 0) {
			forgotEmail.setError("Please enter your e-mail address.");
			forgotEmail.requestFocus();
			validForm  = false;
		} else if (!android.util.Patterns.EMAIL_ADDRESS.matcher(forgotEmail.getText()).matches()) {
			forgotEmail.setError("Please enter valid e-mail address.");
			forgotEmail.requestFocus();
			validForm = false;
		}
		
		
		if (validForm) {
			InputMethodManager inputManager = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
			inputManager.hideSoftInputFromWindow(forgotEmail.getWindowToken(), 0);

			mResetPassTask = new ResetPasswordTask().execute(new String[]{forgotEmail.getText().toString()});
		}
			
			
		break;

	}
	
}