0

I want to display and run a button below a list which is loaded using the tenantlistadapter class. My problem is that i dont know where to put the object.

my class is as follows

public class TenantListAdapter extends BaseAdapter {

    private TenantList tenantList;
    private Context _context;
    private int selectedTenantPosition;
    static int selectedid;
    Button boutton_facebook;
    Intent browserIntent;

    public TenantListAdapter(Context context, TenantList array) {

        this.tenantList = array;

        this._context = context;
    }
...


@Override
    public View getView(int position, View convertView, ViewGroup parent) {
..
}

}

the view method display list view data only but i want the button to appear below the list. So putting the button inside the view is unsuitable because it displays only list data. is there another method to call the button outside the class ?

This is my xml file. i want the facebook button to appear below the list view

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    android:layout_width="fill_parent"

    android:layout_height="fill_parent"

    android:background="#ffffff"

    android:orientation="vertical" >

    <RelativeLayout

        android:layout_width="fill_parent"

        android:layout_height="wrap_content"

        android:layout_weight="0.3" >

        <ImageView

            android:id="@+id/nav_bar"

            android:layout_width="fill_parent"

            android:layout_height="wrap_content"

            android:scaleType="fitXY" />

        <Button android:id="@+id/back_button"

            android:layout_width="100dp"

            android:layout_height="60dp"

            android:layout_centerVertical="true"

            android:layout_alignParentLeft="true"

            android:background="@android:color/transparent"/>

    </RelativeLayout>

    <LinearLayout

        android:layout_width="fill_parent"

        android:layout_height="fill_parent"

        android:layout_weight="0.7"

        android:background="@drawable/home_background" >

        <ListView

            android:id="@id/android:list"

            android:layout_width="fill_parent"

            android:layout_height="355dp"

            android:layout_margin="10dp"

            android:cacheColorHint="#00000000" />


         <Button

        android:id="@+id/boutton_facebook"

        android:layout_width="fill_parent"

        android:layout_height="match_parent"

        android:drawableLeft="@drawable/f_logo"

        android:gravity="center_vertical|center_horizontal"

        android:text="@string/event"

        android:textSize="@dimen/facebook_button_text_size"

        android:textStyle="bold"

        android:typeface="serif" />

    </LinearLayout>


</LinearLayout>
Nitin Bathija
  • 800
  • 3
  • 12
  • 24
Dimitri
  • 1,924
  • 9
  • 43
  • 65

1 Answers1

0

Just do these changes..Use android:layout_below="@+id/android:list in Button Widget

    android:id="@+id/boutton_facebook"
    android:layout_width="fill_parent"
    android:layout_height="match_parent"
    android:drawableLeft="@drawable/f_logo"
    android:gravity="center_vertical|center_horizontal"
    android:text="@string/event"
    android:textSize="@dimen/facebook_button_text_size"
    android:textStyle="bold"
    android:typeface="serif"
    android:layout_below="@+id/android:list" />
Nitin Bathija
  • 800
  • 3
  • 12
  • 24