QR画像を生成するフラグメントへの画像遷移を追加しました

This commit is contained in:
it232115 2024-01-12 11:31:27 +09:00 committed by 磯野
parent ff05035662
commit c37aee2751
2 changed files with 23 additions and 4 deletions

View File

@ -34,7 +34,6 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".UrlPageActivity" />
</application>
</manifest>

View File

@ -1,7 +1,12 @@
package com.example.childguard;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
@ -9,15 +14,22 @@ import androidx.core.content.res.ResourcesCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.print.PrintHelper;
import android.util.AndroidRuntimeException;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.WriterException;
import com.journeyapps.barcodescanner.BarcodeEncoder;
/**
* A simple {@link Fragment} subclass.
* Use the {@link HomeFragment#newInstance} factory method to
@ -69,12 +81,20 @@ public class HomeFragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
//bluetooth設定ボタンの処理
View view=inflater.inflate(R.layout.fragment_home,container,false);
MainActivity activity = (MainActivity) getActivity();
Button bt1=view.findViewById(R.id.Bluetooth_setup);
//QRコード印刷の処理
Button bt1=view.findViewById(R.id.QRprinting);
bt1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
replaceFragment(new QrPrintFragment());
}
});
//bluetooth設定ボタンの処理
Button bt2=view.findViewById(R.id.Bluetooth_setup);
bt2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
replaceFragment(new bluetooth_setupFragment());