Java tutorial
//package com.java2s; import android.app.Activity; import android.widget.EditText; public class Main { public static String getText(Activity activity, int resourceId) { String result = null; EditText et = (EditText) activity.findViewById(resourceId); if (et != null) { result = et.getText().toString(); } return result; } }