本文介绍了我解决不了这个问题......(一阵我的应用程序此错误后...)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我连接网络摄像机(JPEG),并显示这张图片,我重复不断,过了一会儿,我的应用程序错误这一点。我测试的其他手机,显示这一个。

  15 10-28:12:51.525:ERROR / AndroidRuntime(675):未捕获的处理程序:螺纹螺纹-11退出,由于未捕获的异常

我的codeS:

 公共无效解析(InputStream为){
  尝试{
   如果(!type.isMjpegStream()){
    CameraManagerScreen.ActiveCam.setConnected(真);
    setImage(是);
    is.close();
    System.gc()的;
    如果(!mjpeghttp.isCanceled())
      走();
   }
  }赶上(例外五){
  }
 }

和我的连接是:

 保护无效连接(){
 InputStream为= NULL;尝试{ 的HttpParams httpParameters =新BasicHttpParams();
 //设置超时时间以毫秒为单位,直到建立连接
 //建立。
 INT timeoutConnection = 20000;
 HttpConnectionParams.setConnectionTimeout(httpParameters,
   timeoutConnection);
 //设置默认的套接字超时(SO_TIMEOUT)
 //毫秒是用于等待数据的超时。
 INT timeoutSocket = 20000;
 HttpConnectionParams.setSoTimeout(httpParameters,timeoutSocket); 客户端=新DefaultHttpClient(httpParameters); 方法=新HTTPGET(的getURL());
 的System.out.println(Baglanıyor:+ method.getURI()的toString());
 method.addHeader(授权,getBase64En code()); RES = client.execute(法);
 的System.out.println(回应:
   + res.getStatusLine()的getStatus code()); 是= res.getEntity()的getContent()。 如果(!取消){
  onReturn(res.getStatusLine()的getStatus code()是); }}赶上(例外五){
 的System.out.println(e.getMessage()); 尝试{  取消= TRUE;  视频下载(60); }赶上(例外IE){
}
 onError的(新的异常(0));
}
}

错误...

  10-28 14:13:06.794:信息/ dalvikvm(3502):堆栈溢出,扩大(0x439b0200到0x439b0000)
10-28 14:13:06.794:信息/ dalvikvm(3502):缩小栈(以0x439b0200,当前帧是0x439b0268)
10-28 14:13:06.794:WARN / dalvikvm(3502):主题ID = 17:螺纹未捕获的异常退出(组= 0x4001b180)
10-28 14:06:19.944:ERROR / AndroidRuntime(3420):未捕获的处理程序:螺纹螺纹-11退出,由于未捕获的异常
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):java.lang.StackOverflowError
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在java.util.Hashtable.get(Hashtable.java:274)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在java.util.Properties.getProperty(Properties.java:177)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在java.lang.System.getProperty(System.java:440)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在java.lang.System.getProperty(System.java:412)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在java.lang.Boolean.getBoolean(Boolean.java:174)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在org.apache.harmony.luni.net.NetUtil $ Action.run(NetUtil.java:89)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在org.apache.harmony.luni.net.NetUtil $ Action.run(NetUtil.java:80)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在java.security.AccessController.doPrivilegedImpl(AccessController.java:264)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在java.security.AccessController.doPrivileged(AccessController.java:84)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在org.apache.harmony.luni.net.NetUtil preferIPv4Stack(NetUtil.java:61)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在org.apache.harmony.luni.net.PlainSocketImpl.create(PlainSocketImpl.java:266)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在java.net.Socket.checkClosedAndCreate(Socket.java:889)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在java.net.Socket.connect(Socket.java:1036)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:117)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:140)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:348)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.connection.Http.connect(Http.java:75)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.connection.MjpegHttp.connect(MjpegHttp.java:33)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.connection.Http.go(Http.java:46)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.connection.CameraHttp.go(CameraHttp.java:13)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.camera.Camera.go(Camera.java:121)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.camera.Camera.parse(Camera.java:170)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.connection.MjpegHttp.onReturn(MjpegHttp.java:23)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.connection.Http.connect(Http.java:82)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.connection.MjpegHttp.connect(MjpegHttp.java:33)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.connection.Http.go(Http.java:46)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.connection.CameraHttp.go(CameraHttp.java:13)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.camera.Camera.go(Camera.java:121)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.camera.Camera.parse(Camera.java:170)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.connection.MjpegHttp.onReturn(MjpegHttp.java:23)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.connection.Http.connect(Http.java:82)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.connection.MjpegHttp.connect(MjpegHttp.java:33)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.connection.Http.go(Http.java:46)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.connection.CameraHttp.go(CameraHttp.java:13)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.camera.Camera.go(Camera.java:121)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.camera.Camera.parse(Camera.java:170)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.connection.MjpegHttp.onReturn(MjpegHttp.java:23)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.connection.Http.connect(Http.java:82)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.connection.MjpegHttp.connect(MjpegHttp.java:33)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.connection.Http.go(Http.java:46)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.connection.CameraHttp.go(CameraHttp.java:13)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.camera.Camera.go(Camera.java:121)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.camera.Camera.parse(Camera.java:170)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.connection.MjpegHttp.onReturn(MjpegHttp.java:23)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.connection.Http.connect(Http.java:82)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.connection.MjpegHttp.connect(MjpegHttp.java:33)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.connection.Http.go(Http.java:46)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.connection.CameraHttp.go(CameraHttp.java:13)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.camera.Camera.go(Camera.java:121)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.camera.Camera.parse(Camera.java:170)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.connection.MjpegHttp.onReturn(MjpegHttp.java:23)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.connection.Http.connect(Http.java:82)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.connection.MjpegHttp.connect(MjpegHttp.java:33)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.connection.Http.go(Http.java:46)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.connection.CameraHttp.go(CameraHttp.java:13)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepvizyon.camera.Camera.go(Camera.java:121)
    10-28 14:06:19.994:ERROR / AndroidRuntime(3420):在spexco.cepviz


