引用:http://www.oschina.net/code/snippet_4873_4437
05 |
Resource res=gerResource(); |
06 |
Drawable drawable=res.getDrawable(id); |
10 |
Resource res=gerResource(); |
12 |
Bitmap bitmap=BitmapFactory.decodeResource(res, id); |
17 |
int id = int id =res.getIdentifier(name, defType, defPackage); |
24 |
AssetManager asm=getAssetMg(); |
25 |
InputStream is=asm.open(name); |
27 |
Drawable da = Drawable.createFromStream(is, null ); |
29 |
Bitmap bitmap=BitmapFactory.decodeStream(is); |
34 |
String path = Environment.getExternalStorageDirectory().toString()+ "/DCIM/device.png" ; |
35 |
RandomAccessFile mMiniThumbFile; |
36 |
File imgfile = new File(path); |
38 |
mMiniThumbFile = new RandomAccessFile(imgfile, "rw" ); |
39 |
} catch (IOException ex) { |
43 |
mMiniThumbFile = new RandomAccessFile(imgfile, "r" ); |
44 |
} catch (IOException ex2) { |
46 |
System.out.println(ex2.toString()); |
49 |
data= new byte [ 10553 ]; |
51 |
mMiniThumbFile.seek( 0 ); |
52 |
int got = mMiniThumbFile.read(data, 0 , 10552 ); |
53 |
System.out.println( "got=" +got); |
54 |
} catch (IOException e) { |
57 |
System.out.println(e.toString()); |
61 |
Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0 ,data.length); |