为什么不在MySQL中为2个表创建2个外键?

时间:2017-03-14 18:37:53

标签: mysql phpmyadmin

早上好,请告诉我为什么不为2个表创建链接?因为第一个是为2号创建的

错误 在SQL查询中:

public class ScanQrCodeActivity extends AppCompatActivity {

public final static String EXTRA_MESSAGE = "hotpValume";
private static final String TAG = "Wartość błędna QR Codu";

@Override
protected void attachBaseContext(Context newBase) {
    super.attachBaseContext(CalligraphyContextWrapper.wrap(newBase));
}

SurfaceView cameraPreview;
private String hotpValue;
private String sms;
private String barcodeValue;
private String uuidDevice;
private TextView text;

/**
 * ATTENTION: This was auto-generated to implement the App Indexing API.
 * See https://g.co/AppIndexing/AndroidStudio for more information.
 */
private GoogleApiClient client;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_scan_qr_code);
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    toolbar.setNavigationIcon(R.drawable.ic_restart);
    Typeface custom_fonts = Typeface.createFromAsset(getAssets(), "fonts/OpenSans-Regular.ttf");
    TextView title_app = (TextView) findViewById(R.id.title_application_scan);
    title_app.setTypeface(custom_fonts);

    TextView stageOneText = (TextView) findViewById(R.id.stageTwoText);
    stageOneText.setTypeface(custom_fonts);

    TextView stageTwoText = (TextView) findViewById(R.id.stageTwoText);
    stageTwoText.setTypeface(custom_fonts);

    text = (TextView) findViewById(R.id.textScan);
    text.setTypeface(custom_fonts);

    cameraPreview = (SurfaceView) findViewById(R.id.cameraPreview);
    createCameraSource();

    sms = getIntent().getStringExtra("smsCode");

    uuidDevice = getIntent().getStringExtra("uuidValue");

    client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build();
}

private void createCameraSource() {

    final BarcodeDetector barcodeDetector = new BarcodeDetector.Builder(this).build();
    final CameraSource cameraSource = new CameraSource.Builder(this, barcodeDetector)
            .setAutoFocusEnabled(true)
            .setRequestedPreviewSize(1600, 1200)
            .build();

    cameraPreview.getHolder().addCallback(new SurfaceHolder.Callback() {
        @Override
        public void surfaceCreated(SurfaceHolder holder) {

            if (PackageManager.PERMISSION_GRANTED == ActivityCompat.checkSelfPermission(ScanQrCodeActivity.this, Manifest.permission.CAMERA)) {
                try {
                    cameraSource.start(cameraPreview.getHolder());
                } catch (IOException e) {

                    Log.w(TAG, e);
                    e.printStackTrace();
                }
            }else {
                showAlterDialog("Brak uprawnień ", "Brak uprawnień do camery. Spróbuj jeszcze raz.");
            }

        }

        @Override
        public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {

        }

        @Override
        public void surfaceDestroyed(SurfaceHolder holder) {
            cameraSource.stop();
        }
    });
    barcodeDetector.setProcessor(new Detector.Processor<Barcode>() {
        @Override
        public void release() {

        }

        @Override
        public void receiveDetections(Detector.Detections<Barcode> detections) {
            final SparseArray<Barcode> barcodes = detections.getDetectedItems();
            if (barcodes.size() != 0) text.post(new Runnable() {
                @Override
                public void run() {

                    Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
                    v.vibrate(500);
                    String barcodeString = barcodes.valueAt(0).displayValue;

                }
            });

        }
    });

}

enter image description here

enter image description here

0 个答案:

没有答案