Java tutorial
//package com.java2s; //License from project: Open Source License import android.view.View; import android.widget.Button; import android.widget.CheckBox; import android.widget.TextView; public class Main { public static Object extractValueFromView(View view) { if (view instanceof Button) { Button b = (Button) view; return b.getText().toString(); } else if (view instanceof CheckBox) { CheckBox c = (CheckBox) view; return c.isChecked(); } else if (view instanceof TextView) { TextView t = (TextView) view; return t.getText().toString(); } return null; } }