0

下面是按钮代码

 <Button
                   android:id="@+id/button_encode"
                    android:text="@string/encode"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@id/spn"
                    android:layout_alignParentRight="false"
                    android:fontFamily="TimesRoman"
                    android:background="#AD0009"
                    android:textColor="#F1F7FF"
                    android:textStyle="bold"
                    android:onClick="pdf"
                    android:textAlignment="center"
                    android:layout_marginTop="22dp"
                    android:layout_marginStart="5dp"
                    android:layout_marginEnd="5dp"
                    android:layout_marginRight="13dp"
                    android:layout_marginBottom="5dp"/>

下面是允许我将存储在微调器中的信息转换为 pdf 文档的 on Click 方法

   public void pdf(View view) {
            final Spinner spinner = (Spinner) findViewById(R.id.spin_url);
            final Spinner sp = (Spinner) findViewById(R.id.spn);
            String code = sp.getItemAtPosition(sp.getSelectedItemPosition()).toString();
            //"Encode" button
            final Button button = (Button) findViewById(R.id.button_encode);
            final Button btnpdfqr = (Button) findViewById(R.id.pdfqr);
            final Button ad = (Button) findViewById(R.id.add);
            //Set action to button
            final int STORAGE_CODE = 1;
            Intent qrDroid = new Intent(Services.ENCODE); //Set action "la.droid.qr.encode"
    
            //Set text to encode
            qrDroid.putExtra(Services.CODE, code);
            Document mDoc = new Document();
    
            //The pdf
            String mFileName = sp.getItemAtPosition(sp.getSelectedItemPosition()).toString();
    
            //pdf file path
            String mFilePath = Environment.getExternalStorageDirectory().getPath() + "/NHS_PDF/" + "Amox" + ".pdf";
            Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
            intent.addCategory(Intent.CATEGORY_OPENABLE);
            intent.setType("*/*");
            try {
                //create instance of PdfWriter class
                PdfWriter.getInstance(mDoc, new FileOutputStream(mFilePath));
                //open the document for writing
                mDoc.open();
                //get text from EditText i.e. mTextEt
    
    
                //add author of the document (optional)
                mDoc.addAuthor("Bingham");
    
                //add paragraph to the document
                mDoc.add(new Paragraph(mFileName));
    
                //close the document
                mDoc.close();
                //show message that file is saved, it will show file name and file path too
                Toast.makeText(NHSEncode.this, mFileName + ".pdf\nis saved to\n" + mFilePath, Toast.LENGTH_LONG).show();
            } catch (Exception e) {
                //if any thing goes wrong causing exception, get and show exception message
                Toast.makeText(NHSEncode.this, e.getMessage(), Toast.LENGTH_LONG).show();
            }
            //Check whether an URL or an imge is required
            if (spinner.getSelectedItemId() == 0) { //First item selected ("Get Bitmap")
                //Notify we want complete results (default is FALSE)
                image = true;
                qrDroid.putExtra(Services.IMAGE, true);
                //Optionally, set requested image size. 0 means "Fit Screen"
                qrDroid.putExtra(Services.SIZE, 0);
            } else {
                image = false;
            }
    
            //Send intent and wait result
            try {
                startActivityForResult(qrDroid, ACTIVITY_RESULT_QR_DRDROID);
            } catch (ActivityNotFoundException activity) {
                Services.qrDroidRequired(NHSEncode.this);
            }
        }

以下是单击用于将微调器信息转换为 pdf 文档的按钮时收到的错误消息

java.lang.IllegalStateException: Could not find method pdf(View) in a parent or ancestor Context for android:onClick attribute defined on view class androidx.appcompat.widget.AppCompatButton with id 'button_encode'
        at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.resolveMethod(AppCompatViewInflater.java:447)
        at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:405)
        at android.view.View.performClick(View.java:7862)
        at android.widget.TextView.performClick(TextView.java:15004)
        at android.view.View.performClickInternal(View.java:7831)
        at android.view.View.access$3600(View.java:879)
        at android.view.View$PerformClick.run(View.java:29359)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:237)
        at android.app.ActivityThread.main(ActivityThread.java:8167)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
