Android之zip文件加密解压及进度条的实现(2)

public class CompressStatus {
 public final static int START=0;
 public final static int HANDLING=1;
 public final static int COMPLETED=2;
 public final static int ERROR=3;
}

MainActivity.java

private Handler _handler=new Handler(){
  @Override
  public void handleMessage(Message msg) {
   switch (msg.what) {
   case CompressStatus.START:
   {
    setTitle("Start...");
    break;
   }
   case CompressStatus.HANDLING:
   {
    Bundle bundle=msg.getData();
    int percent=bundle.getInt(CompressKeys.PERCENT);
    setTitle(percent+"%");
    break;
   }
   case CompressStatus.ERROR:
   {
    Bundle bundle=msg.getData();
    String error=bundle.getString(CompressKeys.ERROR);
    _info_textView.setText(error);
    break;
   }
   case CompressStatus.COMPLETED:
   {
    setTitle("Completed");
    byte[] data=FileSp.read(tempFilePath);
    try {
     String dataStr=new String(data,"UTF-8");
     _info_textView.setText(dataStr);
    } catch (UnsupportedEncodingException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
    }   
    break;
   }
   default:
    break;
   }   
   
  };
 };
}

下面是效果图

Android之zip文件加密解压及进度条的实现

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/4788c839116cdf70e233cc6312af1647.html