English 中文(简体)
我无法解决这一问题。 在我看来错误之后......
原标题:I can t solve this problem...( After a while my app error this...)

我把一个ı(jpeg)连接起来,显示这一形象,并在我 app误后不断重复。 我测试了其他电话,并展示了这一电话。

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

我的法典:

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) {
  }
 }

我的联系是:

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"));
}
}

背 景

 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();

<>代码>go()做了什么? 电话:link()。

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

。 它永远不会结束。 为什么要连接起来? 每个职能电话都需要记忆。 在发出许多呼吁后,不再留下记忆,你会遇到一个“斯纳克”超支的例外情况。

你们需要打破圈子。 您可以删除:

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

我不认为甚至一度睡觉。

try {

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

 } catch (Exception ie) {

它是否完全印刷?


如何?

imageSet=false;
while(!imageSet)
{
   if (connect())
     if(parse())
       imageSet=true;
}
问题回答

它看一看,你一直把电话nes开,直到四舍五入(这个网站的每一个适当问题)。

我猜测,你想要实际上掌握连接方法,而不是要求采用回归方法,就能够回升。 这将阻止你重新开诚布公,消除这一特殊问题。

I solve like this.. Thank you again...:) Absolutely I remove
if(!mjpeghttp.isCanceled()) go();

// start connection to ip-camera
public void go() {

    if (mjpeghttp == null) {
        mjpeghttp = new MjpegHttp();
        mjpeghttp.start();

    }
    if (type.isMjpegStream()) {
        mjpeghttp.go(this);
    } else {
        while (mjpeghttp.isCanceled()==false)
            mjpeghttp.go(this);
    }

}




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签