0
有了這個應用程序,我想掃描的二維碼(我已經這樣做),然後從數據庫中的表中獲取特定的行使用掃描QR返回的值代碼在我的SELECT語句中。將QR碼掃描器android應用程序連接到在線mySQL數據庫
到目前爲止我的代碼如下:
public void Scan(View v)
{
try {
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "QR_CODE_MODE"); // "PRODUCT_MODE for bar codes
startActivityForResult(intent, 0);
} catch (Exception e) {
Uri marketUri = Uri.parse("market://details?id=com.google.zxing.client.android");
Intent marketIntent = new Intent(Intent.ACTION_VIEW,marketUri);
startActivity(marketIntent);
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 0) {
if (resultCode == RESULT_OK) {
String contents = data.getStringExtra("SCAN_RESULT");//Value retrieved from qr code is stored in this string
}
if(resultCode == RESULT_CANCELED){
//handle cancel
}
}
}