Regarding the Checked state of a checkbox inside a list view
<p>I am developing a simple application,in which i am displaying a check Box and a text in each line of a list,but while i am selecting or checking one check box some other check boxes inside my list view are checked automatically.
I have done a lot Google on it and unable to find a way to fix this...
Please help me....</p>

<p>Thanx in advance....</p>

<pre><code> public void checkevent(View v) throws ParseException
{
    lv=(ListView)v.getParent().getParent();

    int i=lv.getPositionForView(v);

    Object o = lv.getItemAtPosition(i);

    String item= o.toString();

    int q=item.indexOf("-",0);

    String alarm_date=new_date+" "+item.substring(0,q);

    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm");

    Date rdate = (Date)formatter.parse(alarm_date); 

    set_prog=item.substring(q+1,item.length())+" on "+item.substring(0,q);

    if(((CompoundButton) v).isChecked())
    {
    if(rdate.getTime()&gt;=new Date().getTime())
    {
        if(program_reminder_main.contains((alarm_date+"--"+item.substring(q+1,item.length()))))
        {
            Toast.makeText(this,"You have already selected this one", Toast.LENGTH_LONG).show();
            ((CompoundButton) v).setChecked(false);

        }
        else {
            program_reminder_main+=("~"+alarm_date+"--"+item.substring(q+1,item.length()));

        }
        //To call the Alarm service Class at respective time
    Toast.makeText(this, "Alarm Set For"+" "+item.substring(q+1,item.length())+" on "+item.substring(0,q), Toast.LENGTH_LONG).show();
    Intent myIntent = new Intent(MainClass.this, MyAlarmService_Movie.class);

    pendingIntent = PendingIntent.getService(MainClass.this, 0, myIntent, 0);

    AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE);

         alarmManager.set(AlarmManager.RTC_WAKEUP,rdate.getTime()-30000,pendingIntent);

}
else {
 ((CompoundButton) v).setChecked(false);

        Toast.makeText(MainClass.this, "Alarm can't be set Before to crrent time", Toast.LENGTH_LONG).show();

    }
}
    else if(!((CompoundButton) v).isChecked()){
        AlarmManager alarmManager = (AlarmManager)getSystemService(ALARM_SERVICE);
        alarmManager.cancel(pendingIntent);
        Toast.makeText(MainClass.this, "Reset Alarm", Toast.LENGTH_LONG).show();
    }

}
</code></pre>

<p>ignore the extra things... just concentrate on the code for check box...and for your info. i have set the above method in the check Box's properties...</p>
