From 5af6a41bab51ef09f44c5d858922d624fffe623a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=8D=E3=82=80=E3=81=AD=E3=81=93?= Date: Thu, 11 Jan 2024 16:56:51 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=B9=E3=82=AD=E3=83=A3=E3=83=B3=E7=B5=90?= =?UTF-8?q?=E6=9E=9C=E3=82=92=E3=83=91=E3=83=BC=E3=82=B9=E3=81=97=E3=81=A6?= =?UTF-8?q?ChromeCustomTabs=E3=81=A7=E9=96=8B=E3=81=8F=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/example/childguard/QRFragment.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/example/childguard/QRFragment.java b/app/src/main/java/com/example/childguard/QRFragment.java index 71b0f96..ed63a6a 100644 --- a/app/src/main/java/com/example/childguard/QRFragment.java +++ b/app/src/main/java/com/example/childguard/QRFragment.java @@ -2,10 +2,12 @@ package com.example.childguard; import android.content.Intent; import android.content.SharedPreferences; +import android.net.Uri; import android.os.Bundle; import androidx.activity.result.ActivityResultLauncher; import androidx.activity.result.contract.ActivityResultContracts; +import androidx.browser.customtabs.CustomTabsIntent; import androidx.fragment.app.Fragment; import android.util.Log; @@ -20,6 +22,8 @@ import com.google.zxing.integration.android.IntentResult; import com.journeyapps.barcodescanner.ScanContract; import com.journeyapps.barcodescanner.ScanOptions; +import java.util.Objects; + /** * A simple {@link Fragment} subclass. * Use the {@link QRFragment#newInstance} factory method to @@ -83,8 +87,12 @@ public class QRFragment extends Fragment { // dataPass.onDataPass(result.getContents()); //画面遷移 Toast.makeText(getContext(), result.getContents(), Toast.LENGTH_SHORT).show(); - Intent intent=new Intent(getActivity(),UrlPageActivity.class); - startActivity(intent); +// Intent intent=new Intent(getActivity(),UrlPageActivity.class); +// startActivity(intent); + + CustomTabsIntent.Builder builder = new CustomTabsIntent.Builder(); + CustomTabsIntent customTabsIntent = builder.build(); + customTabsIntent.launchUrl(requireContext(), Uri.parse(result.getContents())); } });