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;
}
};
};
}
下面是效果图