diff options
author | Mark Wei <markwei@google.com> | 2013-10-17 13:50:19 -0700 |
---|---|---|
committer | Mark Wei <markwei@google.com> | 2013-10-17 14:53:08 -0700 |
commit | 9d46a01e044696eb4d101778992fed4966520251 (patch) | |
tree | 495affc5d7539289c33e7377916e47a8c881d4d8 /sample | |
parent | 25ad6f98516a7af1ca71cfa07fb503d46dc8a7f1 (diff) | |
download | bitmap-9d46a01e044696eb4d101778992fed4966520251.tar.gz |
Trace without reflection. Avoid crashing on ICS.
Change-Id: Ic75143a38d252278329a6f775c137ff1321eaf28
Diffstat (limited to 'sample')
-rw-r--r-- | sample/src/com/example/bitmapsample/BitmapView.java | 7 | ||||
-rw-r--r-- | sample/src/com/example/bitmapsample/MainActivity.java | 1 |
2 files changed, 6 insertions, 2 deletions
diff --git a/sample/src/com/example/bitmapsample/BitmapView.java b/sample/src/com/example/bitmapsample/BitmapView.java index 8b5bd69..ac17441 100644 --- a/sample/src/com/example/bitmapsample/BitmapView.java +++ b/sample/src/com/example/bitmapsample/BitmapView.java @@ -17,6 +17,7 @@ package com.example.bitmapsample; import android.content.Context; +import android.os.Build; import android.util.AttributeSet; import android.view.View; @@ -54,7 +55,11 @@ public class BitmapView extends View { public void initialize(BitmapCache cache) { mBitmapDrawable = new BasicBitmapDrawable(getResources(), cache); - setBackground(mBitmapDrawable); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { + setBackground(mBitmapDrawable); + } else { + setBackgroundDrawable(mBitmapDrawable); + } } }
\ No newline at end of file diff --git a/sample/src/com/example/bitmapsample/MainActivity.java b/sample/src/com/example/bitmapsample/MainActivity.java index 78b2ec6..6db2bc5 100644 --- a/sample/src/com/example/bitmapsample/MainActivity.java +++ b/sample/src/com/example/bitmapsample/MainActivity.java @@ -37,7 +37,6 @@ public class MainActivity extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); - Trace.init(); mListView = (ListView) findViewById(R.id.list); mListView.setAdapter(new MyAdapter()); } |