How to check the previous record in CursorAdapter - Android -


i have chat application , i'm looking way hide profile image of chat when there 2 or more consecutive chat same person, how can that? or may use different chat bubble facebook or other chat apps

below sample of have,

   private static class chatcursoradapter extends cursoradapter {      private chatcursor chatcursor;          public chatcursoradapter(context context, commentscursor cursor) {             super(context, cursor, 0);         chatcursor = cursor;         }          @override         public view newview(context context, cursor cursor, viewgroup parent) {              layoutinflater inflater = (layoutinflater) context                     .getsystemservice(context.layout_inflater_service);             return inflater.inflate(r.layout.chat_layout, parent, false);         }       @override     public void bindview(view view, context context, cursor cursor) {         imageview imgview = (imageview) view.findviewbyid(r.id.imageview1);         chat chat = chatcursor.getchat();            //if previous chat same          //person set profile image invisible     }   } 

if understood correctly can you.

@override public view newview(view view, context context, cursor cursor) {     int posbeforelast = cursor.getcount() - 1;        //also can use check current position of cursor     int currentpostion= cursor.getposition(); } 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -