摄像头读取条码后自动检测并捕获条码

2023-12-26

我用过这个android-vision 项目 https://github.com/googlesamples/android-vision扫描条形码。当相机检测到条形码时,我目前需要手动点击以捕获它。但是,我想稍微更改一下代码,以便在检测到条形码时自动捕获它。我怎样才能做到这一点?这是我的BarcodeCaptureActivity class:

package com.example.fs.barcodescanner;

import android.Manifest;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.PackageManager;
import android.hardware.Camera;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.design.widget.Snackbar;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.ScaleGestureDetector;
import android.view.View;
import android.view.WindowId;
import android.widget.Toast;

import com.example.fs.barcodescanner.ui.camera.CameraSource;
import com.example.fs.barcodescanner.ui.camera.CameraSourcePreview;
import com.example.fs.barcodescanner.ui.camera.GraphicOverlay;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
import com.google.android.gms.common.api.CommonStatusCodes;
import com.google.android.gms.vision.MultiProcessor;
import com.google.android.gms.vision.barcode.Barcode;
import com.google.android.gms.vision.barcode.BarcodeDetector;

import java.io.IOException;

public final class BarcodeCaptureActivity extends AppCompatActivity {
    private static final String TAG = "Barcode-reader";

    // intent request code to handle updating play services if needed.
    private static final int RC_HANDLE_GMS = 9001;

    // permission request codes need to be < 256
    private static final int RC_HANDLE_CAMERA_PERM = 2;

    // constants used to pass extra data in the intent
    public static final String AutoFocus = "AutoFocus";
    public static final String UseFlash = "UseFlash";
    public static final String BarcodeObject = "Barcode";

    private CameraSource mCameraSource;
    private CameraSourcePreview mPreview;
    private GraphicOverlay<BarcodeGraphic> mGraphicOverlay;

    // helper objects for detecting taps and pinches.
    private ScaleGestureDetector scaleGestureDetector;
    private GestureDetector gestureDetector;
    private WindowId.FocusObserver fo;

