At last, a good samaritan (fadden, whoever you are, big thanks !! ) helps me find the solution for my traceview problem.
And actually, I can't imagine how he find it !
The data created by the Debug.startMethodTracing / Debug.stopMethodTracing pair only works when the debugger is NOT attached !
You can still launch it from Eclipse, but when the data file is created eclipse can't be used as a debugger ( though it still can be used as a way to get the log !).
I launched Eclipse, then my application ( so it started the emulator - with a -sdcard optional parameter ).
Then terminate my application with Eclipse.
At this point, I could use the android interface to launch my application, go to the part I wanted to profile, and generate a valid .trace file !!
I could get it from my emulated SD Card with the Eclipse DDMS perspective, and launch traceview with this file, and at last have a correct result (and quite interesting... More on that latter )
Thanks again fadden !
On a side note, one could be a little worried by a debugger that produce a different behaviour - in this case a different file - than the without debugger case.
For now, I will just close my eyes, and hope it is just in this case ( famous last words again ? )
A blog from an Android developer.
Developing since the start of the platform, and constantly improving my applications, I share my experience developping with Google OS for smartphones.
Monday, December 22, 2008
Monday, December 15, 2008
TraceView : the Android profiler ?
Yesterday, I tried to use the Android profiler, traveView.
I carefully added a Debug.startMethodTracing("MyGame") and a Debug.stopMethodTracing() at the start and at the end of my activity, check that I had a file with a non zero length ( I hadn't that at the start ).
So I happily launch
traceview.bat c:\work\temp\MyGame.trace
How deceive I was to have such a result, instead of a nice graphic application !
Exception in thread "main" java.lang.RuntimeException: Method exit (java/lang/Object. ()V) does not match current method (java/lang/reflect/Constructor.constructNative ([Ljava/lang/Object;Ljava/lang/Class;[Ljava/lang/Class;IZ)Ljava/lang/Object;)
at com.google.traceview.ThreadData.exit(ThreadData.java:116)
at com.google.traceview.ThreadData.handleCall(ThreadData.java:78)
at com.google.traceview.DmTraceReader.parseDataPass2(DmTraceReader.java:285)
at com.google.traceview.DmTraceReader.parseData(DmTraceReader.java:176)
at com.google.traceview.DmTraceReader.generateTrees(DmTraceReader.java:78)
at com.google.traceview.DmTraceReader.(DmTraceReader.java:71)
at com.google.traceview.MainWindow.main(MainWindow.java:187)
I though it might be because of the path, so I put my trace file in my tool directory... Same results...
In the documentation, they don't use the .trace extension... With no hope I tried it... But it didn't change anything...
So for the moment, I have no solution.
On the forums, someone suggested that the profiler was simply not working on XP...
Well, I don't know.
if someone has a suggestion, I'd happily heard it !
I carefully added a Debug.startMethodTracing("MyGame") and a Debug.stopMethodTracing() at the start and at the end of my activity, check that I had a file with a non zero length ( I hadn't that at the start ).
So I happily launch
traceview.bat c:\work\temp\MyGame.trace
How deceive I was to have such a result, instead of a nice graphic application !
Exception in thread "main" java.lang.RuntimeException: Method exit (java/lang/Object.
at com.google.traceview.ThreadData.exit(ThreadData.java:116)
at com.google.traceview.ThreadData.handleCall(ThreadData.java:78)
at com.google.traceview.DmTraceReader.parseDataPass2(DmTraceReader.java:285)
at com.google.traceview.DmTraceReader.parseData(DmTraceReader.java:176)
at com.google.traceview.DmTraceReader.generateTrees(DmTraceReader.java:78)
at com.google.traceview.DmTraceReader.
at com.google.traceview.MainWindow.main(MainWindow.java:187)
I though it might be because of the path, so I put my trace file in my tool directory... Same results...
In the documentation, they don't use the .trace extension... With no hope I tried it... But it didn't change anything...
So for the moment, I have no solution.
On the forums, someone suggested that the profiler was simply not working on XP...
Well, I don't know.
if someone has a suggestion, I'd happily heard it !
Tuesday, December 9, 2008
How to deal with different Android Phone resolutions ?
Hi all,
Now that Kogan will soon (?) release a new Phone ( Agora ), we should not limit our application to the T1 presets.
In peculiar, it looks like this phone will have a different resolution. It will be a QVGA one ( 320 x 240 pixels ) ( the T1 is 480x800).
The simplest way to deal with different resolution seems to handle different xml files for each resolution !
So we can have a res/layout-320x240 file and a res/layout-640x680 one, etc...
It let you have an acute control on your design, while still maintaining a common code.
Last note : it is not limited to layout, you can specify all of your resources, like drawable !
Friday, December 5, 2008
Issues with ListViews, at last solved !!
Hi all,
android:textColorPrimary="#FF112233"
android:textColorPrimaryDisableOnly="#FF112233"
android:textColorPrimaryInverse="#FF112233"
android:textColorPrimaryInverseNoDisable="#FF112233"
android:textColorPrimaryNoDisable="#FF112233"
android:textColorSecondary="#FF112233"
android:textColorSecondaryInverse="#FF112233"
android:textColorSecondaryInverseNoDisable="#FF112233"
android:textColorSecondaryNoDisable="#FF112233"
android:textColorTertiary="#FF112233"
android:textColorTertiaryInverse="#FF112233"
android:listSelector="@android:color/transparent"
android:drawSelectorOnTop="false"
android:cacheColorHint="#00000000"
At least after trying all the android parameters, I found the correct one to fix my issue !
It was the cacheColorHint, that was to be set to #00000000 !
I tried this :
android:textColorPrimary="#FF112233"
android:textColorPrimaryDisableOnly="#FF112233"
android:textColorPrimaryInverse="#FF112233"
android:textColorPrimaryInverseNoDisable="#FF112233"
android:textColorPrimaryNoDisable="#FF112233"
android:textColorSecondary="#FF112233"
android:textColorSecondaryInverse="#FF112233"
android:textColorSecondaryInverseNoDisable="#FF112233"
android:textColorSecondaryNoDisable="#FF112233"
android:textColorTertiary="#FF112233"
android:textColorTertiaryInverse="#FF112233"
android:listSelector="@android:color/transparent"
android:drawSelectorOnTop="false"
that failed miserably, and this single line just saved my day :
android:cacheColorHint="#00000000"
Ok, good to know...
I just feel like the documentation was a little light on this subject.
There are so many parameters, and this one does not look like the more intuitive to change for my problem.
Ok, that's done, that will be enough for today !
Wednesday, December 3, 2008
problem with a ListView
So, as a very experimented programmer as I am, I'm gonna use a very advanced technique : ask for any solution for this problem publicaly !
Usually, some seconds after warning the whole planet, the programmer finds the solution on his own !
Here's my problem :
I have a ListActivity, with my list of High Scores :
But the problem arises when I click on the listView to make it scroll :
It is less sexy this way ( and also quite less readable ).
I tried to juggle with some parameters, like enable / clickable / focusable / focusableInTouchMode (that I just understood from the http://android-developers.blogspot.com/ site). I also tried the listSelector or the background parameters ; but with no success...
I'm sure there is something I miss there, but what...
( Note : I have now found the solution here )
Subscribe to:
Posts (Atom)

