List of usage examples for android.text InputType TYPE_NUMBER_FLAG_DECIMAL
int TYPE_NUMBER_FLAG_DECIMAL
To view the source code for android.text InputType TYPE_NUMBER_FLAG_DECIMAL.
Click Source Link
From source file:com.nextgis.maplibui.formcontrol.TextEdit.java
@Override public void init(JSONObject element, List<Field> fields, Bundle savedState, Cursor featureCursor, SharedPreferences preferences) throws JSONException { ControlHelper.setClearAction(this); JSONObject attributes = element.getJSONObject(JSON_ATTRIBUTES_KEY); mFieldName = attributes.getString(JSON_FIELD_NAME_KEY); mIsShowLast = ControlHelper.isSaveLastValue(attributes); boolean enabled = ControlHelper.isEnabled(fields, mFieldName); String value = null;// w ww .j a v a 2 s .c o m if (ControlHelper.hasKey(savedState, mFieldName)) value = savedState.getString(ControlHelper.getSavedStateKey(mFieldName)); else if (null != featureCursor) { // feature exists int column = featureCursor.getColumnIndex(mFieldName); if (column >= 0) value = featureCursor.getString(column); } else { // new feature if (attributes.has(JSON_TEXT_KEY) && !attributes.isNull(JSON_TEXT_KEY)) value = attributes.getString(JSON_TEXT_KEY); if (mIsShowLast) value = preferences.getString(mFieldName, value); } boolean useLogin = attributes.optBoolean(USE_LOGIN); String accountName = element.optString(SyncStateContract.Columns.ACCOUNT_NAME); if (useLogin && !TextUtils.isEmpty(accountName)) { enabled = false; Activity activity = ControlHelper.getActivity(getContext()); if (activity != null) { GISApplication app = (GISApplication) activity.getApplication(); Account account = app.getAccount(accountName); value = app.getAccountLogin(account); } } setEnabled(enabled); setText(value); //let's create control int maxLines = attributes.getInt(JSON_MAX_STRING_COUNT_KEY); if (maxLines < 2) { setSingleLine(true); } else { setMaxLines(maxLines); } int fieldType = NOT_FOUND; for (Field field : fields) { if (field.getName().equals(mFieldName)) { fieldType = field.getType(); break; } } boolean onlyFigures = attributes.getBoolean(JSON_ONLY_FIGURES_KEY); if (onlyFigures) { //check field type switch (fieldType) { default: case GeoConstants.FTInteger: setInputType(InputType.TYPE_CLASS_NUMBER); break; case GeoConstants.FTReal: setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL); break; } } }
From source file:org.openmrs.mobile.activities.formdisplay.FormDisplayPageFragment.java
@Override public void createAndAttachNumericQuestionEditText(Question question, LinearLayout sectionLinearLayout) { LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); RangeEditText ed = new RangeEditText(getActivity()); ed.setName(question.getLabel());//from ww w .j a v a2 s .co m ed.setSingleLine(true); if (question.getQuestionOptions().getMax() != null) { ed.setHint(" [" + question.getQuestionOptions().getMin() + "-" + question.getQuestionOptions().getMax() + "]"); ed.setUpperlimit(Double.parseDouble(question.getQuestionOptions().getMax())); ed.setLowerlimit(Double.parseDouble(question.getQuestionOptions().getMin())); } else { ed.setHint(question.getLabel()); ed.setLowerlimit(-1.0); ed.setUpperlimit(-1.0); } ed.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16); if (question.getQuestionOptions().isAllowDecimal()) { ed.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL); } else { ed.setInputType(InputType.TYPE_CLASS_NUMBER); } InputField field = new InputField(question.getQuestionOptions().getConcept()); ed.setId(field.getId()); InputField inputField = getInputField(field.getConcept()); if (inputField != null) { inputField.setId(field.getId()); Double value = inputField.getValue(); if (-1.0 != value) ed.setText(value.toString()); } else { field.setConcept(question.getQuestionOptions().getConcept()); inputFields.add(field); } sectionLinearLayout.addView(generateTextView(question.getLabel())); sectionLinearLayout.addView(ed, layoutParams); }
From source file:com.pax.pay.trans.action.activity.InputTransData2Activity.java
private void setEditText_num(EditText editText, int len) { editText.setFilters(new InputFilter[] { new InputFilter.LengthFilter(len) }); editText.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL); }
From source file:com.app_software.chromisstock.StockChangeDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); // Get the layout inflater LayoutInflater inflater = getActivity().getLayoutInflater(); // Inflate and set the layout for the dialog // Pass null as the parent view because its going in the dialog layout View v = inflater.inflate(R.layout.dialog_stock_change, null); // Set information given in the Intent m_txtProductName = (TextView) v.findViewById(R.id.txtProductName); m_txtField = (TextView) v.findViewById(R.id.txtField); m_editNewValue = (EditText) v.findViewById(R.id.editNewValue); m_rbIncrease = (RadioButton) v.findViewById(R.id.rbIncrease); m_rbDecrease = (RadioButton) v.findViewById(R.id.rbDecrease); m_rbSetValue = (RadioButton) v.findViewById(R.id.rbSetValue); m_rbIncrease.setEnabled(m_bAllowAdjust); m_rbDecrease.setEnabled(m_bAllowAdjust); DatabaseHandler db = DatabaseHandler.getInstance(getActivity()); StockProduct product = db.getProduct(m_ProductID, true); if (product == null) { Log.e(TAG, "Product not found"); m_txtProductName.setText("DATABASE ERROR!!"); } else {//from w w w. j av a 2s .com m_ChromisID = product.getChromisId(); String name; if (TextUtils.isEmpty(product.getValueString(StockProduct.NAME))) { name = getResources().getString(R.string.change_newproduct); } else { name = product.getValueString(StockProduct.NAME); } m_txtProductName.setText(name); m_txtField.setText(m_FieldLabel); if (m_ChangeType == DatabaseHandler.CHANGETYPE_ADJUSTVALUE) { Double d = new Double(m_Value); if (d < 0) { m_rbDecrease.setChecked(true); d = d * -1; m_Value = String.format("%.0f", d); } else { m_rbIncrease.setChecked(true); } } else { m_rbSetValue.setChecked(true); } if (m_bIsNumber) { m_editNewValue.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL); } else { m_editNewValue.setInputType(InputType.TYPE_CLASS_TEXT); m_editNewValue.setText(m_Value); } m_editNewValue.setHint(m_Value); } // Add action buttons builder.setView(v).setPositiveButton(R.string.label_ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { // Create a new change record createChangeRecord(); } }).setNegativeButton(R.string.label_cancel, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { } }); return builder.create(); }
From source file:eu.hydrologis.geopaparazzi.maptools.FeaturePageAdapter.java
@Override public Object instantiateItem(ViewGroup container, int position) { final Feature feature = featuresList.get(position); int bgColor = context.getResources().getColor(R.color.formbgcolor); int textColor = context.getResources().getColor(R.color.formcolor); ScrollView scrollView = new ScrollView(context); ScrollView.LayoutParams scrollLayoutParams = new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);/*from w w w . j a v a 2 s . c o m*/ scrollLayoutParams.setMargins(10, 10, 10, 10); scrollView.setLayoutParams(scrollLayoutParams); scrollView.setBackgroundColor(bgColor); LinearLayout linearLayoutView = new LinearLayout(context); LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); int margin = 10; layoutParams.setMargins(margin, margin, margin, margin); linearLayoutView.setLayoutParams(layoutParams); linearLayoutView.setOrientation(LinearLayout.VERTICAL); int padding = 10; linearLayoutView.setPadding(padding, padding, padding, padding); scrollView.addView(linearLayoutView); List<String> attributeNames = feature.getAttributeNames(); List<String> attributeValues = feature.getAttributeValuesStrings(); List<String> attributeTypes = feature.getAttributeTypes(); for (int i = 0; i < attributeNames.size(); i++) { final String name = attributeNames.get(i); String value = attributeValues.get(i); String typeString = attributeTypes.get(i); DataType type = DataType.getType4Name(typeString); TextView textView = new TextView(context); textView.setLayoutParams( new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); textView.setPadding(padding, padding, padding, padding); textView.setText(name); textView.setTextColor(textColor); // textView.setTextAppearance(context, android.R.style.TextAppearance_Medium); linearLayoutView.addView(textView); final EditText editView = new EditText(context); LinearLayout.LayoutParams editViewParams = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); editViewParams.setMargins(margin, 0, margin, 0); editView.setLayoutParams(editViewParams); editView.setPadding(padding * 2, padding, padding * 2, padding); editView.setText(value); // editView.setEnabled(!isReadOnly); editView.setFocusable(!isReadOnly); // editView.setTextAppearance(context, android.R.style.TextAppearance_Medium); if (isReadOnly) { editView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { String text = editView.getText().toString(); FeatureUtilities.viewIfApplicable(v.getContext(), text); return false; } }); } switch (type) { case DOUBLE: case FLOAT: editView.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL); break; case PHONE: editView.setInputType(InputType.TYPE_CLASS_PHONE); break; case DATE: editView.setInputType(InputType.TYPE_CLASS_DATETIME); break; case INTEGER: editView.setInputType(InputType.TYPE_CLASS_NUMBER); break; default: break; } editView.addTextChangedListener(new TextWatcher() { public void onTextChanged(CharSequence s, int start, int before, int count) { // ignore } public void beforeTextChanged(CharSequence s, int start, int count, int after) { // ignore } public void afterTextChanged(Editable s) { String text = editView.getText().toString(); feature.setAttribute(name, text); } }); linearLayoutView.addView(editView); } /* * add also area and length */ if (feature.getOriginalArea() > -1) { TextView areaTextView = new TextView(context); areaTextView.setLayoutParams( new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); areaTextView.setPadding(padding, padding, padding, padding); areaTextView.setText("Area: " + areaLengthFormatter.format(feature.getOriginalArea())); areaTextView.setTextColor(textColor); TextView lengthTextView = new TextView(context); lengthTextView.setLayoutParams( new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); lengthTextView.setPadding(padding, padding, padding, padding); lengthTextView.setText("Length: " + areaLengthFormatter.format(feature.getOriginalLength())); lengthTextView.setTextColor(textColor); linearLayoutView.addView(areaTextView); linearLayoutView.addView(lengthTextView); } container.addView(scrollView); return scrollView; }
From source file:com.stan.createcustommap.MainActivity.java
private void addMarker() { if (mMap != null) { LinearLayout layout = new LinearLayout(MainActivity.this); layout.setLayoutParams(new ActionBar.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); layout.setOrientation(LinearLayout.VERTICAL); final EditText titleField = new EditText(MainActivity.this); titleField.setHint("Title"); final EditText latField = new EditText(MainActivity.this); latField.setHint("Latitude"); latField.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_NUMBER_FLAG_SIGNED); final EditText longField = new EditText(MainActivity.this); longField.setHint("Longitude"); longField.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_NUMBER_FLAG_SIGNED); layout.addView(titleField);//from w w w . j a v a 2 s.c om layout.addView(latField); layout.addView(longField); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle("Add Marker"); builder.setView(layout); AlertDialog alertDialog = builder.create(); builder.setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { boolean parsable = true; Double lat = null, lon = null; String strLat = latField.getText().toString(); String strLon = longField.getText().toString(); String strTitle = titleField.getText().toString(); try { lat = Double.parseDouble(strLat); } catch (NumberFormatException ex) { parsable = false; Toast.makeText(MainActivity.this, "Latitude does not contain a parsable double", Toast.LENGTH_LONG).show(); } try { lon = Double.parseDouble(strLon); } catch (NumberFormatException ex) { parsable = false; Toast.makeText(MainActivity.this, "Longitude does not contain a parsable double", Toast.LENGTH_LONG); } if (parsable) { LatLng targetLatLng = new LatLng(lat, lon); MarkerOptions markerOptions = new MarkerOptions().position(targetLatLng).title(strTitle); markerOptions.draggable(true); mMap.addMarker(markerOptions); mMap.moveCamera(CameraUpdateFactory.newLatLng(targetLatLng)); } } }); builder.setNegativeButton("Cancel", null); builder.show(); } else { Toast.makeText(MainActivity.this, "Map not ready", Toast.LENGTH_LONG).show(); } }
From source file:org.hawkular.client.android.fragment.ConfirmOperationFragment.java
private void createTable(OperationProperties operationProperties) { TableRow row = null;//w ww . j a v a 2 s. c o m Map<String, OperationParameter> operationParameters = operationProperties.getOperationParameters(); if (operationParameters != null) { for (Map.Entry<String, OperationParameter> entry : operationParameters.entrySet()) { switch (entry.getValue().getType()) { case "string": { row = (TableRow) LayoutInflater.from(getActivity()).inflate(R.layout.row_edit, null); EditText data = (EditText) row.findViewById(R.id.data); data.setText(entry.getValue().getDefaultValue()); data.setInputType(InputType.TYPE_CLASS_TEXT); break; } case "int": { row = (TableRow) LayoutInflater.from(getActivity()).inflate(R.layout.row_edit, null); EditText data = (EditText) row.findViewById(R.id.data); data.setText(entry.getValue().getDefaultValue()); data.setInputType(InputType.TYPE_CLASS_NUMBER); break; } case "float": { row = (TableRow) LayoutInflater.from(getActivity()).inflate(R.layout.row_edit, null); EditText data = (EditText) row.findViewById(R.id.data); data.setText(entry.getValue().getDefaultValue()); data.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL); break; } case "bool": { row = (TableRow) LayoutInflater.from(getActivity()).inflate(R.layout.row_toggle, null); SwitchCompat data = (SwitchCompat) row.findViewById(R.id.data); data.setChecked(entry.getValue().getDefaultValue().equals("true")); break; } } if (row != null) { TextView name = (TextView) row.findViewById(R.id.name); name.setText(entry.getKey()); table.addView(row); } } table.requestLayout(); } }
From source file:com.softminds.matrixcalculator.base_activities.FillingMatrix.java
@Override protected void onCreate(Bundle savedInstanceState) { SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this); boolean isDark = preferences.getBoolean("DARK_THEME_KEY", false); boolean SmartFit = preferences.getBoolean("SMART_FIT_KEY", false); if (isDark)/*from ww w .j a va2s . co m*/ setTheme(R.style.AppThemeDark_NoActionBar); else setTheme(R.style.AppTheme_NoActionBar); super.onCreate(savedInstanceState); Bundle bundle = getIntent().getExtras(); if (bundle == null) { Log.wtf("FillingMatrix", "How the heck, it got called ??"); Toast.makeText(getApplication(), R.string.unexpected_error, Toast.LENGTH_SHORT).show(); finish(); } else { col = bundle.getInt("COL"); row = bundle.getInt("ROW"); } setContentView(R.layout.filler); adCard = findViewById(R.id.AddCardFiller); if (!((GlobalValues) getApplication()).DonationKeyFound()) { AdView adView = findViewById(R.id.adViewFiller); AdRequest adRequest = new AdRequest.Builder().build(); adView.setAdListener(new AdLoadListener(adCard)); adView.loadAd(adRequest); if (getResources() .getConfiguration().orientation == android.content.res.Configuration.ORIENTATION_LANDSCAPE) adCard.setVisibility(View.INVISIBLE); else adCard.setVisibility(View.VISIBLE); } else ((ViewGroup) adCard.getParent()).removeView(adCard); Toolbar toolbar = findViewById(R.id.toolbarFill); setSupportActionBar(toolbar); CardView cardView = findViewById(R.id.DynamicCard); SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this); String string = sharedPreferences.getString("ELEVATE_AMOUNT", "4"); String string2 = sharedPreferences.getString("CARD_CHANGE_KEY", "#bdbdbd"); cardView.setCardElevation(Integer.parseInt(string)); CardView.LayoutParams params1 = new CardView.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT); GridLayout gridLayout = new GridLayout(getApplicationContext()); gridLayout.setRowCount(row); gridLayout.setColumnCount(col); for (int i = 0; i < row; i++) { for (int j = 0; j < col; j++) { EditText editText = new EditText(getApplication()); editText.setBackgroundColor(Color.parseColor(string2)); editText.setId(i * 10 + j); if (isDark) editText.setTextColor(ContextCompat.getColor(this, R.color.white)); editText.setGravity(Gravity.CENTER); SpannableStringBuilder stringBuilder = new SpannableStringBuilder( "a" + String.valueOf(i + 1) + String.valueOf(j + 1)); stringBuilder.setSpan(new SubscriptSpan(), 1, 3, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); stringBuilder.setSpan(new RelativeSizeSpan(0.75f), 1, 3, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); editText.setHint(stringBuilder); if (!PreferenceManager.getDefaultSharedPreferences(this).getBoolean("DECIMAL_USE", true)) { editText.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED); } else { editText.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_NUMBER_FLAG_SIGNED); } editText.setFilters(new InputFilter[] { new InputFilter.LengthFilter(getLength()) }); if (SmartFit) { editText.setWidth(ConvertTopx(CalculatedWidth(col))); editText.setTextSize(SizeReturner(row, col, PreferenceManager.getDefaultSharedPreferences(getApplicationContext()) .getBoolean("EXTRA_SMALL_FONT", false))); } else { editText.setWidth(ConvertTopx(62)); editText.setTextSize(SizeReturner(3, 3, PreferenceManager.getDefaultSharedPreferences(getApplicationContext()) .getBoolean("EXTRA_SMALL_FONT", false))); } editText.setSingleLine(); GridLayout.Spec Row = GridLayout.spec(i, 1); GridLayout.Spec Col = GridLayout.spec(j, 1); GridLayout.LayoutParams params = new GridLayout.LayoutParams(Row, Col); params.leftMargin = params.topMargin = params.bottomMargin = params.rightMargin = getResources() .getDimensionPixelOffset(R.dimen.border_width); gridLayout.addView(editText, params); } } gridLayout.setLayoutParams(params1); cardView.addView(gridLayout); MakeType((Type) (getIntent().getExtras().getSerializable("TYPE"))); if (GetMaximum() < GetMinimum()) { final Snackbar snackbar; snackbar = Snackbar.make(findViewById(R.id.filling_matrix), R.string.Warning3, Snackbar.LENGTH_INDEFINITE); snackbar.show(); snackbar.setAction(getString(R.string.action_settings), new View.OnClickListener() { @Override public void onClick(View view) { snackbar.dismiss(); Intent intent = new Intent(getApplicationContext(), SettingsTab.class); startActivity(intent); finish(); } }); } }
From source file:au.org.ala.fielddata.mobile.SurveyBuilder.java
public View buildInput(Attribute attribute, ViewGroup parent) { Record record = model.getRecord();//from w w w. j a v a2s . c o m View view; switch (attribute.getType()) { case STRING: view = buildEditText(InputType.TYPE_CLASS_TEXT, parent); break; case INTEGER: case NUMBER: view = buildEditText(InputType.TYPE_CLASS_NUMBER, parent); break; case DECIMAL: case ACCURACY: view = buildEditText(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL, parent); break; case MULTI_SELECT: case POINT_SOURCE: case STRING_WITH_VALID_VALUES: view = buildSpinner(attribute, parent); break; case CATEGORIZED_MULTI_SELECT: view = buildCategorizedSpinner(attribute, parent); break; case NOTES: view = buildEditText(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_FLAG_MULTI_LINE, parent); break; case WHEN: view = buildDatePicker(attribute, record, parent); break; case DWC_TIME: view = buildTimePicker(attribute, record, parent); break; case SPECIES_P: view = buildSpeciesPicker(attribute, parent); break; case POINT: view = buildLocationPicker(attribute, parent); break; case IMAGE: view = buildImagePicker(attribute, parent); break; case SINGLE_CHECKBOX: view = buildSingleCheckbox(attribute, parent); break; case MULTI_CHECKBOX: view = buildMultiSpinner(attribute, parent); break; default: view = buildEditText(InputType.TYPE_CLASS_TEXT, parent); break; } return view; }
From source file:pl.wasat.smarthma.ui.frags.base.BaseCollectionDetailsFragment.java
private AutoCompleteTextView resolvePattern(AutoCompleteTextView autoTextView, String pattern) { if (pattern == null) { autoTextView.setInputType(InputType.TYPE_CLASS_TEXT); return autoTextView; } else if (pattern.equalsIgnoreCase("[0-9]+")) { autoTextView.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL); return autoTextView; } else if (pattern.equalsIgnoreCase( "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?(Z|[\\+\\-][0-9]{2}:[0-9]{2})$")) { autoTextView.setInputType(InputType.TYPE_CLASS_DATETIME); return autoTextView; } else if (pattern.equalsIgnoreCase( "(\\[|\\])(100|[0-9]\\d?),(100|[0-9]\\d?)(\\[|\\])|(\\[|\\])?(100|[0-9]\\d?)|(100|[0-9]\\d?)(\\[|\\])?|\\{(100|[0-9]\\d?),(100|[0-9]\\d?)\\}")) { //autoTextView.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL | InputType.TYPE_NUMBER_FLAG_SIGNED); autoTextView.setKeyListener(new PatternNumberKeyListener()); return autoTextView; } else if (pattern.equalsIgnoreCase( "(\\[|\\])[0-9]+,[0-9]+(\\[|\\])|(\\[|\\])?[0-9]+|[0-9]+(\\[|\\])?|\\{[0-9]+,[0-9]+\\}")) { autoTextView.setKeyListener(new PatternNumberKeyListener()); return autoTextView; } else if (pattern.equalsIgnoreCase( "(\\[|\\])[0-9]+(.[0-9]+)?,[0-9]+(.[0-9]+)?(\\[|\\])|(\\[|\\])?[0-9]+(.[0-9]+)?|[0-9]+(.[0-9]+)?(\\[|\\])?|\\{[0-9]+(.[0-9]+)?,[0-9]+(.[0-9]+)?\\}")) { autoTextView.setKeyListener(new PatternNumberKeyListener()); return autoTextView; } else if (pattern.equalsIgnoreCase( "(\\[|\\])[0-9]+,[0-9]+(\\[|\\])|(\\[|\\])?[0-9]+|[0-9]+(\\[|\\])?|\\{[0-9]+,[0-9]+\\}")) { autoTextView.setKeyListener(new PatternNumberKeyListener()); return autoTextView; }//from ww w . j a v a2 s .c om return autoTextView; }