Code example for Button

Methods: setHeight, setId, setLayoutParams, setTag

0
     * @param text          The text of the button 
     * @param desiredHeight The desired height of the button 
     * @return The created view. 
     */ 
    public static View button(int position, Context context, String text, int desiredHeight) {
        TextView result = new Button(context);
        result.setHeight(desiredHeight);
        result.setText(text);
        final ViewGroup.LayoutParams lp = new AbsListView.LayoutParams(
                ViewGroup.LayoutParams.FILL_PARENT,
                ViewGroup.LayoutParams.WRAP_CONTENT);
        result.setLayoutParams(lp);
        result.setId(position);
        result.setTag("button");
        return result;
    } 
     
    /** 
     * Convert an existing button view to display the data at a new position. 
     *  
     * @param convertView Non-null Button created by {@link #button}