代码改变世界

随笔档案-2013年4月3日

Bitmap 存到文件中

2013-04-03 15:34 by java20130722, 478 阅读, 收藏, 编辑
摘要: 将一个Bitmap 的内容存到file中//create a file to write bitmap data File f = File(context.getCacheDir(), filename); f.createNewFile(); //Convert bitmap to byte array Bitmap bitmap = your bitmap; ByteArrayOutputStream bos = new ByteArrayOutputStream(); bitmap.compress(CompressFormat.PNG, 0 /*ignored for PNG*/,. 阅读全文

android nfc 开发

2013-04-03 13:49 by java20130722, 454 阅读, 收藏, 编辑
摘要: Android NFC1. 确认nfc是否可用NfcManager manager = (NfcManager) Context.getSystemService(Context.NFC_SERVICE); NfcAdapter adapter = manager.getDefaultAdapter(); if (adapter != null && adapter.isEnabled()) { // adapter exists and is enabled. System.out.println("can"); }else{ System.out.pri 阅读全文
点击右上角即可分享
微信分享提示