    /**
     * Initializes the UI and creates the detector pipeline.
     */
    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.activity_barcode_capture);

        mPreview = (CameraSourcePreview) findViewById(R.id.preview);
        mGraphicOverlay = (GraphicOverlay<BarcodeGraphic>) findViewById(R.id.graphicOverlay);

        // read parameters from the intent used to launch the activity.
        boolean autoFocus = getIntent().getBooleanExtra(AutoFocus, false);
        boolean useFlash = getIntent().getBooleanExtra(UseFlash, false);

        // Check for the camera permission before accessing the camera.  If the
        // permission is not granted yet, request permission.
        int rc = ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA);
        if (rc == PackageManager.PERMISSION_GRANTED) {
            createCameraSource(autoFocus, useFlash);
        } else {
            requestCameraPermission();
        }

        gestureDetector = new GestureDetector(this, new CaptureGestureListener());
        scaleGestureDetector = new ScaleGestureDetector(this, new ScaleListener());

        Snackbar.make(mGraphicOverlay, "Tap to capture. Pinch/Stretch to zoom",
                Snackbar.LENGTH_LONG)
                .show();
    }

    /**
     * Handles the requesting of the camera permission.  This includes
     * showing a "Snackbar" message of why the permission is needed then
     * sending the request.
     */
    private void requestCameraPermission() {
        Log.w(TAG, "Camera permission is not granted. Requesting permission");

        final String[] permissions = new String[]{Manifest.permission.CAMERA};

        if (!ActivityCompat.shouldShowRequestPermissionRationale(this,
                Manifest.permission.CAMERA)) {
            ActivityCompat.requestPermissions(this, permissions, RC_HANDLE_CAMERA_PERM);
            return;
        }

        final Activity thisActivity = this;

        View.OnClickListener listener = new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                ActivityCompat.requestPermissions(thisActivity, permissions,
                        RC_HANDLE_CAMERA_PERM);
            }
        };

        Snackbar.make(mGraphicOverlay, R.string.permission_camera_rationale,
                Snackbar.LENGTH_INDEFINITE)
                .setAction(R.string.ok, listener)
                .show();
    }

    @Override
    public boolean onTouchEvent(MotionEvent e) {
        boolean b = scaleGestureDetector.onTouchEvent(e);
        System.out.println("scale gesture"+b);
        boolean c = gestureDetector.onTouchEvent(e);
        System.out.println("tap gesture"+c);
        return b || c || super.onTouchEvent(e);
    }


    /**
     * Creates and starts the camera.  Note that this uses a higher resolution in comparison
     * to other detection examples to enable the barcode detector to detect small barcodes
     * at long distances.
     *
     * Suppressing InlinedApi since there is a check that the minimum version is met before using
     * the constant.
     */
    @SuppressLint("InlinedApi")
    private void createCameraSource(boolean autoFocus, boolean useFlash) {
        Context context = getApplicationContext();

        // A barcode detector is created to track barcodes.  An associated multi-processor instance
        // is set to receive the barcode detection results, track the barcodes, and maintain
        // graphics for each barcode on screen.  The factory is used by the multi-processor to
        // create a separate tracker instance for each barcode.
        BarcodeDetector barcodeDetector = new BarcodeDetector.Builder(context).build();
        BarcodeTrackerFactory barcodeFactory = new BarcodeTrackerFactory(mGraphicOverlay);
        barcodeDetector.setProcessor(
                new MultiProcessor.Builder<>(barcodeFactory).build());

        if (!barcodeDetector.isOperational()) {
            // Note: The first time that an app using the barcode or face API is installed on a
            // device, GMS will download a native libraries to the device in order to do detection.
            // Usually this completes before the app is run for the first time.  But if that
            // download has not yet completed, then the above call will not detect any barcodes
            // and/or faces.
            //
            // isOperational() can be used to check if the required native libraries are currently
            // available.  The detectors will automatically become operational once the library
            // downloads complete on device.
            Log.w(TAG, "Detector dependencies are not yet available.");

            // Check for low storage.  If there is low storage, the native library will not be
            // downloaded, so detection will not become operational.
            IntentFilter lowstorageFilter = new IntentFilter(Intent.ACTION_DEVICE_STORAGE_LOW);
            boolean hasLowStorage = registerReceiver(null, lowstorageFilter) != null;

            if (hasLowStorage) {
                Toast.makeText(this, R.string.low_storage_error, Toast.LENGTH_LONG).show();
                Log.w(TAG, getString(R.string.low_storage_error));
            }
        }

        // Creates and starts the camera.  Note that this uses a higher resolution in comparison
        // to other detection examples to enable the barcode detector to detect small barcodes
        // at long distances.
        CameraSource.Builder builder = new CameraSource.Builder(getApplicationContext(), barcodeDetector)
                .setFacing(CameraSource.CAMERA_FACING_BACK)
                .setRequestedPreviewSize(1600, 1024)
                .setRequestedFps(15.0f);

        // make sure that auto focus is an available option
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
            builder = builder.setFocusMode(
                    autoFocus ? Camera.Parameters.FOCUS_MODE_CONTINUOUS_PICTURE : null);
        }

        mCameraSource = builder
                .setFlashMode(useFlash ? Camera.Parameters.FLASH_MODE_TORCH : null)
                .build();
    }

    /**
     * Restarts the camera.
     */
    @Override
    protected void onResume() {
        super.onResume();
        startCameraSource();
    }

    /**
     * Stops the camera.
     */
    @Override
    protected void onPause() {
        super.onPause();
        if (mPreview != null) {
            mPreview.stop();
        }
    }

    /**
     * Releases the resources associated with the camera source, the associated detectors, and the
     * rest of the processing pipeline.
     */
    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (mPreview != null) {
            mPreview.release();
        }
    }

    /**
     * Callback for the result from requesting permissions. This method
     * is invoked for every call on {@link #requestPermissions(String[], int)}.
     * <p>
     * <strong>Note:</strong> It is possible that the permissions request interaction
     * with the user is interrupted. In this case you will receive empty permissions
     * and results arrays which should be treated as a cancellation.
     * </p>
     *
     * @param requestCode  The request code passed in {@link #requestPermissions(String[], int)}.
     * @param permissions  The requested permissions. Never null.
     * @param grantResults The grant results for the corresponding permissions
     *                     which is either {@link PackageManager#PERMISSION_GRANTED}
     *                     or {@link PackageManager#PERMISSION_DENIED}. Never null.
     * @see #requestPermissions(String[], int)
     */
    @Override
    public void onRequestPermissionsResult(int requestCode,
                                           @NonNull String[] permissions,
                                           @NonNull int[] grantResults) {
        if (requestCode != RC_HANDLE_CAMERA_PERM) {
            Log.d(TAG, "Got unexpected permission result: " + requestCode);
            super.onRequestPermissionsResult(requestCode, permissions, grantResults);
            return;
        }

        if (grantResults.length != 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
            Log.d(TAG, "Camera permission granted - initialize the camera source");
            // we have permission, so create the camerasource
            boolean autoFocus = getIntent().getBooleanExtra(AutoFocus,false);
            boolean useFlash = getIntent().getBooleanExtra(UseFlash, false);
            createCameraSource(autoFocus, useFlash);
            return;
        }

        Log.e(TAG, "Permission not granted: results len = " + grantResults.length +
                " Result code = " + (grantResults.length > 0 ? grantResults[0] : "(empty)"));

        DialogInterface.OnClickListener listener = new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int id) {
                finish();
            }
        };

        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("Multitracker sample")
                .setMessage(R.string.no_camera_permission)
                .setPositiveButton(R.string.ok, listener)
                .show();
    }

    /**
     * Starts or restarts the camera source, if it exists.  If the camera source doesn't exist yet
     * (e.g., because onResume was called before the camera source was created), this will be called
     * again when the camera source is created.
     */
    private void startCameraSource() throws SecurityException {
        // check that the device has play services available.
        int code = GoogleApiAvailability.getInstance().isGooglePlayServicesAvailable(
                getApplicationContext());
        if (code != ConnectionResult.SUCCESS) {
            Dialog dlg =
                    GoogleApiAvailability.getInstance().getErrorDialog(this, code, RC_HANDLE_GMS);
            dlg.show();
        }

        if (mCameraSource != null) {
            try {
                mPreview.start(mCameraSource, mGraphicOverlay);
            } catch (IOException e) {
                Log.e(TAG, "Unable to start camera source.", e);
                mCameraSource.release();
                mCameraSource = null;
            }
        }
    }

    /**
     * onTap is called to capture the oldest barcode currently detected and
     * return it to the caller.
     *
     * @param rawX - the raw position of the tap
     * @param rawY - the raw position of the tap.
     * @return true if the activity is ending.
     */
    private boolean onTap(float rawX, float rawY) {

        //TODO: use the tap position to select the barcode.
        BarcodeGraphic graphic = mGraphicOverlay.getFirstGraphic();
        Barcode barcode = null;
        if (graphic != null) {
            barcode = graphic.getBarcode();
            if (barcode != null) {
                Intent data = new Intent();
                data.putExtra(BarcodeObject, barcode);
                setResult(CommonStatusCodes.SUCCESS, data);
                finish();
            }
            else {
                Log.d(TAG, "barcode data is null");
            }
        }
        else {
            Log.d(TAG,"no barcode detected");
        }
        return barcode != null;
    }

    private class CaptureGestureListener extends GestureDetector.SimpleOnGestureListener {

        @Override
        public boolean onSingleTapConfirmed(MotionEvent e) {
            System.out.println(e.getRawX());
            System.out.println(e.getRawY());
            return onTap(e.getRawX(), e.getRawY()) || super.onSingleTapConfirmed(e);
        }
    }

    private class ScaleListener implements ScaleGestureDetector.OnScaleGestureListener {

        /**
         * Responds to scaling events for a gesture in progress.
         * Reported by pointer motion.
         *
         * @param detector The detector reporting the event - use this to
         *                 retrieve extended info about event state.
         * @return Whether or not the detector should consider this event
         * as handled. If an event was not handled, the detector
         * will continue to accumulate movement until an event is
         * handled. This can be useful if an application, for example,
         * only wants to update scaling factors if the change is
         * greater than 0.01.
         */
        @Override
        public boolean onScale(ScaleGestureDetector detector) {
            return false;
        }

        /**
         * Responds to the beginning of a scaling gesture. Reported by
         * new pointers going down.
         *
         * @param detector The detector reporting the event - use this to
         *                 retrieve extended info about event state.
         * @return Whether or not the detector should continue recognizing
         * this gesture. For example, if a gesture is beginning
         * with a focal point outside of a region where it makes
         * sense, onScaleBegin() may return false to ignore the
         * rest of the gesture.
         */
        @Override
        public boolean onScaleBegin(ScaleGestureDetector detector) {
            return true;
        }

        /**
         * Responds to the end of a scale gesture. Reported by existing
         * pointers going up.
         * <p/>
         * Once a scale has ended, {@link ScaleGestureDetector#getFocusX()}
         * and {@link ScaleGestureDetector#getFocusY()} will return focal point
         * of the pointers remaining on the screen.
         *
         * @param detector The detector reporting the event - use this to
         *                 retrieve extended info about event state.
         */
        @Override
        public void onScaleEnd(ScaleGestureDetector detector) {
            mCameraSource.doZoom(detector.getScaleFactor());
        }
    }
}

