1

I'm fighting with a problem that is driving me crazy: I have a very simple ListView which scroll smoothly on a device and very luggy on another device that is almost 100% the same.

here you can find a video of the luggy scroll and here you can find a video of the (almost) smooth scrolling.

the slow scroll happens on a device with this specs, the smooth scroll happens on a device with this specs

here is the very basic code I used (obviously using ViewHolder pattern), how the hell can it be possible?? Please somebody help me!!!

public DealerAdapter(Context context, int skinLayoutResourceId, ArrayList<Dealer> items) {
        super(context, skinLayoutResourceId, items);
        _items = items;
        mContext = context;
        layout = skinLayoutResourceId;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        DealerViewHolder holder = null;
        // reuse views
        if (convertView == null) {
            LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            convertView = inflater.inflate(layout, null);
            // configure view holder
            holder = new DealerViewHolder();
            holder.lblName = (TextView) convertView.findViewById(R.skinDealer.lblNameSurname);
            holder.lblSapCode = (TextView) convertView.findViewById(R.skinDealer.lblSapCode);
            holder.lblAddress = (TextView) convertView.findViewById(R.skinDealer.lblAddress);
            convertView.setTag(holder);
        } else
            holder = (DealerViewHolder) convertView.getTag();
        try {
            holder.lblName.setText(_items.get(position).getName());
            holder.lblCode.setText(_items.get(position).getCode());
            holder.lblAddress.setText(_items.get(position).getAddress());
        } catch (Exception e) {
            // TODO: handle exception
        }
        return convertView;
    }

    static class DealerViewHolder {
        TextView lblName;
        TextView lblAddress;
        TextView lblCode;
    }

EDIT:

I tested the same code on another samsung device, galaxy note 10.1, with the same OS version as the one having a smooth scrolling and with more powerfull hardware, the result is surprending!! Here is the behavior, here are the device's specs.

Some times android is a real giant question mark!!!!

EDIT 2:

Here is logcat while executing a scroll on the device with android 4.2.2

