Custom Drag Sort Listview with Radiobutton

I have a DSLV with custom adapter which has two textviews and a radiobutton. I want the radiobutton of a particular row to be setchecked(true) when that row is clicked. To do that I used the below mentioned code.

    public OnItemClickListener listclk = new OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,long arg3) {


          if(!rad.isChecked())
          {
              rad.setChecked(true);
          }else{
              rad.setChecked(false);

               }
  }
};

But its not working properly. Please Help!!...Thanks

Answers


finally the problem got sorted out by adding ..

@Override
        public int getViewTypeCount() {
            // TODO Auto-generated method stub
            return namelist.size();
        }



        @Override
        public int getItemViewType(int position) {
            // TODO Auto-generated method stub
            return position;
        }

after the getview().


Try this: (assuming your DSLV is called "list")

list.setChoiceMode(ListView.CHOICE_MODE_SINGLE);

Need Your Help


About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.