get Edit Text Value - Android User Interface

Android examples for User Interface:EditText

Description

get Edit Text Value

Demo Code


//package com.java2s;
import android.app.Activity;
import android.widget.EditText;

public class Main {

    public static String getEditTextValue(Activity activity, int resId) {
        EditText editText = findViewById(activity, resId);
        return editText.getText().toString();
    }/* www . j a  v a  2  s .  c  om*/


    @SuppressWarnings("unchecked")
    public static <T> T findViewById(Activity activity, int id) {
        return (T) activity.findViewById(id);
    }
}

Related Tutorials