Java Code Examples for android.widget.TextView#requestFocus()
The following examples show how to use
android.widget.TextView#requestFocus() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IpcamActivity.java From openwebnet-android with MIT License | 5 votes |
protected boolean isValidUrl(TextView view) { if (view != null && !URLUtil.isValidUrl(editTextIpcamUrl.getText().toString())) { view.setError(validationUrl); view.requestFocus(); return false; } return true; }
Example 2
Source File: AbstractDeviceActivity.java From openwebnet-android with MIT License | 5 votes |
protected boolean isValidRequired(TextView view) { if (utilityService.isBlankText(view) || view.getText().equals(labelNone) || view.getText().equals(labelMissingGateway)) { view.setError(validationRequired); view.requestFocus(); return false; } return true; }
Example 3
Source File: AxisMappingDialogPreference.java From crazyflie-android-client with GNU General Public License v2.0 | 5 votes |
@Override protected View onCreateDialogView() { LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); LinearLayout layout = new LinearLayout(getContext()); layout.setOrientation(LinearLayout.VERTICAL); layout.setPadding(6,6,6,6); TextView promptTextView = new TextView(getContext()); promptTextView.setText(R.string.preferences_axis_mapping_dialog_text); promptTextView.setGravity(Gravity.CENTER_HORIZONTAL); mValueTextView = new TextView(getContext()); mValueTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 22); mValueTextView.setGravity(Gravity.CENTER_HORIZONTAL); mValueTextView.setPadding(0, 12, 0, 12); mValueTextView.setOnGenericMotionListener(this); //TODO: is there an easier way to make this work? //motion events are not captured when view is not focusable mValueTextView.setFocusableInTouchMode(true); //if focus is not set, right analog stick events are only recognized after the left analog stick is moved!?! mValueTextView.requestFocus(); layout.addView(promptTextView, params); layout.addView(mValueTextView, params); return layout; }
Example 4
Source File: SetupLayouts.java From Lucid-Browser with Apache License 2.0 | 5 votes |
@SuppressLint({"InflateParams", "PrivateResource"}) static void setUpActionBar(int actionBarType, MainActivity activity) { //if activity is restarted actionBarNum could still be set but bar layout is empty boolean forceLayout = activity.barHolder.getChildCount()==0; if (forceLayout || actionBarType != actionBarNum) { switch (actionBarType) { case ACTIONBAR_BROWSER: activity.barHolder = (RelativeLayout) activity.getLayoutInflater().inflate(R.layout.browser_bar, null); activity.barHolder.removeAllViews(); activity.barHolder.addView(activity.browserBar, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); activity.actionBar.setDisplayHomeAsUpEnabled(false); activity.actionBar.setCustomView(activity.barHolder); break; case ACTIONBAR_FIND: SetupLayouts.setUpFindBar(activity); activity.actionBar.setDisplayHomeAsUpEnabled(false); activity.actionBar.setHomeAsUpIndicator(R.drawable.abc_ic_clear_material); activity.setUpFindBarListeners(); TextView findText = activity.actionBar.getCustomView().findViewById(R.id.find_searchbar); findText.requestFocus(); MainActivity.imm.showSoftInput(findText, InputMethodManager.SHOW_IMPLICIT); break; } actionBarNum = actionBarType; } }