2021-03-08 10:53:56.639 8008-8243/? E/InputDispatcher: channel '53aceec com.example.infoapp/com.example.infoapp.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
2021-03-08 10:53:56.640 10397-10397/? E/Zygote: isWhitelistProcess - Process is Whitelisted
2021-03-08 10:53:56.642 10397-10397/? E/Zygote: accessInfo : 1
2021-03-08 10:53:56.647 8008-10671/? E/WindowManager: win=Window{53aceec u0 com.example.infoapp/com.example.infoapp.MainActivity EXITING} destroySurfaces: appStopped=false win.mWindowRemovalAllowed=true win.mRemoveOnExit=true win.mViewVisibility=0 caller=com.android.server.wm.AppWindowToken.destroySurfaces:1248 com.android.server.wm.AppWindowToken.destroySurfaces:1229 com.android.server.wm.WindowState.onExitAnimationDone:5182 com.android.server.wm.-$$Lambda$01bPtngJg5AqEoOWfW3rWfV7MH4.accept:2 java.util.ArrayList.forEach:1262 com.android.server.wm.AppWindowToken.onAnimationFinished:3931 com.android.server.wm.AppWindowToken.commitVisibility:913 
2021-03-08 10:53:56.666 10397-10397/? E/android.dqagen: Not starting debugger since process cannot load the jdwp agent.
2021-03-08 10:53:56.687 27043-27247/? E/PBSessionCacheImpl: sessionId[118937986688457744] not persisted.
2021-03-08 10:53:56.699 8650-8650/? E/libprocessgroup: set_timerslack_ns write failed: Operation not permitted
2021-03-08 10:53:56.742 8650-8650/? E/libprocessgroup: set_timerslack_ns write failed: Operation not permitted
2021-03-08 10:53:57.147 8008-8287/? E/MobileWipsFrameworkService: unbinded can not send 12
2021-03-08 10:53:57.484 8774-8774/? E/ApduServiceInfo: Not adding <aid-group> with empty or invalid AIDs
2021-03-08 10:53:57.485 8774-8774/? E/ApduServiceInfo: ###---
2021-03-08 10:53:57.487 8440-8440/? E/PhoneInterfaceManager: [PhoneIntfMgr] getCarrierPackageNamesForIntent: No UICC
2021-03-08 10:53:57.490 8440-8440/? E/PhoneInterfaceManager: [PhoneIntfMgr] getCarrierPackageNamesForIntent: No UICC
2021-03-08 10:53:57.506 8774-8774/? E/ApduServiceInfo: Not adding <aid-group> with empty or invalid AIDs
2021-03-08 10:53:57.506 8774-8774/? E/ApduServiceInfo: ###---
2021-03-08 10:53:58.974 26565-10452/? E/memtrack: Couldn't load memtrack module
2021-03-08 10:53:59.112 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:53:59.411 8008-8287/? E/MobileWipsFrameworkService: unbinded can not send 13
2021-03-08 10:54:00.506 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:54:03.236 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:54:05.514 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:54:08.063 688-688/? E/audit: type=1400 audit(1615200848.055:38750): avc:  denied  { kill } for  pid=0 comm="swapper/0" capability=5  scontext=u:r:kernel:s0 tcontext=u:r:kernel:s0 tclass=capability permissive=0 SEPF_SM-A715F_10_0022 audit_filtered
2021-03-08 10:54:10.521 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:54:12.525 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:54:14.022 8650-8650/? E/libprocessgroup: set_timerslack_ns write failed: Operation not permitted
2021-03-08 10:54:14.044 8650-8650/? E/libprocessgroup: set_timerslack_ns write failed: Operation not permitted
2021-03-08 10:54:14.448 7824-7845/? E/Netd: getNetworkForDns: getNetId from enterpriseCtrl is netid 0
2021-03-08 10:54:14.579 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:54:14.871 26565-2367/? E/SQLiteCastStore: Skip saving CastDeviceInfo: "Nearby device" (__cast_nearby___V_4a86f223-3d53-42dd-8348-806b56453fce)
2021-03-08 10:54:15.524 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:54:15.622 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:54:16.662 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:54:17.709 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:54:20.442 8008-8080/? E/Watchdog: !@Sync 6045 [2021-03-08 10:54:20.441] FD count : 802, wdog_way : softdog
2021-03-08 10:54:20.531 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:54:20.792 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:54:22.846 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:54:25.537 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:54:30.538 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:54:30.915 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:54:32.710 7824-7845/? E/Netd: getNetworkForDns: getNetId from enterpriseCtrl is netid 0
2021-03-08 10:54:33.080 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:54:33.966 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:54:35.544 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:54:36.203 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:54:40.550 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:54:41.351 21318-21318/? E/Finsky: [2] aqgb.run(3): Error while cleaning up task
    java.util.concurrent.ExecutionException: com.google.common.util.concurrent.TimeoutFuture$TimeoutFutureException: Timed out: cmg@bb662ab[status=PENDING, info=[tag=[class apjw]]]
        at bbzu.s(PG:3)
        at bbzu.get(PG:2)
        at bccv.a(PG:1)
        at bcbq.r(Unknown Source:9)
        at aqgb.run(Unknown Source:2)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:237)
        at android.app.ActivityThread.main(ActivityThread.java:8167)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
     Caused by: com.google.common.util.concurrent.TimeoutFuture$TimeoutFutureException: Timed out: cmg@bb662ab[status=PENDING, info=[tag=[class apjw]]]
