← xiaopingfeng.com/notes/ 随笔

Social by lending books .1

NB · 0006 · 2013-02-08 · 蛋疼

控制不住的我会买很多书,有时候朋友会提到想看我的书单。所以决定做个简单的小程序满足这需求。 核心功能:扫描图书的ISBN码,上传到网络中构成数字的个人图书馆,可以很简单的分享到不同社交平台。

ISBN码扫描 Zxing 数据存储 Parse ISBN查询 douban 用户登录 weibo / douban Server dotcloud

ISBN码扫描 安装Zxing apk 创建一个新的android项目 在MainActivity中加个button,添加上onClick事件 final Button button = (Button) findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { IntentIntegrator integrator = new IntentIntegrator((Activity) mContext); integrator.initiateScan(); } }); 再添加一个响应函数 public void onActivityResult(int requestCode, int resultCode, Intent intent) { IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent); if (scanResult != null) { Log.d("Books", "GOTIT," + scanResult.getContents()); // handle scan result } else { Log.d("Books", "SAD," + scanResult.getContents()); } // else continue with any other code you need in the method } 这样就完成了获取ISBN部分的代码。装上找本书试试。