summaryrefslogtreecommitdiff
path: root/sample
diff options
context:
space:
mode:
authorMark Wei <markwei@google.com>2013-10-17 13:50:19 -0700
committerMark Wei <markwei@google.com>2013-10-17 14:53:08 -0700
commit9d46a01e044696eb4d101778992fed4966520251 (patch)
tree495affc5d7539289c33e7377916e47a8c881d4d8 /sample
parent25ad6f98516a7af1ca71cfa07fb503d46dc8a7f1 (diff)
downloadbitmap-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.java7
-rw-r--r--sample/src/com/example/bitmapsample/MainActivity.java1
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());
}