im trying to make an activity that searches a DB based on an input string and then returns the results in a list view. All this is working however, My listview items are not clickable. I have tried changing the focus and clickable attributes but nothing has worked so far.
Main XML (add_friend_layout.xml):
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout android:id="#+id/AddFriendHeaderLayout"
android:layout_marginTop="3dip"
android:layout_height="45dip"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:gravity="center">
<EditText
android:id="#+id/et_SearchFriend"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="20dp"
android:ems="10"
android:inputType="text" />
<Button
android:id="#+id/bt_SearchFriend"
android:layout_width="wrap_content"
android:layout_height="40dip"
android:focusable="false"
android:icon="#android:drawable/ic_search_category_default"
android:text="Search" >
</Button>
</LinearLayout>
<LinearLayout android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginTop="60dip"
android:layout_marginBottom="5dip"
android:layout_alignParentBottom="true"
android:layout_above="#+id/AddFriendHeaderLayout"
android:id="#+id/searchFriendFooterLayout">
<ListView
android:id="#android:id/list"
android:layout_width="match_parent"
android:clickable="true"
android:layout_height="wrap_content">
</ListView>
</LinearLayout>
</RelativeLayout>
ListView XML (single_listview_layout.xml):
<?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="wrap_content"
android:clickable="true" >
<TextView
android:id="#+id/tv_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dp"
android:textSize="20sp" >
</TextView>
</LinearLayout>
Main Java Function (SearchFriendActivity.java):
public class SearchFriendActivity extends ListActivity {
//Progress Dialog
private ProgressDialog pDialog;
private Button bt_searchFriend;
private EditText et_Search_String;
private ListView tv_listview;
String[] arrFriends;
String[] arrUserId;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try{
setContentView(R.layout.add_friend_layout);
bt_searchFriend= (Button) findViewById(R.id.bt_SearchFriend);
et_Search_String = (EditText) findViewById(R.id.et_SearchFriend);
tv_listview = (ListView) findViewById(R.id.tv_list);
String searchString="";
//searchString = String.valueOf(et_Search_String.getText());
Log.i ("log_search","value of searchString: " + searchString);
bt_searchFriend.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View view) {
try{
searchFriends aTask = new searchFriends();
aTask.execute(String.valueOf(et_Search_String.getText()));
String rResult = aTask.get();
// Convert aResult to array
arrFriends = convertJSONData(rResult);
arrUserId = convertJSONDataToUserArray(rResult);
setListAdapter(new ArrayAdapter<String>
(getBaseContext(),
R.layout.single_listview_layout,
R.id.tv_list,
arrFriends));
}catch(Exception e){
Log.e ("log_search_load",e.toString());
}
}
});
tv_listview = getListView();
//handler for List Item click
tv_listview.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
// When clicked, show a toast with the TextView text
Toast.makeText(getApplicationContext(),
"Friend request sent for " +
((TextView) view).getText(),
Toast.LENGTH_SHORT).show();
Log.i("log_search_listclick", "Listview clicked");
}
});
}catch(Exception e){
Log.e ("log_search_load2",e.toString());
}
}
Firstly, don't use focusable and clickable. When you use setOnclick or another they are auto creating.
Secondly, remove try cache blog then start application. Because when the problem created program will contining and you can't understand where is the problem.
===>Thirdly<====
you are used (tv_listview=...) second twice
tv_listview = (ListView) findViewById(R.id.tv_list);
tv_listview = getListView();
then you are trying tv_listview.setOnItemClickListener..... If second view is not first view seton not working on "R.id.tv_list".
Related
Previously i worked with GridView and set ChoiceMode to single and everything was OK.
Now i create my Custom Adapter with it's Layout.
And then added items to the GridView.
And set ChoiceMode to Single, As below you will see.
But Choice mode does not work in appearance and view.
Here is Custom Adapter :
public class CarAdapter extends ArrayAdapter<Car>{
public CarAdapter(Context context, int resource, ArrayList<Car> carArrayList) {
super(context, resource, carArrayList);
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
Car car = getItem(position);
if(convertView == null)
{
convertView = LayoutInflater.from(getContext()).inflate(R.layout.item_car,parent, false);
}
TextView carName = (TextView)convertView.findViewById(R.id.textView2);
TextView carSIM = (TextView)convertView.findViewById(R.id.textView);
carName.setText(car.getName());
carSIM.setText(car.getSIM());
return convertView;
}
}
And here is it's Layout XML :
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal" android:layout_width="match_parent"
android:layout_height="match_parent"
android:weightSum="1"
android:layout_marginTop="30dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="Small Text"
android:id="#+id/textView2"
android:layout_x="12dp"
android:layout_y="2dp"
android:textColor="#000"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_marginLeft="20dp"
android:id="#+id/textView"
android:layout_x="157dp"
android:layout_y="0dp"
android:textColor="#000"/>
</AbsoluteLayout>
And here is Main Activity :
public class DisplayActivity extends Activity {
CarAdapter carAdapter;
Car car;
Car car2;
Car car3;
ArrayList<Car> carArrayList;
GridView gridView;
Button test;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_display);
carArrayList = new ArrayList<Car>();
gridView = (GridView) findViewById(R.id.gridView);
carAdapter = new CarAdapter(getApplicationContext(), android.R.layout.select_dialog_singlechoice, carArrayList);
test = (Button) findViewById(R.id.button);
car = new Car("Test", "aaa");
car2 = new Car("Test2", "aaa");
car3 = new Car("Test3", "aaa");
Car car4 = new Car("Test4", "aaa");
carArrayList.add(car);
carArrayList.add(car2);
carArrayList.add(car3);
carArrayList.add(car4);
gridView.setAdapter(carAdapter);
Toast.makeText(getApplicationContext(), "Choice mode is : " + gridView.getChoiceMode(), Toast.LENGTH_SHORT ).show();
test.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
if (gridView.isItemChecked(gridView.getCheckedItemPosition())) {
String name = (carAdapter.getItem(gridView.getCheckedItemPosition())).getName();
Toast.makeText(getApplicationContext(), "Here is " + name, Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getApplicationContext(), "This is not true", Toast.LENGTH_SHORT).show();
}
}
});
}
}
As you see i put a test Button and return the name of selected GridView Item.It returns the value,But with no checkable or selected View.
And Main Activity XML :
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
android:paddingBottom="#dimen/activity_vertical_margin" tools:context=".DisplayActivity">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:weightSum="1"
android:layout_marginTop="30dp">
<GridView
android:layout_width="wrap_content"
android:layout_height="387dp"
android:id="#+id/gridView"
android:background="#abc"
android:layoutDirection="ltr"
android:choiceMode="singleChoice"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Test"
android:id="#+id/button" />
</LinearLayout>
Should i set it by myself?
If yes, where?
Any solution will appreciate.
Thx
First create the array list. then create the adapter and then assign it as an adapter to grid view.
what you are doing is creating adapter first the creating array-list and the setting it to grid view.
A lot of people had this same issue before, but I haven't been able to solve it using their solutions..
I've got a ListActivity with a custom ArrayAdapter, but I can't seem to trigger the onItemClick.
I've tried it both with the default #Override protected void onListItemClick(...) which didn't trigger, and also with a myListView.setOnItemClickListener(new OnItemClickListener(){ ... });, which also didn't work.
From previous stackoverflow questions regarding this matter I've used the following pieces of code in the xml:
android:focusableInTouchMode="false"
android:clickable="false"
android:focusable="false"`
In the list_item.xml views
Or android:descendantFocusability="afterDescendants" in the ListView itself.
Here below is the main part of code regarding this problem:
ChecklistActivity.java:
public class ChecklistActivity extends ListActivity
{
private List<Product> products;
#Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_checklist);
// test products:
products = new ArrayList<Product>();
for(int i = 0; i < 5; i++){
Product p = new Product();
p.setName("Product " + i);
products.add(p);
}
MyAdapter adapt = new MyAdapter(this, R.layout.list_inner_view, products);
setListAdapter(adapt);
ListView lv = (ListView) findViewById(android.R.id.list);
lv.setOnItemClickListener(new OnItemClickListener(){
#Override
public void onItemClick(AdapterView<?> adapt, View v, int position, long id){
onListItemClick(v);
}
});
...
}
private void onListItemClick(View v){
Log.i("CHECKLIST ACTIVITY", "onListItemClick triggered");
...
}
list_item.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_gravity="center_vertical"
android:focusableInTouchMode="false"
android:clickable="false"
android:focusable="false" >
<ImageView
android:id="#+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:contentDescription="#string/checkbox_content_description"
android:src="#drawable/checkbox_unchecked"
android:background="#drawable/transparent_background"
android:focusableInTouchMode="false"
android:clickable="false"
android:focusable="false" />
<TextView
android:id="#+id/tv_product_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:focusableInTouchMode="false"
android:clickable="false"
android:focusable="false"
android:textIsSelectable="false" />
</LinearLayout>
activity_list.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView
android:id="#android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:descendantFocusability="afterDescendants" />
</RelativeLayout>
Ok, very stupid of me.. I removed
android:focusableInTouchMode="false"
android:clickable="false"
android:focusable="false"
from the LinearLayout of the list_item.xml and now it works..
I want to hide the edit text and button field initially in list view and show that edit text and button for a particular raw in list view when that raw is clicked.So I tried to set the height to 0 in layout xml and then set it to some other value when user clicks on a raw, but it is not working I think my list view click event is not working.
In the Android layout that I have list view there are Image view as a button, edit text field and list view also. Like follows
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="#dimen/activity_vertical_margin"
android:paddingLeft="#dimen/activity_horizontal_margin"
android:paddingRight="#dimen/activity_horizontal_margin"
android:paddingTop="#dimen/activity_vertical_margin"
tools:context=".MainPortal" >
<ListView
android:id="#+id/employeeListView"
android:layout_width="650dp"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="25dp"
android:clickable="true">
</ListView>
<EditText
android:id="#+id/empPin"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="#+id/iv_start_journey_btn"
android:layout_marginBottom="56dp"
android:layout_marginRight="17dp"
android:layout_toLeftOf="#+id/employeeListView"
android:ems="10"
android:inputType="number"
android:hint="#string/add_emp_pin_hint" >
<requestFocus />
</EditText>
<ImageView
android:id="#+id/iv_start_journey_btn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="#+id/employeeListView"
android:layout_alignRight="#+id/empPin"
android:layout_marginBottom="84dp"
android:onClick="startJourney"
android:src="#drawable/start" />
</RelativeLayout>
I have used following custom lay out for the list view
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="#+id/emp_avatar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginTop="18dp"
android:adjustViewBounds="true"
android:maxHeight="80dp"
android:maxWidth="80dp"
android:src="#drawable/person" />
<TextView
android:id="#+id/emp_number"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="#+id/emp_avatar"
android:layout_toRightOf="#+id/emp_avatar"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:id="#+id/empPin"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_alignBottom="#+id/emp_avatar"
android:layout_alignRight="#+id/emp_number"
android:layout_toRightOf="#+id/emp_avatar"
android:ems="10"
android:inputType="number" >
<requestFocus />
</EditText>
<Button
android:id="#+id/empAdd"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_alignBaseline="#+id/empPin"
android:layout_alignBottom="#+id/empPin"
android:layout_marginLeft="20dp"
android:layout_toRightOf="#+id/empPin"
android:text="#string/emp_add_btn" />
Here I post the code of Activity.java.
public class MainPortal extends Activity {
private List<Employee> employees = new ArrayList<Employee>();
EditText et;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_portal);
populateEmployeeList();
//populsteListView();
ListView list = (ListView) findViewById(R.id.employeeListView);
ArrayAdapter<Employee> adapter = new MylistAdapter();
list = (ListView) findViewById(R.id.employeeListView);
list.setAdapter(adapter);
list.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
//I ADDED ON CLICK IMPLEMENTATION HERE, BUT THIS IS NOT WORKING
Toast.makeText(getApplicationContext(), "CLICKED", Toast.LENGTH_SHORT).show();
}
});
private void populateEmployeeList() {
...
}
private class MylistAdapter extends ArrayAdapter<Employee>{
public MylistAdapter(){
super(MainPortal.this,R.layout.item_view,employees);
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
View itemView = convertView;
if(itemView==null){
itemView = getLayoutInflater().inflate(R.layout.item_view, parent,false);
}
Employee currentEmployee = employees.get(position);
//Avatar
ImageView imageView = (ImageView) itemView.findViewById(R.id.emp_avatar);
imageView.setImageResource(currentEmployee.getAvatarId());
//Employee number
TextView emp_id = (TextView) itemView.findViewById(R.id.emp_number);
emp_id.setText(currentEmployee.getId());
et = (EditText) itemView.findViewById(R.id.empPin);
return itemView;
}
}
}
Above I have posted some codes that I think important.
Can any one please help me to do this task.
Thanks in advance.
Add the following attributes to your button
android:focusable="false"
android:focusableInTouchMode="false"
ListView setOnItemClickListener not working by adding button
Is your edittext taking focus on click of list item? If so remove the focus on edittext also.
Here your edittext inside the listview is having all the focus, so this listview onClick is not working. Remove the focus from the editext box and it will start working
// try this
public class MainPortal extends Activity {
private List<Employee> employees = new ArrayList<Employee>();
EditText et;
ListView list;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main_portal);
populateEmployeeList();
//populsteListView();
list = (ListView) findViewById(R.id.employeeListView);
ArrayAdapter<Employee> adapter = new MylistAdapter();
list.setAdapter(adapter);
list.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
//I ADDED ON CLICK IMPLEMENTATION HERE, BUT THIS IS NOT WORKING
Toast.makeText(getApplicationContext(), "CLICKED", Toast.LENGTH_SHORT).show();
}
});
}
}
In my Case setOnItemClickListener works fine in Android Versions Upto 5.1.1
But Having On Android 6.0.1. At last I found the solution
Try this
Remove these Lines from Your XML Layout
android:orientation="vertical"
tools:context=".ManageRequest"
android:contextClickable="true"
Works for Me in Android Version 6.0.1
Hope Your Problems Solved ..!!! Happy Coding :)
I recently stumbled upon the sliding drawer in Android, after creating my first project which implements the same I have a few issues. I am using a list view inside of the sliding drawer and for that I need to implement onClickListener and extend Activity, now everything is working fine, albeit the sliding drawer opens and occupies almost all of the space in the view, I want it to open only half screen. I went through various posts on internet which ask me to extend SlidingDrawer and use method onMeasure which is not feasible for me (Or is it?). Secondly I would want to place the handle button on the top not centre. Below is my code:
activity_main.xml~~~>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/LinearLayout01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:gravity="top"
>
<TextView
android:text=""
android:gravity="center|center_vertical"
android:textColor="#000000"
android:textSize="20dp"
android:textStyle="bold"
android:id="#+id/TextView01"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TextView>
<SlidingDrawer
android:layout_width="wrap_content"
android:id="#+id/SlidingDrawer"
android:handle="#+id/slideButton"
android:content="#+id/contentLayout"
android:animateOnClick="true"
android:layout_height="match_parent"
android:orientation="horizontal">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="#+id/slideButton"
>
</Button>
<LinearLayout
android:layout_width="wrap_content"
android:id="#+id/contentLayout"
android:orientation="vertical"
android:gravity="center"
android:padding="10dip"
android:background="#0080FF"
android:layout_height="wrap_content">
<ListView
android:id="#android:id/list"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</ListView>
</LinearLayout>
</SlidingDrawer>
</RelativeLayout>
.java file~~~~>
public class slidingDrawerDemo extends ListActivity implements OnClickListener {
private ArrayAdapter<String> listAdapter ;
Button slideButton,b1, b2,b3,b4;
SlidingDrawer slidingDrawer;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
slideButton = (Button) findViewById(R.id.slideButton);
slidingDrawer = (SlidingDrawer) findViewById(R.id.SlidingDrawer);
ListView LV = getListView(); //(ListView)findViewById(R.id.list);
String []Test ={"Residential","Commercial","Customised Projects","SEZ","Brochure"};
ArrayList<String> Plist = new ArrayList<String>();
Plist.addAll(Arrays.asList(Test));
listAdapter = new ArrayAdapter<String>(this, R.layout.list_dem, Plist);
LV.setAdapter( listAdapter );
LV.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView LV, View view,int position, long id) {
Toast.makeText(slidingDrawerDemo.this,""+position, Toast.LENGTH_SHORT).show();
if(position==0){
initOne();
}else if (position==1){
initTwo();
}else if (position==2){
initThree();
}else if (position==3){
initFour();
}else if (position==4){
initFive();
}
}
});
slidingDrawer.setOnDrawerOpenListener(new OnDrawerOpenListener() {
#Override
public void onDrawerOpened() {
// slideButton.setBackgroundResource(R.drawable.closearrow);
}
});
slidingDrawer.setOnDrawerCloseListener(new OnDrawerCloseListener() {
#Override
public void onDrawerClosed() {
// slideButton.setBackgroundResource(R.drawable.openarrow);
}
});
}
My list_dem.xml file~~~>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/rowTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:textSize="16sp" >
</TextView>
I found the answer:
in my Slider defination in xml:
android:topOffset="100.5dp"
I'm trying to create a Request Responses activity and get the itemSelected for use of next activity which is store them into user friendlist. But the itemSelected return nothing when the "Accept" button is clicked.(It should display itemSelected in toast dialog) Anyone knows what happen it is? Additionally, I like to ask why the item in the listView was located at the not accurate location? it seems like more upper that usual, for the second item.How to adjust it properly?
The figure below is layout of NotificationView.java:
NotificationView.java
public class NotificationView extends ListActivity{
String[] people;
ListView lv;
Button btn1,btn2;
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.view);
NotificationManager mnotis =(NotificationManager)getSystemService(NOTIFICATION_SERVICE);
mnotis.cancel(getIntent().getExtras().getInt("notificationID"));
String i = getIntent().getExtras().getString("name");
people = i.split("[,]");
Log.d("how",i);
lv= (ListView) findViewById(android.R.id.list);
btn1 = (Button)findViewById(R.id.acceptbtn);
btn2 = (Button)findViewById(R.id.closebtn);
ArrayAdapter<String> list = new ArrayAdapter<String>(NotificationView.this,R.layout.friendlist_item, R.id.friend_name,people);
lv.setAdapter(list);
btn1.setOnClickListener(new View.OnClickListener()
{
public void onClick(View v)
{
lv = getListView();
int i = lv.getCount();
Log.d("count",String.valueOf(i));
runOnUiThread(new Runnable(){
public void run(){
String itemSelected = "Selected items: \n";
for(int i=0;i<lv.getCount();i++){
if(lv.isItemChecked(i)){
itemSelected += lv.getItemAtPosition(i) + "\n";
}
}
Toast.makeText(NotificationView.this,itemSelected,Toast.LENGTH_SHORT).show();
}
});
}
});
}}
view.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff"
>
<ListView android:id="#android:id/list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1">
</ListView>
<FrameLayout android:id="#+id/FrameLayout01"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:background="#ffffff"
android:orientation="horizontal" >
<Button
android:id="#+id/acceptbtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="0.46"
android:text="Accept" />
<Button
android:id="#+id/closebtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0.49"
android:text="Close" />
</LinearLayout>
</FrameLayout>
friendlist_item.xml
<?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:orientation="vertical" >
<CheckBox android:id="#+id/friend_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight = "88dip"
android:textSize="20dip"
android:textStyle="bold"/>
</LinearLayout>
Your Checkbox isn't related with the method that you are calling, for listview with multiselect items follow the next guide: http://dj-android.blogspot.com/2012/04/milti-selection-listview-android-with.html