Skip to content Skip to sidebar Skip to footer

Gif Image Works On Emulator But Not In Real Device?

i am trying to display gif image i have used this code MainActivity public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceStat

Solution 1:

Movie Object is not work properly on Device above(4.x) as hardware acceleration is enabled in these devices. So by making hardware acceleration disabled, you can make images work on both emulator and on real device.

  1. You can disabled hardware acceleration by adding

    android:hardwareAccelerated="false"

in your manifest file inder activity tag

<activityandroid:name=".MainActivity"android:hardwareAccelerated="false"android:label="@string/app_name" ></activity>

2.you can also disabled hardware acceration programatically

for example: MYGIFView is your custom view where you are going to show your GIF images

MYGIFViewmMYGIFView=(MYGIFView)findViewById(R.id.myGifImageView);
mMYGIFView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

By using this your GIF image will show on both emulator and real device :)

Post a Comment for "Gif Image Works On Emulator But Not In Real Device?"