From 9e5babf9db52e64bdae60137be7696e56241fca6 Mon Sep 17 00:00:00 2001 From: xingzilong <xingzilong@454eff88-639b-444f-9e54-f578c98de674> Date: 星期五, 18 八月 2017 18:12:17 +0800 Subject: [PATCH] H264 NALU解析 并在RTSPServer判断 --- VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/discern/common/BaseCommonCallBack.java | 30 ++++++++++++++++++++++++++---- 1 files changed, 26 insertions(+), 4 deletions(-) diff --git a/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/discern/common/BaseCommonCallBack.java b/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/discern/common/BaseCommonCallBack.java index 311c670..5e99c60 100644 --- a/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/discern/common/BaseCommonCallBack.java +++ b/VisitFace/DemoForBsk/app/src/main/java/cn/com/basic/face/discern/common/BaseCommonCallBack.java @@ -8,8 +8,11 @@ import cn.com.basic.face.base.BaseApplication; import org.xutils.common.Callback; +import org.xutils.ex.HttpException; import java.net.ConnectException; +import java.net.SocketTimeoutException; +import java.util.ArrayList; import java.util.List; public abstract class BaseCommonCallBack implements Callback.CommonCallback<ResultBean>{ @@ -35,7 +38,18 @@ return JSON.parseArray(jsonArray.toJSONString(), requiredType); } } - return null; + return new ArrayList<>(); + } + + public <T> List<T> getExtraList(Class<T> requiredType) { + Object data = resultBean.getExtraData(); + if (data != null) { + if (data instanceof JSONArray) { + JSONArray jsonArray = (JSONArray) data; + return JSON.parseArray(jsonArray.toJSONString(), requiredType); + } + } + return new ArrayList<>(); } @Override @@ -52,13 +66,22 @@ @Override public void onCancelled(CancelledException cex) { - System.out.print("hello"); } @Override public void onError(Throwable ex, boolean isOnCallback) { + if (ex instanceof SocketTimeoutException) { + Toast.makeText(BaseApplication.getInstance(), "socket杩炴帴瓒呮椂", Toast.LENGTH_SHORT ).show(); + return; + } if (ex instanceof ConnectException) { - Toast.makeText(BaseApplication.getInstance(), "鏈嶅姟鍣ㄩ摼鎺ュけ璐�", Toast.LENGTH_SHORT ).show(); + Toast.makeText(BaseApplication.getInstance(), "鏈嶅姟鍣ㄨ繛鎺ュけ璐�", Toast.LENGTH_SHORT ).show(); + return; + } + System.out.println(ex.getClass().getName()); + if (ex instanceof org.xutils.ex.HttpException) { + org.xutils.ex.HttpException httpException = (org.xutils.ex.HttpException)ex; + Toast.makeText(BaseApplication.getInstance(), "鏈嶅姟鍣ㄨ闂敊璇紝閿欒浠g爜锛�"+httpException.getErrorCode(), Toast.LENGTH_SHORT ).show(); return; } Toast.makeText(BaseApplication.getInstance(), "缃戠粶杩炴帴澶辫触"+ex.getMessage(), Toast.LENGTH_SHORT ).show(); @@ -66,7 +89,6 @@ @Override public void onFinished() { - System.out.print("hello"); } public int getPageNum() { -- Gitblit v1.8.0