Buggy code:
public class PlaylistActivity extends Activity implements OnBansheeCommandHandle { private OnBansheeCommandHandle mOldCommandHandler ; private boolean mLoadingDismissed ; private List < PlaylistActivity . PlaylistEntry > mPlaylist ; private ListView mList ; private PlaylistActivity . PlaylistAdapter mAdapter ; private int mPlaylistCount = 0 ; private boolean mPlaylistRequested ; private Set < String > mRequestedCovers = new HashSet < String > ( ) ; @ SuppressWarnings ( "unchecked" ) @ Override public void onCreate ( Bundle bundle ) { super . onCreate ( bundle ) ; if ( ( CurrentSongActivity . mConnection ) == null ) { finish ( ) ; return ; } mOldCommandHandler = mConnection . getHandleCallback ( ) ; mConnection . updateHandleCallback ( new OnBansheeCommandHandle ( ) { public void onBansheeCommandHandled ( Command command , byte [ ] params , byte [ ] result ) { mOldCommandHandler . onBansheeCommandHandled ( command , params , result ) ; PlaylistActivity . this . onBansheeCommandHandled ( command , params , result ) ; } } ) ; Object [ ] dataBefore = ( ( Object [ ] ) ( getLastNonConfigurationInstance ( ) ) ) ; if ( dataBefore != null ) { mOldCommandHandler = ( ( OnBansheeCommandHandle ) ( dataBefore [ 0 ] ) ) ; mPlaylist = ( ( List < PlaylistActivity . PlaylistEntry > ) ( dataBefore [ 1 ] ) ) ; mLoadingDismissed = ( ( Boolean ) ( dataBefore [ 2 ] ) ) ; mPlaylistCount = ( ( Integer ) ( dataBefore [ 3 ] ) ) ; mPlaylistRequested = ( ( Boolean ) ( dataBefore [ 4 ] ) ) ; mRequestedCovers = ( ( Set < String > ) ( dataBefore [ 5 ] ) ) ; } else { mLoadingDismissed = false ; mPlaylist = new ArrayList < PlaylistActivity . PlaylistEntry > ( ) ; mPlaylistRequested = true ; mConnection . sendCommand ( PLAYLIST , Playlist . encode ( 0 , App . getPlaylistPreloadCount ( ) ) ) ; } setContentView ( playlist ) ; mList = ( ( ListView ) ( findViewById ( list ) ) ) ; mAdapter = new PlaylistActivity . PlaylistAdapter ( ) ; mList . setAdapter ( mAdapter ) ; mList . setOnScrollListener ( new OnScrollListener ( ) { public void onScrollStateChanged ( AbsListView view , int scrollState ) { } public void onScroll ( AbsListView view , int firstVisibleItem , int visibleItemCount , int totalItemCount ) { <START_BUG> if ( ( ! ( mPlaylistRequested ) ) && ( ( firstVisibleItem + visibleItemCount ) == ( mPlaylist . size ( ) ) ) ) { <END_BUG> mPlaylistRequested = true ; mConnection . sendCommand ( PLAYLIST , Playlist . encode ( mPlaylist . size ( ) , App . getPlaylistPreloadCount ( ) ) ) ; } } } ) ; if ( mLoadingDismissed ) { findViewById ( loading_progress ) . setVisibility ( GONE ) ; refreshTitle ( ) ; } } @ Override public void onDestroy ( ) { } @ Override public void onResume ( ) { } public Object onRetainNonConfigurationInstance ( ) { } public void onBansheeCommandHandled ( Command command , byte [ ] params , byte [ ] result ) { } private void refreshTitle ( ) { } private static class PlaylistEntry { public PlaylistEntry ( long id ) { } public long id ; public boolean requestedTrackInfo = false ; public TrackInfo trackInfo ; } private static class ViewHolder { public ImageView cover ; public TextView track ; public TextView artist ; public TextView album ; public ImageView playing ; } private class PlaylistAdapter extends BaseAdapter { public int getCount ( ) { } public int getItemViewType ( int position ) { } public int getViewTypeCount ( ) { } public Object getItem ( int position ) { } public long getItemId ( int position ) { } public View getView ( int position , View convertView , ViewGroup parent ) { } private void requestTrackInfo ( PlaylistActivity . PlaylistEntry entry ) { } } }

Fix:
if ( ( ! ( mPlaylistRequested ) ) && ( ( ( firstVisibleItem + visibleItemCount ) + 5 ) >= ( mPlaylist . size ( ) ) ) ) {