解决方案

 公共无效解析(InputStream为){
    如果(!mjpeghttp.isCanceled())
      走();

到底是什么去()吗?它调用连接(),什么叫

 如果(!取消){
  onReturn(res.getStatusLine()的getStatus code()是);
 }

onReturn()通话解析()一次。 解析()通话去()通话连接()电话 onReturn()通话解析()通话...它从来没有(?)结束。为什么解析必须连接?每个函数调用需要一些内存。很多呼叫后,没有更多的记忆中留下,你会得到一个堆栈溢出异常。

您需要打破圆一些地方。你可以删除这样的:

 如果(!mjpeghttp.isCanceled())
  走();


我不认为它甚至一度睡

  {尝试  取消= TRUE;
  的System.out.println(睡眠睡觉!);
  视频下载(60); }赶上(例外IE){

是否打印呢?


怎么样?

  imageSet = FALSE;
而(!imageSet)
{
   如果(连接())
     如果(解析())
       imageSet = TRUE;
}

I connect a ıp cam(jpeg), and show this image, and ı repeat continually, After a while my app error this. And I tested other phone and showed this one.

10-28 15:12:51.525: ERROR/AndroidRuntime(675): Uncaught handler: thread Thread-11 exiting due to uncaught exception

my codes:

public void parse(InputStream is){
  try {
   if (!type.isMjpegStream()) {
    CameraManagerScreen.ActiveCam.setConnected(true);
    setImage(is);
    is.close();
    System.gc();
    if(!mjpeghttp.isCanceled())
      go();
   } 
  } catch (Exception e) {
  }
 }

and my connection is:

protected void connect() {
 InputStream is = null;

try {



 HttpParams httpParameters = new BasicHttpParams();
 // Set the timeout in milliseconds until a connection is
 // established.
 int timeoutConnection = 20000;
 HttpConnectionParams.setConnectionTimeout(httpParameters,
   timeoutConnection);
 // Set the default socket timeout (SO_TIMEOUT)
 // in milliseconds which is the timeout for waiting for data.
 int timeoutSocket = 20000;
 HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket);

 client = new DefaultHttpClient(httpParameters);

 method = new HttpGet(getUrl());
 System.out.println("Baglanıyor:  " + method.getURI().toString());
 method.addHeader("Authorization", getBase64Encode());

 res = client.execute(method);
 System.out.println("RESPONSE: "
   + res.getStatusLine().getStatusCode());

 is = res.getEntity().getContent();

 if (!cancel) {
  onReturn(res.getStatusLine().getStatusCode(), is);

 }

} catch (Exception e) {
 System.out.println(e.getMessage());

 try {

  cancel = true;

  Thread.sleep(60);

 } catch (Exception ie) {
}
 onError(new Exception("0"));
}
}

Error...

 10-28 14:13:06.794: INFO/dalvikvm(3502): Stack overflow, expanding (0x439b0200 to 0x439b0000)
10-28 14:13:06.794: INFO/dalvikvm(3502): Shrank stack (to 0x439b0200, curFrame is 0x439b0268)
10-28 14:13:06.794: WARN/dalvikvm(3502): threadid=17: thread exiting with uncaught exception (group=0x4001b180)
10-28 14:06:19.944: ERROR/AndroidRuntime(3420): Uncaught handler: thread Thread-11 exiting due to uncaught exception
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420): java.lang.StackOverflowError
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at java.util.Hashtable.get(Hashtable.java:274)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at java.util.Properties.getProperty(Properties.java:177)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at java.lang.System.getProperty(System.java:440)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at java.lang.System.getProperty(System.java:412)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at java.lang.Boolean.getBoolean(Boolean.java:174)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at org.apache.harmony.luni.net.NetUtil$Action.run(NetUtil.java:89)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at org.apache.harmony.luni.net.NetUtil$Action.run(NetUtil.java:80)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at java.security.AccessController.doPrivilegedImpl(AccessController.java:264)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at java.security.AccessController.doPrivileged(AccessController.java:84)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at org.apache.harmony.luni.net.NetUtil.preferIPv4Stack(NetUtil.java:61)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at org.apache.harmony.luni.net.PlainSocketImpl.create(PlainSocketImpl.java:266)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at java.net.Socket.checkClosedAndCreate(Socket.java:889)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at java.net.Socket.connect(Socket.java:1036)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:117)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:140)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:348)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.connection.Http.connect(Http.java:75)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.connection.MjpegHttp.connect(MjpegHttp.java:33)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.connection.Http.go(Http.java:46)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.connection.CameraHttp.go(CameraHttp.java:13)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.camera.Camera.go(Camera.java:121)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.camera.Camera.parse(Camera.java:170)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.connection.MjpegHttp.onReturn(MjpegHttp.java:23)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.connection.Http.connect(Http.java:82)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.connection.MjpegHttp.connect(MjpegHttp.java:33)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.connection.Http.go(Http.java:46)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.connection.CameraHttp.go(CameraHttp.java:13)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.camera.Camera.go(Camera.java:121)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.camera.Camera.parse(Camera.java:170)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.connection.MjpegHttp.onReturn(MjpegHttp.java:23)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.connection.Http.connect(Http.java:82)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.connection.MjpegHttp.connect(MjpegHttp.java:33)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.connection.Http.go(Http.java:46)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.connection.CameraHttp.go(CameraHttp.java:13)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.camera.Camera.go(Camera.java:121)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.camera.Camera.parse(Camera.java:170)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.connection.MjpegHttp.onReturn(MjpegHttp.java:23)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.connection.Http.connect(Http.java:82)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.connection.MjpegHttp.connect(MjpegHttp.java:33)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.connection.Http.go(Http.java:46)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.connection.CameraHttp.go(CameraHttp.java:13)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.camera.Camera.go(Camera.java:121)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.camera.Camera.parse(Camera.java:170)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.connection.MjpegHttp.onReturn(MjpegHttp.java:23)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.connection.Http.connect(Http.java:82)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.connection.MjpegHttp.connect(MjpegHttp.java:33)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.connection.Http.go(Http.java:46)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.connection.CameraHttp.go(CameraHttp.java:13)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.camera.Camera.go(Camera.java:121)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.camera.Camera.parse(Camera.java:170)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.connection.MjpegHttp.onReturn(MjpegHttp.java:23)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.connection.Http.connect(Http.java:82)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.connection.MjpegHttp.connect(MjpegHttp.java:33)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.connection.Http.go(Http.java:46)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.connection.CameraHttp.go(CameraHttp.java:13)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepvizyon.camera.Camera.go(Camera.java:121)
    10-28 14:06:19.994: ERROR/AndroidRuntime(3420):     at spexco.cepviz
解决方案
public void parse(InputStream is){
    if(!mjpeghttp.isCanceled())
      go();

What exactly does go() do? It calls connect(), what calls

if (!cancel) {
  onReturn(res.getStatusLine().getStatusCode(), is);
 }

And onReturn() calls parse() again. parse() calls go() calls connect() calls onReturn() calls parse() calls... It never(?) ends. Why does parsing have to connect? Every function call needs a bit of memory. After a lot of call, there is no more memory left and you get a Stack overflow exception.

You need to break the circle some where. You could remove this:

if(!mjpeghttp.isCanceled())
  go();


I don't think it even sleeps once

try {

  cancel = true;
  System.out.println("Sleep sleep!");
  Thread.sleep(60);

 } catch (Exception ie) {

Does it print at all?


How about?

imageSet=false;
while(!imageSet)
{
   if (connect())
     if(parse())
       imageSet=true;
}

这篇关于我解决不了这个问题......(一阵我的应用程序此错误后...)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-14 06:55