使用接口。

要做的步骤:

  1. 创建接口,如下所示:

    public interface QRCodeDetectedInterface {
    void onQRCodeDetected();}
    
  2. 在 BarcodeCaptureActivity 中实现它,如下所示:

    public final class BarcodeCaptureActivity extends AppCompatActivity implements QRCodeDetectedInterface{
     @Override
        public void onQRCodeDetected() {
    
         BarcodeGraphic graphic = mGraphicOverlay.getFirstGraphic();
            Barcode barcode = null;
            if (graphic != null) {
                barcode = graphic.getBarcode();
                if (barcode != null) {
                    Intent data = new Intent();
                    data.putExtra(BarcodeObject, barcode);
                    setResult(CommonStatusCodes.SUCCESS, data);
                    finish();
                }
                else {
                    Log.d(TAG, "barcode data is null");
                }
            }
            else {
                Log.d(TAG,"no barcode detected");
            }
        }
    }
    
  3. 并在 BarcodeGraphic.java 文件中使用它,如下所示:

    private Context context; 
    private QRCodeDetectedInterface mCallback;
    
    BarcodeGraphic(GraphicOverlay overlay) {
        super(overlay);  
        this.context = overlay.getContext();  
        mCallback = (BarcodeCaptureActivity) context;
     }
    

