• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java QRCodeEncoder类的典型用法和代码示例

java 3次浏览

本文整理汇总了Java中com.google.zxing.encode.QRCodeEncoder的典型用法代码示例。如果您正苦于以下问题:Java QRCodeEncoder类的具体用法?Java QRCodeEncoder怎么用?Java QRCodeEncoder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

QRCodeEncoder类属于com.google.zxing.encode包,在下文中一共展示了QRCodeEncoder类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: doInBackground

点赞 2

import com.google.zxing.encode.QRCodeEncoder; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@TargetApi(13)
@Override
protected Void doInBackground(String... s) {
    String qrData = s[0];
    Display display = activity.getWindowManager().getDefaultDisplay();
    Point outSize = new Point();
    int x, y, qrCodeDimension;
    /* lame, got to use both the new and old APIs here */
    if (Build.VERSION.SDK_INT >= 13) {
        display.getSize(outSize);
        x = outSize.x;
        y = outSize.y;
    } else {
        x = display.getWidth();
        y = display.getHeight();
    }
    if (x < y) {
        qrCodeDimension = x;
    } else {
        qrCodeDimension = y;
    }
    Utils.debugLog(TAG, "generating QRCode Bitmap of " + qrCodeDimension + "x" + qrCodeDimension);
    QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(qrData, null,
            Contents.Type.TEXT, BarcodeFormat.QR_CODE.toString(), qrCodeDimension);

    try {
        qrBitmap = qrCodeEncoder.encodeAsBitmap();
    } catch (WriterException e) {
        Log.e(TAG, "Could not encode QR as bitmap", e);
    }
    return null;
}
 

开发者ID:uhuru-mobile,
项目名称:mobile-store,
代码行数:34,
代码来源:QrGenAsyncTask.java

示例2: doInBackground

点赞 2

import com.google.zxing.encode.QRCodeEncoder; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@TargetApi(13)
@Override
protected Void doInBackground(String... s) {
    String qrData = s[0];
    Display display = activity.getWindowManager().getDefaultDisplay();
    Point outSize = new Point();
    int x, y, qrCodeDimension;
    /* lame, got to use both the new and old APIs here */
    if (Build.VERSION.SDK_INT >= 13) {
        display.getSize(outSize);
        x = outSize.x;
        y = outSize.y;
    } else {
        x = display.getWidth();
        y = display.getHeight();
    }
    if (x < y)
        qrCodeDimension = x;
    else
        qrCodeDimension = y;
    Utils.debugLog(TAG, "generating QRCode Bitmap of " + qrCodeDimension + "x" + qrCodeDimension);
    QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(qrData, null,
            Contents.Type.TEXT, BarcodeFormat.QR_CODE.toString(), qrCodeDimension);

    try {
        qrBitmap = qrCodeEncoder.encodeAsBitmap();
    } catch (WriterException e) {
        Log.e(TAG, "Could not encode QR as bitmap", e);
    }
    return null;
}
 

开发者ID:nutellarlz,
项目名称:AppHub,
代码行数:33,
代码来源:QrGenAsyncTask.java

示例3: doInBackground

点赞 2

import com.google.zxing.encode.QRCodeEncoder; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@TargetApi(13)
@Override
protected Void doInBackground(String... s) {
    String qrData = s[0];
    Display display = activity.getWindowManager().getDefaultDisplay();
    Point outSize = new Point();
    int x, y, qrCodeDimension;
    /* lame, got to use both the new and old APIs here */
    if (Build.VERSION.SDK_INT >= 13) {
        display.getSize(outSize);
        x = outSize.x;
        y = outSize.y;
    } else {
        x = display.getWidth();
        y = display.getHeight();
    }
    if (x < y)
        qrCodeDimension = x;
    else
        qrCodeDimension = y;
    Log.i(TAG, "generating QRCode Bitmap of " + qrCodeDimension + "x" + qrCodeDimension);
    QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(qrData, null,
            Contents.Type.TEXT, BarcodeFormat.QR_CODE.toString(), qrCodeDimension);

    try {
        qrBitmap = qrCodeEncoder.encodeAsBitmap();
    } catch (WriterException e) {
        Log.e(TAG, e.getMessage());
    }
    return (Void) null;
}
 

开发者ID:princeofgiri,
项目名称:f-droid,
代码行数:33,
代码来源:QrGenAsyncTask.java

示例4: doInBackground

点赞 2

import com.google.zxing.encode.QRCodeEncoder; //导入依赖的package包/类
@SuppressWarnings("deprecation")
  @TargetApi(13)
  @Override
  protected Void doInBackground(String... s) {
      String qrData = s[0];
      /*
      //Display display = activity.getWindowManager().getDefaultDisplay();

      Point outSize = new Point();
      int x, y, qrCodeDimension;
      if (Build.VERSION.SDK_INT >= 13) {
          view.getSize(outSize);
          x = outSize.x;
          y = outSize.y;
      } else {
          x = display.getWidth();
          y = display.getHeight();
      }
      if (x < y)
          qrCodeDimension = x;
      else
          qrCodeDimension = y;
      **/

//      Log.i(TAG, "generating QRCode Bitmap of " + qrCodeDimension + "x" + qrCodeDimension);
      QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(qrData, null,
              Contents.Type.TEXT, BarcodeFormat.QR_CODE.toString(), qrCodeDimension);

      try {
          qrBitmap = qrCodeEncoder.encodeAsBitmap();
      } catch (WriterException e) {
          Log.e(TAG, e.getMessage());
      }
      return null;
  }
 

开发者ID:zom,
项目名称:Zom-Android,
代码行数:36,
代码来源:QrGenAsyncTask.java

示例5: doInBackground

点赞 2

import com.google.zxing.encode.QRCodeEncoder; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@TargetApi(13)
@Override
protected Bitmap doInBackground(String... s) {
    inviteLink = s[0];

    message = new StringBuffer();

    if (s.length > 0)
    {
        message.append(s[1]).append(": ");
    }

    message.append(inviteLink);
    message.append("\n\n");
    message.append(activity.getString(R.string.action_tap_invite));

    if (mShareQRCode) {
        Display display = activity.getWindowManager().getDefaultDisplay();
        Point outSize = new Point();
        int x, y, qrCodeDimension;
        /* lame, got to use both the new and old APIs here */
        if (Build.VERSION.SDK_INT >= 13) {
            display.getSize(outSize);
            x = outSize.x;
            y = outSize.y;
        } else {
            x = display.getWidth();
            y = display.getHeight();
        }
        if (x < y)
            qrCodeDimension = x;
        else
            qrCodeDimension = y;
        Log.i(TAG, "generating QRCode Bitmap of " + qrCodeDimension + "x" + qrCodeDimension);
        QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(inviteLink, null,
                Contents.Type.TEXT, BarcodeFormat.QR_CODE.toString(), qrCodeDimension);

        try {
            qrBitmap = qrCodeEncoder.encodeAsBitmap();
            return qrBitmap;
        } catch (WriterException e) {
            Log.e(TAG, e.getMessage());
        }
    }

    return null;
}
 

开发者ID:zom,
项目名称:Zom-Android,
代码行数:49,
代码来源:QrShareAsyncTask.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)