Android Open Source - arcgis-android-sdk-gradle-samples Edit Text Utils






From Project

Back to project page arcgis-android-sdk-gradle-samples.

License

The source code is released under:

Apache License

If you think the Android project arcgis-android-sdk-gradle-samples listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/* Copyright 2014 ESRI
 */* w ww .ja v a2  s .  c  om*/
 * All rights reserved under the copyright laws of the United States
 * and applicable international laws, treaties, and conventions.
 *
 * You may freely redistribute and use this sample code, with or
 * without modification, provided you include the original copyright
 * notice and use restrictions.
 *
 * See the Sample code usage restrictions document for further information.
 *
 */

package com.arcgis.android.samples.localdata.localrasterdata;

import android.view.View;
import android.widget.EditText;

/*
 * Defines some commonly used constants and methods to handle EditText.
 */
public class EditTextUtils {
  
  public final static double  DEFAULT_DOUBLE_VALUE = Double.NEGATIVE_INFINITY;
  public final static int DEFAULT_INT_VALUE = Integer.MIN_VALUE;
  
  private EditTextUtils() {
    throw new AssertionError();
  }

  public static double getEditTextValue(EditText text) {
    double ret = DEFAULT_DOUBLE_VALUE;
    
    String textString = text.getText().toString();
    if (textString != null && textString.length() > 0) {
      ret = Double.parseDouble(textString);
    }
    
    return ret;
  }
  
  public static void setEditTextValue(View view, int id, double value) {
    if (value != EditTextUtils.DEFAULT_DOUBLE_VALUE) {
      EditText editText = (EditText) view.findViewById(id);
      if (editText != null)  {
        editText.setText(Double.toString(value));
      }
    }
  }
}




Java Source Code List

com.arcgis.android.samples.cloudportal.featureservicetablequery.MainActivity.java
com.arcgis.android.samples.cloudportal.querycloudfeatureservice.MainActivity.java
com.arcgis.android.samples.localdata.localrasterdata.EditTextUtils.java
com.arcgis.android.samples.localdata.localrasterdata.FileBrowserFragment.java
com.arcgis.android.samples.localdata.localrasterdata.HillshadeRendererParametersFragment.java
com.arcgis.android.samples.localdata.localrasterdata.MainActivity.java
com.arcgis.android.samples.localdata.localrasterdata.OnDialogDismissListener.java
com.arcgis.android.samples.localdata.localrasterdata.RendererType.java
com.arcgis.android.samples.localdata.localrasterdata.StretchParametersFragment.java
com.arcgis.android.samples.maps.basemaps.MainActivity.java
com.arcgis.android.samples.maps.fragmentmanagement.BasemapListFragment.java
com.arcgis.android.samples.maps.fragmentmanagement.MainActivity.java
com.arcgis.android.samples.maps.fragmentmanagement.MapFragment.java
com.arcgis.android.samples.maps.helloworld.MainActivity.java
com.arcgis.android.samples.maps.maplegend.LegendDialogFragment.java
com.arcgis.android.samples.maps.maplegend.MainActivity.java
com.arcgis.android.samples.maps.maprotation.Compass.java
com.arcgis.android.samples.maps.maprotation.MainActivity.java
com.arcgis.android.samples.maps.switchmaps.MainActivity.java
com.arcgis.android.samples.maps.switchmaps.MapFragment.java
com.arcgis.android.samples.search.placesearch.MainActivity.java
com.esri.arcgis.android.samples.wmslayer.MainActivity.java