进而:

@Override
    public void draw(Canvas canvas) {
  mCallback.onQRCodeDetected();}  
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

摄像头读取条码后自动检测并捕获条码 的相关文章

  • 使用匕首柄作为依赖注入来处理多个改造客户端?

    我想在我的 android 应用程序中使用两个不同的后端 具有不同的响应格式 我使用 hilt 作为依赖注入 并对网络调用进行改造 这非常适合工作 因为我已经添加了第二个服务器网络文件和应用程序模块 所以它给了我错误 该错误列在最后 我需要
  • 如何用Android做交互动画(翻译)

    我在 Android 中有一些 png 序列 我需要将它们的 x 和 y 位置从屏幕顶部到底部的翻译动画化 当动画发生时 我需要对象来接收单击事件 我知道这在 3 0 之前的 Android 版本中效果不太好 因为display对象的位置与
  • 无法获取项目的未知属性“assembleRelease”

    将 Android Studio 更新到版本 2 2 并将 gradle 插件更新到 2 2 0 后 出现以下错误 错误 32 1 评估项目 jobdispatcher 时出现问题 无法获取 org gradle api Project 类
  • 使用 ColorMatrix 调整亮度

    我正在尝试使用 ColorMatrix 调整图像的亮度 当尝试调整色相时 您可以在 Photoshop 中看到此选项 亮度和亮度也是两个不同的功能 但我不知道要更改哪些值才能实现此目的 目前我可以使用此代码更改色调 public stati
  • 如何通过代码检测Android上的表情符号支持

    通过代码 我可以制作一个按钮 将这 3 个表情符号插入到文本中 不过 在许多手机上 当用户单击按钮时 问题是 显示为 X X X 或者更糟糕的是 它只显示三个空白空间 我想在无法正确显示表情符号的 Android 设备上禁用并隐藏我自己的内
  • Kotlin Android Firebase 数据库哈希映射转换为类

    我正在尝试从 firebase 数据库获取数据 断点显示它正在获取数据 但看起来我没有正确地将其分配给我的班级 这会导致此异常 java lang ClassCastException 无法将 java util HashMap 转换为 班
  • 配置项目 ':react-native-gesture-handler' 时出现问题

    大家好 我已经尝试了很长时间来解决这个问题 但不幸的是我还没有弄清楚如何解决 希望你们能帮助我 所以我有一个反应本机项目和我的朋友 以及我的一位朋友添加 React native gesture handler 包供我们使用 他对这个包没有
  • 新安装的Eclipse和Android SDK。无法让模拟器工作。挂在时钟屏幕上

    我对开发是全新的 我已经安装了 Eclipse 和 Andoid SDK 但是 我无法让模拟器工作 我已经尝试过示例记事本代码和 Hello Android 教程代码 每次我尝试运行任一应用程序时 它都会挂在时钟屏幕上 屏幕上还显示正在充电
  • Android 在 Windowmanager 中调整视图大小

    这是我的代码 menubuttonClosed li inflate R layout menu button null menubutton ImageButton menubuttonClosed findViewById R id m
  • Android 音乐播放器应用程序:如何为服务中运行的媒体播放器设置完整的侦听器?

    我正在编写一个音乐播放器应用程序 我在服务中有 MediaPlayer 对象 问题是 我不知道如何从服务更新用户界面 例如 我想更新当前歌曲的剩余时间 但是 因为 MediaPlayer 正在服务 我无法设置 MediaPlayer 对象的
  • Android Studio APK META-INF/BCKEY.DSA 中复制的重复文件

    我的代码构建得很好 但是当我尝试在调试中运行它时 出现以下错误 Error Execution failed for task app transformResourcesWithMergeJavaResForDebug com andro
  • 在 Android 中使用 AES 加密的最佳实践是什么?

    我为什么问这个问题 我知道人们对 AES 加密存在很多疑问 即使对于 Android 也是如此 如果您在网络上搜索 会发现很多代码片段 但在每个页面上 在每个 Stack Overflow 问题中 我都发现了另一个具有重大差异的实现 所以我
  • 如何从画布中删除路径区域(Android)

    我需要裁剪角落ImageView 不要将它们弄圆 而是擦除每个角上的三角形 似乎唯一的方法就是覆盖onDraw方法并使用从画布上删除这些区域Path 问题是我没有纯色背景 所以我需要擦除这些区域 但不要用某种颜色填充它们 我为此使用以下代码
  • Android - 使用 SAX 解析器解析大文件

    我正在尝试使用 SAX 解析器解析来自 webservice 的 xml 数据 当我尝试使用 URL 解析数据 大小 7 4MB 时 它工作正常 但是当我从 URL 复制 xml 数据并放置 xml 文件时 size 7 4MB 在raw文
  • 何时调用 glMatrixMode()

    我所关注的大多数 Android OpenGL ES 教程都有其 onSurfaceChanged 函数 如下所示 public void onSurfaceChanged GL10 gl int width int height gl g
  • 本地管理的广播接收器泄漏?

    当应用程序被系统杀死时 本地 即使用 LocalBroadcastManager 管理 BroadcastReceiver 是否有可能泄漏 我需要它的具体用例是我想在活动的 onCreate onDestroy 中注册 注销 Broadca
  • Android 两个 Activity 之间的共享元素转换不起作用

    在我的应用程序中 我尝试使用新引入的活动之间共享的元素 如果共享元素具有固定位置 例如 android layout gravity top 但是当视图被锚定时问题就出现了 我的第一个活动如下所示
  • Android:选择 EditField 上焦点上的所有文本

    我试图让 Android 在获得焦点时选择 EditText 字段中的所有文本 我在布局中使用此属性 在两个字段上 android selectAllOnFocus true 我不确定这是否相关 但为了将光标移动到第一个可编辑字段 前面 还
  • Android:我的应用程序太大并给出“无法执行 dex:方法 ID 不在 [0, 0xffff]: 65536”?

    我正在尝试将我的应用程序与 Box Dropbox 和 Google Drive 集成 所有这 3 项服务都需要许多第 3 方 jar 此外 我的应用程序已经需要一些第三方 jar 现在 当我尝试从 Eclipse 运行我的应用程序时 出现
  • 如何从另一个活动更新 Recyclerview 数据

    我有两个活动 MainActivity 和 Addlogactivity 我正在更新 Addlogactivity 中的数据 该数据应显示在 mainactivity recyclerview 中 数据未在数据库中更新 MianActivi

