From 87f05224a4e2f65e97e6670d9261692d873df3d0 Mon Sep 17 00:00:00 2001 From: it232115 Date: Fri, 22 Dec 2023 12:16:40 +0900 Subject: [PATCH] =?UTF-8?q?QR=E3=82=AB=E3=83=A1=E3=83=A9=E8=B5=B7=E5=8B=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/example/childguard/QRFragment.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/example/childguard/QRFragment.java b/app/src/main/java/com/example/childguard/QRFragment.java index 4321325..14f8ff6 100644 --- a/app/src/main/java/com/example/childguard/QRFragment.java +++ b/app/src/main/java/com/example/childguard/QRFragment.java @@ -1,13 +1,18 @@ package com.example.childguard; +import android.content.Intent; import android.os.Bundle; import androidx.fragment.app.Fragment; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import com.google.zxing.integration.android.IntentIntegrator; +import com.google.zxing.integration.android.IntentResult; + /** * A simple {@link Fragment} subclass. * Use the {@link QRFragment#newInstance} factory method to @@ -49,11 +54,12 @@ public class QRFragment extends Fragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - if (getArguments() != null) { - mParam1 = getArguments().getString(ARG_PARAM1); - mParam2 = getArguments().getString(ARG_PARAM2); + new IntentIntegrator(getActivity()).initiateScan();//QRカメラ起動 } - } + + + //QRカメラから受け取った引数の処理 + @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, @@ -61,4 +67,5 @@ public class QRFragment extends Fragment { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_qr, container, false); } + } \ No newline at end of file