Disable back button in Android(Not working)

前端 未结 3 1006
囚心锁ツ
囚心锁ツ 2021-01-24 02:59
package com.my.app ;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
         


        
3条回答
  •  日久生厌
    2021-01-24 03:23

    I can't see a problem with your back button disabling. But there is another problem that may cause a part of this issue you are doing File IO in the UI Thread of your App.

    Android has one UI Thread that does all the painting of your UI. If you block this thread through writing large files to the disk or reading bitmaps from the disk the phone UI will freeze and not react on user input until the heavy work is done.

    I recommend to read this article on responsiveness to learn more about not blocking the UI Thread.

提交回复
热议问题