为什么初始化函数会导致活动崩溃?

时间:2021-06-19 09:47:26

标签: android

我正在尝试编写一个模拟键盘输入的应用程序。活动中有一个函数 initialize()。该函数用于初始化 UI。但是,该功能使活动崩溃。我想知道为什么会发生这种情况。`

private void initialize(){
        // initialize the UI;
        labelsInitialize();
        calculatePositionsAndLocations();
        drawKeyboard();

        // set the target directory name and file name
        directoryName = "Subject_" + subjectID + "_" +firstName + "_" + lastName;
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault());
        resultFileName = "Day_" + dayNum + "_Keyboard_" + keyboardNum + "_" + sdf.format(new Date()) + ".txt";

        // create an object of the File I/O wrapper class
        bufferedData = new ArrayList<>();

        // load the test phrases and display the first target phrase on the interface
        // loadTestCaseFile();
        TargetPhrase.setText(testPhrases.get(currentPhraseNum));
        TranscribedPhrase.setText("");

        // set the touch event listener on part of the layout;
        myKC = findViewById(R.id.keyboard_container);
        myKC.setOnTouchListener(new View.OnTouchListener(){
            @Override
            public boolean onTouch(View v, MotionEvent event)
            {
                if (event.getAction() == MotionEvent.ACTION_DOWN){
                    touchEventHandler(event.getX(), event.getY());
                }
                return true;
            }

这是日志: 2021-06-19 18:55:54.588 2639-31662/? E/DollieActivityManagerAdapter: HwActivityNotifierEx null uid 2021-06-19 18:55:54.588 1706-3380/? E/HwActivityTaskManagerServiceEx: 无效的 ActivityRecord,错误。 2021-06-19 18:55:54.588 1706-3380/? E/HwActivityTaskManagerServiceEx:解析活动信息错误。 2021-06-19 18:55:54.597 2639-2814/? E/DollieAdapterService:notifyActivityState pkg:com.example.magickeyboard/com.example.magickeyboard.Activities.KeyboardSelection state:20 fg:false mUid:10182 2021-06-19 18:55:54.598 2639-2814/? E/NetworkQoe:sendModemParaCollecEnable 无效 defaultDataSlotId=-1 2021-06-19 18:55:54.600 2639-2814/? E/BoosterUtil:convertSubIdToSlotId 失败,subId:0,slotId:-1 2021-06-19 18:55:54.600 2639-2814/? E/BoosterUtil:getDefaultDataSlotId 失败,slotId 无效:-1,subId:0 2021-06-19 18:55:54.600 2639-2814/? E/BroadcastProxy: isDataOn 失败,无效 slotId=-1 2021-06-19 18:55:54.600 2639-2814/? E/SmartDualCardConfig: isAppInBlackList false,items==null 2021-06-19 18:55:54.600 2639-2814/? E/ScgQuickAddManager: uidInfo.isForeGroundUid() 为假 2021-06-19 18:55:54.610 1706-2561/? E/ProcessInfoCollector: getProcessInfo: 找不到这个过程。 2021-06-19 18:55:54.631 32060-32060/? E/e.magickeyboar:runtime_flags 中设置的未知位:0x8000 2021-06-19 18:55:54.663 2639-3500/? E/Hicom_PolicyCenter:handleAppStarted。 multipathPolicy 为空 2021-06-19 18:55:54.695 1039-1050/? E/AwareLog: iawared: GetFileContent open /proc/32091/task/32093/cpuset fail errno(2)! 2021-06-19 18:55:54.703 32060-32095/com.example.magickeyboard E/AwareLog:AtomicFileUtils:readFileLines 文件不存在:android.util.AtomicFile@ec5eade 2021-06-19 18:55:54.783 2639-2814/? E/DollieAdapterService:notifyActivityState pkg:com.example.magickeyboard/com.example.magickeyboard.Activities.DaySelection state:2 fg:true mUid:10182 2021-06-19 18:55:54.785 2639-2814/? E/BoosterUtil:convertSubIdToSlotId 失败,subId:0,slotId:-1 2021-06-19 18:55:54.785 2639-2814/? E/BoosterUtil:getDefaultDataSlotId 失败,slotId 无效:-1,subId:0 2021-06-19 18:55:54.785 2639-2814/? E/NetworkQoe:sendModemParaCollecEnable 无效 defaultDataSlotId=-1 2021-06-19 18:55:54.786 2639-2814/? E/BoosterUtil:convertSubIdToSlotId 失败,subId:0,slotId:-1 2021-06-19 18:55:54.786 2639-2814/? E/BoosterUtil:getDefaultDataSlotId 失败,slotId 无效:-1,subId:0 2021-06-19 18:55:54.786 2639-2814/? E/BroadcastProxy: isDataOn 失败,无效 slotId=-1 2021-06-19 18:55:54.787 2639-2814/? E/BoosterUtil:convertSubIdToSlotId 失败,subId:0,slotId:-1 2021-06-19 18:55:54.787 2639-2814/? E/BoosterUtil:getDefaultDataSlotId 失败,slotId 无效:-1,subId:0 2021-06-19 18:55:54.787 2639-2814/? E/BroadcastProxy: isDataOn 失败,无效 slotId=-1 2021-06-19 18:55:54.788 2639-2814/? E/SmartDualCardConfig: isAppInBlackList false,items==null 2021-06-19 18:55:54.788 2639-2814/? E/ScgQuickAddManager:compName 是 :com.example.magickeyboard 2021-06-19 18:55:54.789 2639-2814/? E/BoosterUtil:convertSubIdToSlotId 失败,subId:0,slotId:-1 2021-06-19 18:55:54.789 2639-2814/? E/BoosterUtil:getDefaultDataSlotId 失败,slotId 无效:-1,subId:0 2021-06-19 18:55:54.789 2639-2814/? E/BroadcastProxy: isDataOn 失败,无效 slotId=-1

0 个答案:

没有答案
相关问题