01-27 10:34:59.994: V/AlarmManager(2371): waitForAlarm result :8
01-27 10:35:00.004: D/KeyguardClockWidgetService(4910): onReceive action=android.intent.action.TIME_TICK
01-27 10:35:00.004: V/AlarmManager(2371): ClockReceiver onReceive() ACTION_TIME_TICK
01-27 10:35:00.034: D/IconMerger(2561): overflowShown = false
01-27 10:35:00.034: D/IconMerger(2561): moreRequired = false
01-27 10:35:00.094: I/WAKELOCK_RELEASE(2371): TIMESTAMP=3927849415108, TAG=AlarmManager, TYPE=PARTIAL_WAKE_LOCK             , COUNT=0, PID=2371, UID=1000
01-27 10:35:00.474: I/InputReader(2371): Touch event's action is 0x0 (deviceType=0) [pCnt=1, s=0.146 ] when=3598409874000
01-27 10:35:00.474: I/InputDispatcher(2371): Delivering touch to: action: 0x0
01-27 10:35:00.494: I/ThermalZone(2371): TEMP 41000 newMaxSensorState 0
01-27 10:35:00.504: I/CustomFrequencyManager(4461): newFrequencyRequest  - mFrequency = 800000, mTimeoutMs = -1, mPkgName = LIST_SCROLL_BOOSTER@3
01-27 10:35:00.504: I/CustomFrequencyManager(4461): Boost Request from package = LIST_SCROLL_BOOSTER@3 frequency : 800000type = 6
01-27 10:35:00.504: I/CustomFrequencyManager(4461): !! pkgName = LIST_SCROLL_BOOSTER@3
01-27 10:35:00.504: I/CustomFrequencyManager(4461): Request from package name pkgName = LIST_SCROLL_BOOSTER@3
01-27 10:35:00.504: I/CustomFrequencyManager(4461): mContext is Not Null  mContext.pkgName = com.reply.fasttrack
01-27 10:35:00.504: I/CustomFrequencyManager(4461): mToken is Null....Creating New Binder!
01-27 10:35:00.504: I/CustomFrequencyManager(4461): CPUDVFSControlRequest : doFrequencyRequest::  = 800000 Timeout : -1
01-27 10:35:00.504: I/power(2371): *** acquire_dvfs_lock : lockType : 1  freq : 800000 
01-27 10:35:00.504: D/CustomFrequencyManagerService(2371): acquireDVFSLockLocked : type : DVFS_MIN_LIMIT  frequency : 800000  uid : 10169  pid : 4461  pkgName : LIST_SCROLL_BOOSTER@3
01-27 10:35:00.614: I/InputReader(2371): Touch event's action is 0x1 (deviceType=0) [pCnt=1, s=] when=3598555846000
01-27 10:35:00.614: I/InputDispatcher(2371): Delivering touch to: action: 0x1
01-27 10:35:01.984: I/Monitor(2371): SIOP:: Current AP = 365, CP = 0
01-27 10:35:03.354: D/BatteryService(2371): update start
01-27 10:35:03.354: D/BatteryService(2371): level:21, scale:100, status:3, health:2, present:true, voltage: 3614, temperature: 319, technology: Li-ion, AC powered:false, USB powered:true, Wireless powered:false, icon:17303346, invalid charger:0, online:4, charge type:1, current avg:-368
01-27 10:35:03.354: D/BatteryService(2371): Sending ACTION_BATTERY_CHANGED.
01-27 10:35:03.364: D/STATUSBAR-BatteryController(2561): onReceive() - ACTION_BATTERY_CHANGED
01-27 10:35:03.364: D/STATUSBAR-BatteryController(2561): onReceive() - BATTERY_STATUS_DISCHARGING: tw_stat_sys_battery_usb_not_charge
01-27 10:35:03.364: D/STATUSBAR-PhoneStatusBar(2561):  mBrightnessEnablebySettings = true mBrightnessEnablebyBattery = true mBrightnessEnablebyDisableFlag = true
01-27 10:35:03.514: I/power(2371): *** release_dvfs_lock : lockType : 1 
01-27 10:35:03.514: D/CustomFrequencyManagerService(2371): releaseDVFSLockLocked : Getting Lock type frm List : DVFS_MIN_LIMIT  frequency : 800000  uid : 10169  pid : 4461  tag : LIST_SCROLL_BOOSTER@3
Apperside
  • 3,542
  • 2
  • 38
  • 65

2 Answers2

0

The only difference that I see between the devices is the Android version. Android 4.4 introduces changes in order to make the whole system more smooth, even in low-memory devices.

Here you have more details: https://developer.android.com/about/versions/kitkat.html#svelte

It might not be very helpful, but if the version it's the only diference it might be that.

Jofre Mateu
  • 2,390
  • 15
  • 26
  • Could you add some of your logcat while scrolling? There's logs starting with GC_FOR_ALLOC? Sometimes, in new devices, the resolution and the RAM doesn't scale in a proporcional way, causing memory problems. I've had some of this problems recently in a app that was running fine in an really old Samsung, but it was laggy in a new Nexus 5. – Jofre Mateu Jan 27 '15 at 09:13
  • I've added to the question logcat logs while scrolling. how did you solved your problem? – Apperside Jan 27 '15 at 09:37
  • Well, my problem was a bit different. I had several layers of drawables and the solution was to find some way to unify them. In your logcat I don't see much to work with, make you sure that your log level is Debug or Verbose and that you have an app filter and you are only showing the logs directly related with your app. But maybe it's not the same kind of problem. – Jofre Mateu Jan 27 '15 at 10:01
0

After weeks of investigating, the reason was unbelievable: the problem was caused from a background image on the root of the layout containing the listview that was too big (almost 2MB). Although I know that using big images as background is not a good practice, I really do not understand why on an high performance device this was causing problem and on a less-performant device everything was running perfectly!

By the way I hope this will help anyone having my same problem

Apperside
  • 3,542
  • 2
  • 38
  • 65