QRリーダを起動する処理を追加しました。

This commit is contained in:
it232115 2024-01-11 10:10:20 +09:00
parent 6927b386cd
commit 81209f695d

View File

@ -11,6 +11,8 @@ import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import com.google.zxing.integration.android.IntentIntegrator;
/**
* A simple {@link Fragment} subclass.
* Use the {@link QRFragment#newInstance} factory method to
@ -74,12 +76,7 @@ public class QRFragment extends Fragment {
cameraButton.setOnClickListener(v -> {
Log.d("QRFragment", "onClick: called");
if (!sharedPreferences.getBoolean("inCar", false)) {
editor.putBoolean("inCar", true);
} else {
editor.putBoolean("inCar", false);
}
editor.apply();
new IntentIntegrator(getActivity()).initiateScan();
});
return view;