How to register Listener on listview .

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

How to register Listener on listview .

Postby yatishrao.mishra » Fri May 23, 2008 5:53 pm

HI All,
I want to to register a listner to listview but my problem is that my View is set By using Baseadapter class
and i am sucsessful on this(only for display). but the main problem is i want to add listener to each listview .
please help me.


[code]

[fade]setting the adapter like below
adapter = new CategoriesAdapter(ChannelCategories.this,titleList);
ChannelCategories.this.setListAdapter(adapter);


class CategoriesAdapter extends BaseAdapter
{
private Context context;
private List<String> listTitle ;

public CategoriesAdapter(Context con,List<String> list)
{
context = con ;
listTitle = list;
}
public int getCount()
{

return listTitle.size();
}

public Object getItem(int position)
{

return listTitle.get(position);
}

public long getItemId(int position)
{

return position;
}

public View getView(int position, View convertView, ViewGroup parent)
{
TextView textView = new TextView(context);
textView.setText(listTitle.get(position));
textView.setTextSize(18.00f);
textView.setTextColor(Color.CYAN);
textView.setLayoutParams(new ViewGroup.LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT));

return textView;
}

}
[/fade]
yatishrao.mishra
Freshman
Freshman
 
Posts: 8
Joined: Fri May 23, 2008 4:33 pm

Top

Postby yatishrao.mishra » Sat May 24, 2008 6:28 am

hi all,
if their is anything confusing in my my qurey then please tell me or i want to post all my code .
I am waiting for reply.
Thanx :roll:
yatishrao.mishra
Freshman
Freshman
 
Posts: 8
Joined: Fri May 23, 2008 4:33 pm

Listener to ListView

Postby yatishrao.mishra » Mon May 26, 2008 6:36 pm

:D hi all ,
I got the solution of my problem
as i want to set listener to ListView which is set by the BaseAdapter
as i was using ListActivity
their is one method
[b]getListView()
then register Appropriate Listener with this method.
yatishrao.mishra
Freshman
Freshman
 
Posts: 8
Joined: Fri May 23, 2008 4:33 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 7 guests