jeffxuyf / flot-android-chart

Automatically exported from code.google.com/p/flot-android-chart
0 stars 0 forks source link

FlotChartContainer in paused activity causes crash #14

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Put a FlotChartContainer in an activity inside TabHost.
2. Show the tab.
3. Start another activity: startActivity(intent);
4. Press BACK.

What is the expected output? What do you see instead?
Should see FlotChartContainer. Instead, it crashes at:
FlotChartContainer(SurfaceView).updateWindow(boolean, boolean) line: 564    
FlotChartContainer(SurfaceView).onWindowVisibilityChanged(int) line: 213    
FlotChartContainer(View).dispatchWindowVisibilityChanged(int) line: 4027    

What version of the product are you using? On what operating system?
1.0

Please provide any additional information below.
Switching between activities inside a TabHost does not destroy them. Instead it 
pauses/resumes them. FlotChartContainer does not handle "pause" and "resume" 
events properly!

Original issue reported on code.google.com by hacker.d...@gmail.com on 15 May 2011 at 10:36

GoogleCodeExporter commented 8 years ago
Crash occurs when drawThread.start() is called:

public void surfaceCreated(SurfaceHolder holder) {
    // TODO Auto-generated method stub
    drawThread.setRunning(true);
    drawThread.start(); // <------ boom!
}

Original comment by hacker.d...@gmail.com on 15 May 2011 at 11:23

GoogleCodeExporter commented 8 years ago
Here's a hint: surfaceDestroyed is NOT called when Activity is inside TabHost!

Original comment by hacker.d...@gmail.com on 15 May 2011 at 11:40

GoogleCodeExporter commented 8 years ago
Please see Victor's answer here:

http://stackoverflow.com/questions/5318847/android-crash-when-app-is-closed-and-
reopened/5319629#5319629

Original comment by hacker.d...@gmail.com on 16 May 2011 at 12:00

GoogleCodeExporter commented 8 years ago

Original comment by jxmei2...@gmail.com on 19 May 2011 at 10:47

GoogleCodeExporter commented 8 years ago
Fix TabHost crash issue as Hacker Suggest.

/trunk/flot-android-project/AndroidManifest.xml
/trunk/flot-android-project/src/com/flotandroidchart/Demo.java
/trunk/flot-android-project/src/com/flotandroidchart/DemoTabHost.java
/trunk/flot-android-project/src/com/flotandroidchart/flot/FlotChartContainer.jav
a

Original comment by jxmei2...@gmail.com on 19 May 2011 at 3:50