我想通过Android应用程序发布故事,我使用下面的代码.
private static final List<String> PERMISSIONS = Arrays.asList("publish_actions");
private static final String PENDING_PUBLISH_KEY = "pendingPublishReauthorization";
private boolean pendingPublishReauthorization = false;
private UiLifecycleHelper uiHelper;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
uiHelper = new UiLifecycleHelper(XXActivity.this, callback);
uiHelper.onCreate(savedInstanceState);
setContentView(R.layout.layoutAct);
...
...
...
publishAddCardStory();
...
}
@Override
public void onResume() {
super.onResume();
Session session = Session.getActiveSession();
if (session != null && (session.isOpened() || session.isClosed())) {
onSessionStateChange(session, session.getState(), null);
}
uiHelper.onResume();
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, …Run Code Online (Sandbox Code Playgroud) 我使用zxing库生成二维码。当我生成 QR 时,它工作正常,但在 QR 的左侧和右侧有一个空白区域。如何删除这个空白(制作位图宽度=高度)
这是我生成二维码的代码
private static final int QR_SIZE = 480;
public static Bitmap generateQR(String content){
Bitmap returnBitmap= null;
try {
Hashtable<EncodeHintType, ErrorCorrectionLevel> hintMap = new Hashtable<EncodeHintType, ErrorCorrectionLevel>();
hintMap.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.L);
QRCodeWriter qrCodeWriter = new QRCodeWriter();
BitMatrix matrix = qrCodeWriter.encode(content, BarcodeFormat.QR_CODE, QR_SIZE, QR_SIZE, hintMap);
//int width = matrix.getWidth();
int width = matrix.getHeight();
int height = matrix.getHeight();
int[] pixels = new int[width*height];
for(int y=0; y<height; y++) {
for(int x=0; x<width; x++) {
int grey = matrix.get(x, y) ? …Run Code Online (Sandbox Code Playgroud)