Java tutorial
//package com.java2s; import android.view.View; import android.widget.TextView; public class Main { /** * Returns the text content of the view with the given resourceId. */ private static String getText(View view, int resourceId) { view = view.getRootView(); TextView textView = TextView.class.cast(view.findViewById(resourceId)); return textView.getText().toString(); } }