Android activity is slow on device 4.3

I developed an application that will broadcast video from the Internet. I have an activity that lists videos, including their thumbnails, titles and status (recently updated). For each line there is a thumbnail for the video, the title of the video, and then a β€œfresh” icon to indicate a new download.

In the emulator, this works relatively well. It works great on 2.3 and 4.0.3 HTC Evo devices. On HTC One 4.3, this activity is very slow. Clicking on a list item that leads you to another action works fine. Other actions are in order, except for activity on the list.

Here is what I have experimented so far. I removed the "fresh" icon from xml and it worked great. Therefore, I suggested that this has something to do with this icon. The image is quite large (1000x900px), but only displayed at 50x50dp. I did not try to reduce this image to see performance. But if this is a problem, why old HTC phones can display it perfectly.

The only difference from HTC One and older HTC phones is that HTC One has an action bar, while older phones use a dedicated menu key on the device.

Is there a way to check the memory usage or processes during the launch of the application on the device to understand why it is so slow?

UPDATE: I resized the image to 100x100px and it is definitely faster. But I still notice that there is some lag.

Here's the layout for this line of the list:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="2dp" android:paddingTop="2dp" > <ImageView android:id="@+id/icon" android:layout_width="100dp" android:layout_height="100dp" android:layout_alignParentLeft="true" android:layout_centerVertical="true" /> <ImageView android:id="@+id/status" android:layout_width="50dp" android:layout_height="50dp" android:layout_alignParentRight="true" android:layout_alignParentTop="true" /> <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginLeft="10dp" android:layout_toLeftOf="@id/status" android:layout_toRightOf="@id/icon" /> </RelativeLayout> 
+1
performance android list imageview
source share
2 answers

Try to start profiling the method (see the figure), then start your activity, and then stop profiling the methods by clicking the same button in the picture again. Eclipse will generate a report in which you will see which method takes what time to execute. This way you can find out which method caused the delay.

enter image description here

+4
source share

I noticed performance issues on HTC when you go from 4.1 to 4.3 or 4.2. Turning off hardware acceleration actually improved performance on many pages when using HTC One. You can try turning off hardware acceleration in the manifest, and then turning it on for all devices except HTC in your basic actions.

Other devices had excellent performance for the same pages with hardware acceleration enabled. This is only the HTC that struggled and needed the code below:

if(!(android.os.Build.MODEL.equalsIgnoreCase("HTC One") && Integer.parseInt(android.os.Build.VERSION.SDK) == 18)) { getWindow().setFlags(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED); }

0
source share

All Articles