随机推荐

  • 百里香+春日转换

    这是我的数据模型 我想使用这里的日期 我在我的 html 中这样做 table tbody tr tr td user td td date td tr tr tbody table 但它带来了 table table
  • 如何更改默认的 git 提交消息

    我在prepare commit msg 文件中添加了对提交消息的一些更改 然后执行此命令 git config global commit template git hooks prepare commit msg 之后 当我执行 git
  • Node.js 缓存代理服务器

    我正在尝试使用node js 创建一个http 缓存代理服务器 我可以在其中转发到任何网页并将它们缓存在我的本地磁盘上 以下是我的第一次尝试代码 var http require http url require url sys requi
  • Galaxy Tab 在设备上调试?

    有人对 Galaxy Tab 进行过设备调试吗 我有一个普通的 Galaxy Tab 虽然 Eclpise 会让我在设备上 运行 我的应用程序 但如果我在 eclpise 中单击 调试 它不会执行任何操作 也不会尝试连接到调试器 Ideas
  • 使用 istio 作为外部 TLS 服务的反向代理

    Istio 允许您在 a 中路由 http 请求VirtualService到外部主机提供ServiceEntry存在 例如 apiVersion networking istio io v1alpha3 kind ServiceEntry
  • 未找到名称为“${body}= 创建词典”的关键字

    settings Library RequestsLibrary Library Collections Library OperatingSystem Library SeleniumLibrary Variables username
  • python numpy 成对编辑距离

    所以 我有一个 numpy 字符串数组 我想使用此函数计算每对元素之间的成对编辑距离 scipy spatial distance pdist 来自http docs scipy org doc scipy 0 13 0 reference
  • 如何将应用程序命令绑定到视图模型(WPF)?

    我已经阅读了 Josh Smith 的有关使用 RelayCommand 绑定命令以查看模型的文章 但是 我需要将 ApplicationCommands Save 绑定到视图模型 以便当用户单击保存菜单项时它会在窗口中处理 这怎么可能 我
  • 了解 iOS 应用程序中使用的 MVC 模式

    我读过Apple的MVCarticle https developer apple com library ios documentation Cocoa Conceptual CocoaFundamentals CocoaDesignPa
  • 复制到 d3dtexture 的 FreeType2 字符显示为双字母

    我最近刚刚开始使用 FreeType 库 并开始尝试从缓冲区复制到 directx9 纹理 然而 尽管我是从通过加载单个字符创建的缓冲区复制的 但目前还是出现了双字母 尝试复制字符 a 以下是我当前的代码 void TexFont free
  • 数据库存在,但返回错误“未知数据库”

    我安装了WAMP服务器几个小时前进入我的Windows 10 64 bit电脑 我用了phpmyadmin创建一个名为 的数据库testdb 并尝试使用 php 文件连接到它 我确信我创建了数据库 但它返回此错误 Warning mysql
  • Ionic 3 RSS 使用 rss2json“不可处理的实体”读取

    我在使用 Ionic 3 的 rrs2json API 将 RSS 转换为 JSON 时遇到问题 如果我执行代码 则会出现错误 gt Response body status error message rss url参数为必填项 Stat
  • 如何过滤相关对象中的字段?

    如果我尝试过滤相关对象中的字段 则 Tastypie 将返回错误 例如 运行 curl H Accept application json http localhost 8080 wordgame api v1 rounds format
  • Xcode:请求打开应用程序失败

    在一切正常并运行项目之前的某个时候 但现在我遇到的问题是request to open App failed 有谁有办法解决这个问题以及为什么会出现这个问题 Cause 可能您之前在假设 iphone 6s Plus 上运行过不同的项目 并
  • 通过[名称]引用类似定理的环境

    我正在使用 ntheorem 来排版一组条件 在我的序言中我有 theoremstyle empty newtheorem Condtion Condtion 当我想排版一个条件时 我写 begin Condtion name label
  • 如何在 Android 中单击按钮时清除活动堆栈

    我有一个问题 我的应用程序中有一个注销按钮 我们在该按钮上调用了应用程序登录屏幕 但此时当用户按下 Android 手机的后退按钮时 他在没有身份验证的情况下再次进入应用程序 这是不可取的 我希望当我们单击 注销 按钮时 所有以前的活动堆栈
  • iPhone SDK如何实现自动对焦拍照?

    我正在创建一个应用程序 用户可以在其中拍摄带有文本的图像并上传到服务器 我用过AVCaptureSession打开相机并放置一个捕获最新帧并将其上传到服务器的栏按钮 在此应用程序中 用户可以通过单击栏按钮将多张图像一张一张地发送到服务器 我
  • 如何使用 jsoup 替换标签

    我想将所有图像标签替换为div标签 我可以选择所有标签 并且我知道我必须使用replaceWith 但我无法使用它 如果我使用TextNode替换为 div div 它转换成 amp lt div amp gt my div amp lt
  • 运行 python 多进程进行图像处理

    我有一个 python 函数 它接受图像路径并输出 true 或 false 具体取决于图像是否为黑色 我想在同一台机器上处理多个图像 如果其中一个不是黑色 则停止该过程 我在这里读了很多 python celery 等中的多处理 但我不知
  • 摄像头读取条码后自动检测并捕获条码

    我用过这个android vision 项目 https github com googlesamples android vision扫描条形码 当相机检测到条形码时 我目前需要手动点击以捕获它 但是 我想稍微更改一下代码 以便在检测到条