2021-03-08 10:54:42.354 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:54:43.122 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:54:45.556 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:54:48.545 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:54:49.593 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:54:50.456 8008-8080/? E/Watchdog: !@Sync 6046 [2021-03-08 10:54:50.455] FD count : 802, wdog_way : softdog
2021-03-08 10:54:50.563 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:54:53.726 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:54:54.788 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:54:55.569 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:55:00.041 8650-8650/? E/libprocessgroup: set_timerslack_ns write failed: Operation not permitted
2021-03-08 10:55:00.051 8650-8650/? E/libprocessgroup: set_timerslack_ns write failed: Operation not permitted
2021-03-08 10:55:00.576 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:55:05.583 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:55:08.073 688-688/? E/audit: type=1400 audit(1615200908.055:38751): avc:  denied  { kill } for  pid=0 comm="swapper/0" capability=5  scontext=u:r:kernel:s0 tcontext=u:r:kernel:s0 tclass=capability permissive=0 SEPF_SM-A715F_10_0022 audit_filtered
2021-03-08 10:55:09.173 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:55:10.210 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:55:10.588 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:55:12.273 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:55:15.596 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:55:18.450 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:55:19.487 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:55:20.462 8008-8080/? E/Watchdog: !@Sync 6047 [2021-03-08 10:55:20.462] FD count : 802, wdog_way : softdog
2021-03-08 10:55:20.523 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:55:20.602 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:55:21.569 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:55:22.606 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:55:23.642 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:55:25.605 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:55:25.734 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:55:27.811 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:55:28.887 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:55:29.891 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:55:30.612 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:55:35.618 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:55:37.096 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:55:38.069 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:55:40.624 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:55:45.625 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:55:49.212 26565-18858/? E/memtrack: Couldn't load memtrack module
2021-03-08 10:55:50.476 8008-8080/? E/Watchdog: !@Sync 6048 [2021-03-08 10:55:50.476] FD count : 802, wdog_way : softdog
2021-03-08 10:55:50.631 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:55:52.473 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:55:53.366 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:55:54.543 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:55:55.634 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:55:57.633 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:55:58.682 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:55:59.490 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:56:00.053 8650-8650/? E/libprocessgroup: set_timerslack_ns write failed: Operation not permitted
2021-03-08 10:56:00.070 8650-8650/? E/libprocessgroup: set_timerslack_ns write failed: Operation not permitted
2021-03-08 10:56:00.081 8008-8088/? E/BatteryExternalStatsWorker: no controller energy info supplied for bluetooth
2021-03-08 10:56:00.118 8008-8088/? E/KernelCpuSpeedReader: Failed to read cpu-freq: /sys/devices/system/cpu/cpu6/cpufreq/stats/time_in_state: open failed: ENOENT (No such file or directory)
2021-03-08 10:56:00.118 8008-8088/? E/KernelCpuSpeedReader: Failed to read cpu-freq: /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state: open failed: ENOENT (No such file or directory)
2021-03-08 10:56:00.639 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:56:01.791 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:56:02.538 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:56:05.645 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:56:08.078 688-688/? E/audit: type=1400 audit(1615200968.055:38752): avc:  denied  { kill } for  pid=0 comm="swapper/0" capability=5  scontext=u:r:kernel:s0 tcontext=u:r:kernel:s0 tclass=capability permissive=0 SEPF_SM-A715F_10_0022 audit_filtered
2021-03-08 10:56:10.648 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:56:15.653 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:56:17.806 8440-8440/? E/PhoneInterfaceManager: [PhoneIntfMgr] getCarrierPackageNamesForIntent: No UICC
2021-03-08 10:56:17.823 8774-8774/? E/ApduServiceInfo: Not adding <aid-group> with empty or invalid AIDs
2021-03-08 10:56:17.824 8774-8774/? E/ApduServiceInfo: ###---
2021-03-08 10:56:20.490 8008-8080/? E/Watchdog: !@Sync 6049 [2021-03-08 10:56:20.490] FD count : 802, wdog_way : softdog
2021-03-08 10:56:20.659 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:56:23.907 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:56:25.411 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:56:25.666 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:56:28.504 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:56:29.576 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:56:30.669 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:56:35.675 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:56:36.128 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:56:37.779 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:56:38.827 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:56:39.188 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:56:40.681 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:56:41.947 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:56:42.246 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:56:44.008 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:56:45.056 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:56:45.687 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:56:50.512 8008-8080/? E/Watchdog: !@Sync 6050 [2021-03-08 10:56:50.511] FD count : 802, wdog_way : softdog
2021-03-08 10:56:50.693 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:56:55.697 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:57:00.038 8650-8650/? E/libprocessgroup: set_timerslack_ns write failed: Operation not permitted
2021-03-08 10:57:00.055 8650-8650/? E/libprocessgroup: set_timerslack_ns write failed: Operation not permitted
2021-03-08 10:57:00.703 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:57:03.571 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:57:05.705 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:57:07.825 14304-10502/? E/memtrack: Couldn't load memtrack module
2021-03-08 10:57:08.083 688-688/? E/audit: type=1400 audit(1615201028.065:38753): avc:  denied  { kill } for  pid=0 comm="swapper/0" capability=5  scontext=u:r:kernel:s0 tcontext=u:r:kernel:s0 tclass=capability permissive=0 SEPF_SM-A715F_10_0022 audit_filtered
2021-03-08 10:57:10.708 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:57:11.562 16782-23755/? E/memtrack: Couldn't load memtrack module
2021-03-08 10:57:13.843 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:57:14.881 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:57:15.715 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:57:20.528 8008-8080/? E/Watchdog: !@Sync 6051 [2021-03-08 10:57:20.528] FD count : 802, wdog_way : softdog
2021-03-08 10:57:20.723 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:57:21.137 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:57:25.728 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:57:30.737 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:57:34.738 16782-10505/? E/memtrack: Couldn't load memtrack module
2021-03-08 10:57:35.464 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:57:35.743 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:57:36.529 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:57:40.745 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:57:45.751 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:57:46.050 7824-7845/? E/Netd: getNetworkForDns: getNetId from enterpriseCtrl is netid 0
2021-03-08 10:57:50.543 8008-8080/? E/Watchdog: !@Sync 6052 [2021-03-08 10:57:50.543] FD count : 802, wdog_way : softdog
2021-03-08 10:57:50.756 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:57:53.623 20634-20834/? E/memtrack: Couldn't load memtrack module
2021-03-08 10:57:55.763 3319-3348/? E/perfsdkserver: [Interface] BpPerfSDKService::connectionRequest() 
2021-03-08 10:57:57.032 12253-12253/? E/HONEYBOARD: c activeNetwork is null 
2021-03-08 10:57:58.113 14304-9870/? E/memtrack: Couldn't load memtrack module

如何解决此错误,该错误允许我将存储在微调器中的文本嵌入到可以存储到移动设备上的 pdf 文档中

4

1 回答 1

0

看看pdf class

public void pdf(View view) 

你对 pdf class( View) 有争论。当您从android:onClick="pdf". 您无法发送任何参数。这就是发生错误的原因。

错误:在父级中找不到方法 pdf( View )

您可以通过删除View参数来尝试。

public void pdf()

尝试以下源代码,而不是android:onClick="pdf"

button.setOnClickListener(new View.OnClickListener() {
      @Override
        public void onClick(View view) {
            pdf();
        }

}
于 2021-03-09T16:03:52.703 回答