Android list with real-time updates

I am working on an application that shows some places on the list. Each element of the list has an arrow pointing to the place (hotel, bar, etc.).

The problem is that I don’t know how to effectively update this arrow without exposing my eyes locally (which, according to Google I / O video, is something that I should never do).

The arrow should be updated at every event of the phone’s orientation sensor, which is many times per second.

So, is there a better approach than calling notifyDataSetChanged () for each event and updating the data of each list item?

UPDATE (for @dharan and all interested):

I stopped working on this project because now I have full-time work, but I was thinking of a solution (unrealized / unverified).

First, limit the rotation angle to a fixed step (for example, 5, 10, 15, 20, ... 355, 360), then omit the rotated image for each rotation angle to avoid costly calculations of image rotation (but at a higher memory cost).

After that, I would like my getView () method to know when you only need to update the image, and not all the data. In my case, it is as simple as:

public View getView(int position, View convertView, ViewGroup parent) {
     if (convertView != null && place[position].id == (Integer)convertView.getTag()){
         //the place information is already set correctly so just update the image
     }
     ...
}

After these changes, I believe that calling notifyDataSetChanged () should not cause serious performance issues.

+3
source share
1 answer

ListView, LinearLayout . LinearLayout , , (.. ) . , . , , , , . .

, , , , . , , , notifyDataSetChanged() . , ListView , (, , ). , .

+2

All Articles