3/5/2014 - 9:05 PM

Views : TextViews

Views : TextViews

//Some exmaple view imports
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ListView;
import android.widget.TextView;

//Creating textview fields
private static TextView dateView;
	private static TextView timeView;

//Initializing a textview field's value to a xml layout:
dateView = (TextView) findViewById(;
		timeView = (TextView) findViewById(;

//inflating a textView, onCreate()
TextView <<tvInstanceName>> = (TextView) getLayoutInflater().inflate(R.<<tvXMLLayout>>, null);

// Setting textview within a adapter/ITEM context.  
//1. Setting a TextView id'd element text value of an ITEM within a layout

    //1a. Instanced layout object's view set to XML layout for ITEM.
    RelativeLayout itemLayout = (RelativeLayout) LayoutInflater.from(
                            mContext).inflate(R.layout.todo_item, null);
    //1b. Setting the text to a specific textview .   
    final TextView titleView = (TextView) itemLayout.findViewById(;
    //1c.  Defined elsewhere <<externalClassName>>, such as methods for ITEM.  
    public String getTitle() {
		return mTitle;