小编MMa*_*ian的帖子

从视觉api预览条形码扫描仪的大小

我正在使用谷歌Android Vision API的条码阅读器示例.预览大小似乎没有填满整个可用空间(我使用的是Nexus 4,预览右侧有一个未使用的白色空间,约为宽度的1/3).

我希望能够在各种设备上运行此示例,并始终将其填满整个可用空间.

所以我一直在玩的是:

CameraSource.Builder builder = new CameraSource.Builder(getApplicationContext(), barcodeDetector).setFacing(CameraSource.CAMERA_FACING_BACK).setRequestedPreviewSize(?, ?).setRequestedFps(15.0f);
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

谢谢!

java android google-play-services google-vision android-vision

11
推荐指数
2
解决办法
1万
查看次数

Drive API中AppFolder的父文件夹错误无效

我收到一个无效的父文件夹错误,我已经看到使用资源ID而不是驱动器ID的解决方案,但这是一个不同的场景.

我正在尝试访问AppFolder,这只是使用GoogleApiClient,如下所示:

this.appFolder = Drive.DriveApi.getAppFolder(mGoogleApiClient);
Run Code Online (Sandbox Code Playgroud)

当我稍后尝试在其中创建文件时,我得到上述错误.

DriveFolder.DriveFileResult fileResult = appFolder.createFile(mGoogleApiClient, changeSet, driveContentsResult.getDriveContents()).await();
Run Code Online (Sandbox Code Playgroud)

然后fileResult.getStatus()给了我错误.

这曾经对我有用.不同的是,我在Google云端硬盘上手动清空了应用的数据(删除隐藏的应用数据).但我没有断开应用程序 - 所以我认为appFolder将继续以相同的方式工作......

到目前为止,唯一的解决方法是卸载应用程序,但这样我就丢失了数据.

这是可重复的.请帮忙.

android google-drive-api google-drive-android-api

8
推荐指数
1
解决办法
1481
查看次数

Django测试客户端提交带有POST请求的表单

如何使用Django测试客户端提交POST请求,以便在其中包含表单数据?特别是,我希望有类似的东西(灵感来自我应该如何在Django中为Forms编写测试?):

from django.tests import TestCase

class MyTests(TestCase):
    def test_forms(self):
        response = self.client.post("/my/form/", {'something':'something'})
Run Code Online (Sandbox Code Playgroud)

我的端点/ my/form有一些内部逻辑来处理'某事'.问题是,当试图以后访问request.POST.get('something')时,我无法得到任何东西.我找到了一个解决方案,所以我在下面分享.

python django django-testing

6
推荐指数
1
解决办法
4787
查看次数

在Android 9 Pie中拖放崩溃

当我在Android 9 Pie上试用我的应用程序时,我无法使拖放功能与以前的版本相同.基本上发生的是调用event.getLocalState()返回null.这只发生在Android 9. Snippet上:

protected final class DragListener implements View.OnDragListener {

    @Override
    public boolean onDrag(View v, DragEvent event) {

        // Here I get null
        final NumberButton draggedButton = (NumberButton) event.getLocalState();
    }
}
Run Code Online (Sandbox Code Playgroud)

我在OnTouchListener中初始化拖动:

protected class MyTouchListener implements View.OnTouchListener {

    private float pressedY;
    private float pressedX;

    @Override
    public boolean onTouch(final View view, MotionEvent motionEvent) {

        NumberButton draggedButton = (NumberButton) view;

        if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
            // DOING SOMETHING HERE
            return true;
        } else if (motionEvent.getAction() == MotionEvent.ACTION_MOVE) {
            if (getMoveDistance(motionEvent, …
Run Code Online (Sandbox Code Playgroud)

android drag-and-drop android-9.0-pie

5
推荐指数
1
解决办法
610
查看次数