Android a手机扫描b手机二维码,a手机跳转到本App评分
2017-01-01 10:55
330 查看
private Bitmap encodeAsBitmap() throws WriterException {
Hashtable hints = new Hashtable();
hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
BitMatrix result;
try {
result = new MultiFormatWriter().encode("http://market://details?id="+getPackageName(),
BarcodeFormat.QR_CODE, 250, 250, hints);
} catch (IllegalArgumentException iae) {
// Unsupported format
return null;
}
int w = result.getWidth();
int h = result.getHeight();
int[] pixels = new int[w * h];
for (int y = 0; y < h; y++) {
int offset = y * w;
for (int x = 0; x < w; x++) {
pixels[offset + x] = result.get(x, y) ? Color.BLACK : Color.WHITE;
}
}
Bitmap bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
bitmap.setPixels(pixels, 0, 250, 0, 0, w, h);
return bitmap;
}
上面代码 生成二维码 跳转失败
case R.id.give_me_score_relative:
Uri uri = Uri.parse("market://details?id="+getPackageName());
Intent intent = new Intent(Intent.ACTION_VIEW,uri);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
break;
如果是点击跳转就没问题
Hashtable hints = new Hashtable();
hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
BitMatrix result;
try {
result = new MultiFormatWriter().encode("http://market://details?id="+getPackageName(),
BarcodeFormat.QR_CODE, 250, 250, hints);
} catch (IllegalArgumentException iae) {
// Unsupported format
return null;
}
int w = result.getWidth();
int h = result.getHeight();
int[] pixels = new int[w * h];
for (int y = 0; y < h; y++) {
int offset = y * w;
for (int x = 0; x < w; x++) {
pixels[offset + x] = result.get(x, y) ? Color.BLACK : Color.WHITE;
}
}
Bitmap bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
bitmap.setPixels(pixels, 0, 250, 0, 0, w, h);
return bitmap;
}
上面代码 生成二维码 跳转失败
case R.id.give_me_score_relative:
Uri uri = Uri.parse("market://details?id="+getPackageName());
Intent intent = new Intent(Intent.ACTION_VIEW,uri);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
break;
如果是点击跳转就没问题
相关文章推荐
- 扫描二维码自动识别手机系统(Android/IOS)跳转不同页面
- 扫描二维码自动识别手机系统(Android/IOS)跳转不同页面
- 扫描二维码自动识别手机系统(Android/IOS)跳转不同页面
- 扫描二维码自动识别手机系统(Android/IOS)跳转不同页面
- Android 基于google Zxing实现对手机中的二维码进行扫描
- Android 基于google Zxing实现对手机中的二维码进行扫描
- Android 基于google Zxing实现对手机中的二维码进行扫描
- Android 基于google Zxing实现对手机中的二维码进行扫描
- Android 基于google Zxing实现对手机中的二维码进行扫描
- Android 基于google Zxing实现对手机中的二维码进行扫描
- Android 基于google Zxing实现对手机中的二维码进行扫描
- 扫描二维码自动识别手机系统(Android/IOS)
- Android 基于google Zxing实现对手机中的二维码进行扫描
- Android 基于google Zxing实现对手机中的二维码进行扫描
- Android 基于google Zxing实现对手机中的二维码进行扫描
- Android 基于google Zxing实现对手机中的二维码进行扫描
- 【转】 Android 基于google Zxing实现对手机中的二维码进行扫描--不错
- Android 基于google Zxing实现对手机中的二维码进行扫描
- 扫描二维码自动识别手机系统(Android/IOS)
- Android 基于google Zxing实现对手机中的二维码进行扫描