You are really going at that the hard way.

When using a ListView, checking for a string on a view is really 
inefficient. You could use the "position" or the "id" as a trigger point and 
use a case statement to make it faster and easier.

list.setOnItemClickListener(new OnItemClickListener() 
{
@Override
 public void onItemClick( AdapterView<?> parent, View view, int position, 
long id )
{
jump_to_chapter( position ); // or use the id if that works better in your 
scheme
}
 }

-- OR --

list.setOnItemClickListener(new OnItemClickListener() 
{
@Override
public void onItemClick( AdapterView<?> parent, View view, int position, 
long id )
{
switch( position ) // or switch on id
{
case 1: // Do something for 1
break;
case 2: // Do something for 2
break;
 case 3: // Do something for 3
break;
 case 4: // Do something for 4
break;
default: break;
 }
}
} 

They give you the position and ID field to make it easier on you, try 
figuring it out that way and it will be much faster and more flexible.

Steven
Studio LFP
http://www.studio-lfp.com

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to