Re: [android-developers] java.lang.StringIndexOutOfBoundsException while playing video in videoView : Android v 4.2.1

2013-09-18 Thread Cg
Make runtime strings and do not use array

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [android-developers] Android screen capture delay due to writing data in the file..

2013-09-18 Thread Cg
Use toast.

ashish  wrote:

>Hi,
>
>
>I have a rooted device and i successfully capture the screenshot of current 
>screen.and use the below code.
>
>Process process = Runtime.getRuntime().exec("su"); DataOutputStream os = new 
>DataOutputStream(process.getOutputStream()); 
>os.writeBytes("/system/bin/screencap -p " + path + "; \n");
>but in the command i provide the path where i want to save the file and system 
>take time to write the image in the file. so I want to know can we directly 
>take the image data from process in the form of bytes because I want to send 
>the current image to the server immediately.
>
>-- 
>You received this message because you are subscribed to the Google
>Groups "Android Developers" group.
>To post to this group, send email to android-developers@googlegroups.com
>To unsubscribe from this group, send email to
>android-developers+unsubscr...@googlegroups.com
>For more options, visit this group at
>http://groups.google.com/group/android-developers?hl=en
>--- 
>You received this message because you are subscribed to the Google Groups 
>"Android Developers" group.
>To unsubscribe from this group and stop receiving emails from it, send an 
>email to android-developers+unsubscr...@googlegroups.com.
>For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[android-developers] Crash Launcher2 NullPointerException in onDetachedFromWindow()

2011-09-15 Thread cg-dev
Crash Launcher2 NullPointerException in onDetachedFromWindow()

Hi,

I'm developping an application on Nexus S that testing some Android API.
To do so, I need to pause/resume my application :

// Cause activity to be brought to front
void resumeActivity()
{
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setClassName(MyActivity.class.getPackage().getName(), 
MyActivity.class.getName());
intent.addFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
m_activity.startActivity(intent);
}

// Cause home screen to come foreground.
void hideActivity()
{
Intent i = new Intent();
i.setAction(Intent.ACTION_MAIN);
i.addCategory(Intent.CATEGORY_HOME);
m_activity.startActivity(i);
m_activity).waitOnPause(); // This function use a wait() and onResume call 
notify().
}

It's working with Android 2.3.3 (custom build)

And I get the crash on Android 2.3.3 official build (I9020XXXJK1, 
2.6.35.7-g1d030a7 GRI40)
and on Android 2.3.5 r1 (custom build)


E/AndroidRuntime( 5709): java.lang.NullPointerException
E/AndroidRuntime( 5709): at 
com.android.launcher2.AllApps3D.onDetachedFromWindow(AllApps3D.java:210)
E/AndroidRuntime( 5709): at 
android.view.View.dispatchDetachedFromWindow(View.java:6173)
E/AndroidRuntime( 5709): at 
android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:1162)
E/AndroidRuntime( 5709): at 
android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:1162)
E/AndroidRuntime( 5709): at 
android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:1162)
E/AndroidRuntime( 5709): at 
android.view.ViewRoot.dispatchDetachedFromWindow(ViewRoot.java:1746)
E/AndroidRuntime( 5709): at android.view.ViewRoot.doDie(ViewRoot.java:2757)
E/AndroidRuntime( 5709): at android.view.ViewRoot.die(ViewRoot.java:2727)
E/AndroidRuntime( 5709): at 
android.view.WindowManagerImpl.removeViewImmediate(WindowManagerImpl.java:218)
E/AndroidRuntime( 5709): at 
android.view.Window$LocalWindowManager.removeViewImmediate(Window.java:436)
E/AndroidRuntime( 5709): at 
android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:2701)
E/AndroidRuntime( 5709): at 
android.app.ActivityThread.access$2100(ActivityThread.java:117)
E/AndroidRuntime( 5709): at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:964)
E/AndroidRuntime( 5709): at 
android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 5709): at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime( 5709): at 
android.app.ActivityThread.main(ActivityThread.java:3683)
E/AndroidRuntime( 5709): at java.lang.reflect.Method.invokeNative(Native 
Method)
E/AndroidRuntime( 5709): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 5709): at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/AndroidRuntime( 5709): at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/AndroidRuntime( 5709): at dalvik.system.NativeStart.main(Native Method)

Hope it's help :)

Do I need to open a bug at http://code.google.com/p/android/issues/list ?

Regards.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: External Jar and Resources

2011-05-25 Thread cg-dev
Hi,

you can embed resources in JAR, we do it for a project. We embed PNG
that are loaded by another JAR.
But you cannot load layout using XML file whatever the XML location.

Regards

On May 13, 6:23 pm, iliab  wrote:
> I encountered similar problems in my work. I think it is a pretty
> serious flaw in android development. I think the compiler shall be
> able to incorporate resources within JAR files into APK.
>
> On May 13, 11:22 am,cg-dev wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > If I understand well your issue :
>
> > > What if I want to add some resources to the jar (e.g. a layout for
> > > custom notification), is it possible ?
>
> > No as layout are XML files that are compress when building APK.
> > And there is no API to load an raw XML layout. (except if it changes
> > recently)
>
> > If you share a JAR, you need to share XML layout outside the JAR.
> > Then the developper will integrate the layout into his project.
>
> > Regards.
>
> > On 12 mai, 11:08, Mark Cz  wrote:
>
> > > Hi,
>
> > > I have an external jar that external developers can use. The jar has
> > > mainly one public static function that runs an android service
> > > ( I asked the developers to add the service tag in the manifest), so
> > > far so good.
>
> > > Now I am facing a problem that hope you guys can help me to deal with.
>
> > > What if I want to add some resources to the jar (e.g. a layout for
> > > custom notification), is it possible ?
>
> > > I know the following options are valid, but none of them satisfy me
>
> > > 1. I can create an eclipse LIB project with code + resources, but
> > > obviously i don't want to give the developers the entire code.
> > > 2. I can create an apk but this requires the end user to install both
> > > APK (mine and the one of the external developer).
>
> > > Thanks,
> > > Mark

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Using transparent png textures won't work

2011-05-25 Thread cg-dev
Hi,

> export it as 32bpp (tried 3 differenty image editing tools).

It's strange you cannot get 32 bpp png. I use gimp every day and my
PNG with transparency
work very well.

> (Take care : android downsampling PNG without transparency to 565)
Sorry this issue seems occurs only on 2.1

> Here a Screenshot of the PNG
Can you post it on Picassa or something else ? Seems attachement was
dropped.

> If not now then i will need it later
> in progress, so if you suggest me to try blending the texture without
> taking care about the texture's alpha channel this is not an option.

No I don't mean that ^^.
I use also alpha channel of PNG in my textures and it's working great.

So check the way you load PNG with BitmapFactory and
BitmapFactory.Option
Check the format of the returned Bitmap object. (it should be
ARGB_)

Regards.

On May 13, 7:57 pm, Forsaken  wrote:
> > There is no transparency in JPEG. You mean 2 jpeg and 1 png.
>
> Of course i know there is no transparency in JPEG, I just wrote that
> to state clearly that the jpg textures (those are 3) do not vanish
> like the png. Afaik the PNG texture should be white if it fails to
> load for some reason not ivisible, thats why I would have expected a
> blank (white) texture or the png without transparency but not a
> completely invisible one.
> Currently I've got an "room" (inverted cube) with 3 jpeg textures
> (ceiling, walls, floor - all jpg) and one gui element (virtual joypad
> - png).
>
> > And for the png one, you didn't get transparency. Right ?
>
> It becomes completely invisible when applying change (1) mentioned in
> my first post. When removing these 2 lines again it just renders
> without transparency (of course). It seems like the texture gets
> loaded with full transparency on all pixels.
> But I just scouted that the png wasn't saved as 32bpp like i thought,
> its 24bpp what should be my problem. But I can't find any way to
> export it as 32bpp (tried 3 differenty image editing tools).
>
> > (Take care : android downsampling PNG without transparency to 565)
>
> I don't think so, at least if you are talking about the loading from
> ressource. Like described in the discussion linked above this seems to
> work well. Of course I don't know this for sure.
>
> > You can try other combination of parameters for this gl.glBlendFunc() to 
> > see if you get different results.
>
> This isn't what I was looking for, I will definitly need "real"
> transparency via alpha channel. If not now then i will need it later
> in progress, so if you suggest me to try blending the texture without
> taking care about the texture's alpha channel this is not an option.
> Here a Screenshot of the PNG open in gimp and my app within the
> emulator blending with "gl.glBlendFunc(GL10.GL_ONE,
> GL10.GL_SRC_ALPHA);". Thats the best result I could get working by
> changing the blend func. But like I said this is not what I am looking
> for :/
>
> Thanks for your help, I hope now that I have found out what's the
> difference between the discussion posted above and my case. So I have
> to find either a solution for saving 32bpp png's or for loading 24bpp
> one's. If you (or someone else) knows a good solution already I would
> be glad of course if you tell me :)
> If I find a solution myself I will add it here.
>
> Regards
> - Jens

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Re: Android renders RGB values wrong.

2011-05-13 Thread cg-dev
I know, but in Eclair it's not working.  If you put Bitmap option to RGBA. 
You get a RGBA image but the image is altered.

Maybe I'm wrong, but I remember I face this issue on my Eclair phone and 
take this workaround using libpng.

In eclair release, if the bitmap has no alpha it was converted to 565. 

SkImageDecoder_libpng.cpp ~ l.277 

I face this issue severals month ago and I remember I have trace down to 
Skia and found the issue but I don't keep my notes on this subject.

Anyway seems fixed in Gingerbread.

Regards.





-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Re: Using transparent png textures won't work

2011-05-13 Thread cg-dev
Hi,

>  Also the 3 textures loaded from jpg

There is no transparency in JPEG. You mean 2 jpeg and 1 png.
And for the png one, you didn't get transparency. Right ?
(Take care : android downsampling PNG without transparency to 565)

You can try other combination of parameters for this gl.glBlendFunc()
to see
if you get different results.

Regards.


On 10 mai, 19:56, Forsaken  wrote:
> Hi there,
>
> I've got some trouble getting transparent png-textures work. In my
> project i am currently using 3 regular jpg textures (256x256) and one
> transparent png (128x128x32bpp). Without any further options
> everything renders just fine except the transparency is missing.
> After i found the following post I added some options to my project to
> enable transparency.
>
> http://groups.google.com/group/android-developers/browse_thread/threa...
>
> These are the changes:
>
> (1) Added the following lines after the "super" call in my class
> extending GLSurfaceView:
>
>         setEGLConfigChooser(8, 8, 8, 8, 0, 0);
>         getHolder().setFormat(PixelFormat.RGBA_);
>
> (2) Added these lines when onSurfaceCreated is triggered (after my
> other options):
>
>         gl.glEnable(GL10.GL_BLEND);
>         gl.glBlendFunc(GL10.GL_ONE, GL10.GL_ONE_MINUS_SRC_ALPHA);
>
> As long as change (1) is active the png texture isn't drawn at all,
> the surface is just invisible. After removing it everything works like
> before (without transparency). Change (2) doesn't seem to have any
> effect at all. Also the 3 textures loaded from jpg are absolutely
> unaffected by those changes.
> I would be glad for some advice.
>
> Best regards
> Jens
>
> Here are the most important classes and methods that may be related to
> my problem:http://pastebin.com/UL6NCZ7b
> If something important is missing please tell me, I may also send the
> whole project for debugging on request.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Adding an button to a custom view

2011-05-13 Thread cg-dev
Hi,

your custom view should derives from a Viewgroup. (Viewgroup inherit
from View)
Then simply create the View you want to add and call
Viewgroup.addView().

Regards.

On 12 mai, 18:32, Kapil  wrote:
> Dear Developers,
>
> My name is Kapil and I am trying to write a custom view which inherits
> View class and everything is drawn in the onDraw function. There is no
> xml for the view. The custom view class is instantiated and set in the
> function setContentView of an activity.
>
> I wish to add the some buttons to the custom view class
> programatically; I have searched over forums and internet; but could
> not find proper solution.
>
> Is it possible to do? Can we add a button [or any other view item]
> dynamically to a custom view without using XML?
>
> Also Is mixing of custom drawing and XML based view content possible
> and if yes how to achieve it?
>
> Please advise.
>
> regards
> Kapil

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: NFC send Photo

2011-05-13 Thread cg-dev
Hi,

As far as I know, I don't think you can put an image into a tag in a
standard way.
Check with Smart Poster Ndef tag type, maybe you can with this type.

If only your application need to read and write the image, you can
simply use Ndef type "Text" and put your image in a raw buffer.

Regards.


On 12 mai, 13:46, "arik...@hotmail.com"  wrote:
> Hi I asked for the code to send a photo with NFC without using a web
> page, if the records are 7ks we will have to divide it? or use many,
> or how can I do it?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: External Jar and Resources

2011-05-13 Thread cg-dev
Hi,

If I understand well your issue :

> What if I want to add some resources to the jar (e.g. a layout for
> custom notification), is it possible ?

No as layout are XML files that are compress when building APK.
And there is no API to load an raw XML layout. (except if it changes
recently)

If you share a JAR, you need to share XML layout outside the JAR.
Then the developper will integrate the layout into his project.

Regards.

On 12 mai, 11:08, Mark Cz  wrote:
> Hi,
>
> I have an external jar that external developers can use. The jar has
> mainly one public static function that runs an android service
> ( I asked the developers to add the service tag in the manifest), so
> far so good.
>
> Now I am facing a problem that hope you guys can help me to deal with.
>
> What if I want to add some resources to the jar (e.g. a layout for
> custom notification), is it possible ?
>
> I know the following options are valid, but none of them satisfy me
>
> 1. I can create an eclipse LIB project with code + resources, but
> obviously i don't want to give the developers the entire code.
> 2. I can create an apk but this requires the end user to install both
> APK (mine and the one of the external developer).
>
> Thanks,
> Mark

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Android renders RGB values wrong.

2011-05-13 Thread cg-dev
Hi,

I face the same issue with OpenGL texture. I use gradient texture and
this one was "damaged" due to
convertion from 24bit => 565.

To solve this issue I embeded libpng in my application using NDK.

You said that "the screen is 565 so we loose precision" : Yes but in
OpenGL,
glEnable(GL_DITHER) will dither the colors. So(in that case) why doing
OpenGL job ?
Colors convertion should be done by the final renderer : "it" is the
only one to know the final screen
config.

I think this image convertion at loading should be optional. Because
it depends in which context
you use it.

Finally, with the dither I don't have "color steps" due to
downsampling.

Best Regards

On 3 mai, 00:27, Dianne Hackborn  wrote:
> If the issue is losing precision due to a 16bpp screen with 565 colors,
> changing it to 256 colors won't necessarily help since each of those colors
> are still full 888.
>
> On Mon, May 2, 2011 at 2:52 PM, Andrew Huang  wrote:
> > Another way is to make your images have 256 color at most. You can do
> > this in Gimp by changing the mode to indexed in the image menu, and
> > setting the maximum color.
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Nightmare loading mask bitmap

2011-05-13 Thread cg-dev
Hi,

I face the same issue with opengl. My texture gradient were dirty due
to convertion.
So I embed libpng in my application using NDK.

Regards.

On 13 mai, 13:04, Ralf Schneider  wrote:
> Your image is probably convert to 565 and the back to 24bits.
> This thread discusses a related problem:
>
> http://groups.google.com/group/android-developers/browse_thread/threa...
>
> 2011/5/13 delta42 
>
>
>
>
>
>
>
> > I need to load in a 24-bit PNG mask image into my Android, and it
> > being a mask, I need it to come in exactly as it is on disk, with no
> > resizing or pixel values changed.
>
> > When I load it from resources using the BitmapFactory, its pixel
> > values are slightly changed, as if it had been resized *twice*: its
> > dimensions are the same as original, but values that were pure grey,
> > like (100,100,100) are now slightly off, as in (100,99,100), for
> > example, or (50,50,50) becomes (49,52,49), to take another example.
>
> > To ensure no resizing takes place I followed these steps:
>
> > #1. I have
> > 
> > on my manifest.
>
> > I even added
> > 
> > although in theory this is not needed since minSdkVersion is high.
>
> > #2. My source image is in the res/drawable-nodpi folder
>
> > #3. I load the image with inScaled false, as in
>
> >                BitmapFactory.Options options = new BitmapFactory.Options();
> >                options.inScaled = false;
> >                _bmMask = BitmapFactory.decodeResource(getResources(),
> > R.drawable.mask, options);
>
> > It is my understanding that either #2 or #3 alone should ensure no
> > resizing takes place.
>
> > Or course, one could claim no resizing takes place, since my image
> > that is 360x300 comes in at that exact dimension. However, how do I
> > explain that my image seems to have been somehow compressed/
> > decompressed?
>
> > I've already spent 3 hours scouring the internet for a solution to no
> > avail.
> > I have the latest Android SDK and Eclipse plug-in.
>
> > Regards,
> > /d42
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Intent to launch Google Latitude

2011-05-10 Thread cg-dev
Hi all,

I'm trying to launch Google Latitude using Intent.

I'm using an URI found on the net :

latitude://latitude/friends/location/exam...@gmail.com

And this code :

Intent intent = new Intent(android.content.Intent.ACTION_VIEW, uri);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
intent.addFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
startActivity(intent);

It's seems ok.

1°) But I would like to know if there is an official documentation
about this URI syntax.
I'll check in GoogleAPI doc, but did not find anything specific to
Android.

2°) Do you know a way to launch a "check in" in latitude application ?

Thank you.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Problem Sony Xperia Neo Camera zoom-support = false

2011-05-02 Thread CG
Hi Johan,
  Thank you very much for your reply :)

Rgds,
  CG


On Apr 28, 5:38 pm, Johan Abramsson 
wrote:
> Hi,
> Your phone does give you a correct answer. Zoom in the Camera API  is
> not supported right now.
> It will be supoprted in the 4.0.x.y.z Version of the phone software
> which will be released by SonyEricsson during late Q2 according to the
> present plans.
>
> Kind regards
>   /JohanSonyEricsson Developer Support
>
> On Apr 27, 6:38 am, CG  wrote:
>
> > Hi all,
> >    I have a problem and hope that somebody who encountered this before
> > can give me some hints..
>
> > I am developing a app which use the camera onSonyXperia Neo 
> > (http://www.sonyericsson.com/cws/products/mobilephones/overview/xperia..)
> > which support Camera Zooming.
>
> > When I tried to check the Zoom Support using
> > parameter.isZoomSupported() , it returns "false" which I think is
> > wrong.
>
> > I then try to check the HashMap in the Camera.parameter looking for
> > the value of zoom-supported , and the value is also "false".
> > Besides, zoom=0, max-zoom
>
> > Therefore, my app cannot control the zooming of the Camera preview
> > because of this.
>
> > I wonder why it happens ? is it because theSony'sSDK does not return
> > the correct value ?
>
> > The same code running on HTC wildfire & Nexus One do not have problem.
>
> > Thanks in advanced for any help ..
>
> > Development OS : Ubuntu 10.04
>
> > Development SDK : 2.2
>
> >SonyXperia Android : 2.3

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Problem Sony Xperia Neo Camera zoom-support = false

2011-04-26 Thread CG
Hi all,
   I have a problem and hope that somebody who encountered this before
can give me some hints..

I am developing a app which use the camera on Sony Xperia Neo (http://
www.sonyericsson.com/cws/products/mobilephones/overview/xperia-neo?cc=gb&lc=en#view=features_specifications)
which support Camera Zooming.

When I tried to check the Zoom Support using
parameter.isZoomSupported() , it returns "false" which I think is
wrong.

I then try to check the HashMap in the Camera.parameter looking for
the value of zoom-supported , and the value is also "false".
Besides, zoom=0, max-zoom

Therefore, my app cannot control the zooming of the Camera preview
because of this.

I wonder why it happens ? is it because the Sony's SDK does not return
the correct value ?

The same code running on HTC wildfire & Nexus One do not have problem.

Thanks in advanced for any help ..


Development OS : Ubuntu 10.04

Development SDK : 2.2

Sony Xperia Android : 2.3

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Thread + ImageView

2011-03-11 Thread Marc CG
Hi everybody!

First, sorry if my English is bad, usually i don't use it...

I am making a program witch have 2 java class. The first class is the
main activity and the second is a thread.

In the main activity i have some ImageViews, Textviews, CheckBox and
RadioButtons. My Problem is that when i want to modify the ImageView
from main activity to a new Image (that i have into resources) my
debugger says: "Source not found". But if i do this out of the thread
it works.

I can't see the problem!

Thanks for all!

Marc

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Issue with Test class SingleLaunchActivityTestCase

2011-03-04 Thread cg-dev
I notice this in SingleLaunchActivityTestCase.java:

@Override
protected void tearDown() throws Exception {
// If it is the last test case, call finish on the activity.
sTestCaseCounter --;
if (sTestCaseCounter == 1) {
sActivity.finish();
}
super.tearDown();
}
This : "if (sTestCaseCounter == 1)" should be replaced by "if
(sTestCaseCounter == 0)" ?

Regards.

On 4 mar, 11:41, cg-dev  wrote:
> Hi,
>
> We're developping a test activity using SingleLaunchActivityTestCase<>
> and JUnit on Android 2.3.3
>
> We face the following issue :
>
> In JUnit view in eclipse we have the following function call order :
>
> testActivityTestCaseSetUpProperly() <- this one is built in android.
> testA()
> testB()
> testC()
>
> Each test use sendKeys() or TouchUtils.clickView().
>
> On testC() sometimes we get this error :
> W/InputDispatcher(  112): Permission denied: injecting event from pid
> 3753 uid 10001 to window with input channel 406a0b70
> com.android.launcher/com.android.launcher2.Launcher (server) owned by
> uid 10022
>
> ??? Launcher (desktop) get Events ??? We do nothing for that
>
> So I put a Thread.sleep(5000) in testC() at the beginning.
>
> I launch the test again :
>
> testActivityTestCaseSetUpProperly() : Ok
> testA() : Ok
> testB() : Ok
> Here application is put in background (for no reason we do not call
> activity.finish() and co.)
> testC() is launched but desktop is display. The test failed as we
> cannot inject events to desktop.
>
> The workaround for this is to create a dummy test() function in
> that way, testC() is executed before activity get closed.
>
> testActivityTestCaseSetUpProperly() : Ok
> testA() : Ok
> testB() : Ok
> testC() : Ok
> test() : don't care of result.
>
> NOTE : sometimes the function order change :
>
> testA()
> testB()
> testC()
> testActivityTestCaseSetUpProperly()
>
> In that way, the issue is not visible.
>
> Hope it helps.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Issue with Test class SingleLaunchActivityTestCase

2011-03-04 Thread cg-dev
Hi,

We're developping a test activity using SingleLaunchActivityTestCase<>
and JUnit on Android 2.3.3

We face the following issue :

In JUnit view in eclipse we have the following function call order :

testActivityTestCaseSetUpProperly() <- this one is built in android.
testA()
testB()
testC()

Each test use sendKeys() or TouchUtils.clickView().

On testC() sometimes we get this error :
W/InputDispatcher(  112): Permission denied: injecting event from pid
3753 uid 10001 to window with input channel 406a0b70
com.android.launcher/com.android.launcher2.Launcher (server) owned by
uid 10022

??? Launcher (desktop) get Events ??? We do nothing for that


So I put a Thread.sleep(5000) in testC() at the beginning.

I launch the test again :

testActivityTestCaseSetUpProperly() : Ok
testA() : Ok
testB() : Ok
Here application is put in background (for no reason we do not call
activity.finish() and co.)
testC() is launched but desktop is display. The test failed as we
cannot inject events to desktop.

The workaround for this is to create a dummy test() function in
that way, testC() is executed before activity get closed.

testActivityTestCaseSetUpProperly() : Ok
testA() : Ok
testB() : Ok
testC() : Ok
test() : don't care of result.

NOTE : sometimes the function order change :

testA()
testB()
testC()
testActivityTestCaseSetUpProperly()

In that way, the issue is not visible.


Hope it helps.





-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] How do i simulate a touch on the soft keyboard?

2010-10-06 Thread CG Tan
I am trying to simulate a touch on the soft keyboard, how do i do
that?
I try injectPointerEvent but it fail.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: How to let parent handle onclick event for ListView

2010-07-27 Thread CG
Hi , thanks for your reply.

Unfortunately , I am not using ListActivity, instead , it is normal
Activity with a ListView.

By the way , I have solved the problem by adding the onClicklistener
in the getView() of the custom Adapter.


@Override
public View getView(int position, View convertView, ViewGroup
parent) {
View v = convertView;
if (v == null) {
LayoutInflater vi =
(LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.select_answer_row, null);


v.setClickable(true);
v.setOnClickListener(flipPrevious);

}

   // Do something
}

Thanks for your guide ... appreciate.


On Jul 27, 4:20 pm, Mark Murphy  wrote:
> On Tue, Jul 27, 2010 at 4:13 AM, CG  wrote:
> > Thanks for the reply , I have tried to add onClickListener to a
> > ListView but it throws exception to ask me to use onItemClickListener
> > instead .
>
> Correct.
>
>
>
> > I try with onItemClickListener but it does not seems to trigger ... ,
> > I am using a custom Adapter.
>
> >                         mListViewSelection.setOnItemClickListener(new
> > AdapterView.OnItemClickListener() {
>
> >                               �...@override
> >                                public void onItemClick(AdapterView arg0, 
> > View arg1,
> >                                                int arg2, long arg3) {
>
> >                                        // DO SOMETHING
> >                                }
>
> >                         });
>
> > In my custom adapter layout. it contains 1 imageview, 2 textview in a
> > linearlayout. Focusable & Clickable for imageview and both textview
> > have been set to "false". Is this the correct way ?
>
> You should not touch the focusable and clickable attributes of
> ImageView or TextView -- the defaults are what you want.
>
> If your activity is a ListActivity, you could override
> onListItemClick() in the activity, instead of using
> setOnItemClickListener().
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> _Android Programming Tutorials_ Version 2.9 Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: How to let parent handle onclick event for ListView

2010-07-27 Thread CG
Thanks for the reply , I have tried to add onClickListener to a
ListView but it throws exception to ask me to use onItemClickListener
instead .


I try with onItemClickListener but it does not seems to trigger ... ,
I am using a custom Adapter.

 mListViewSelection.setOnItemClickListener(new
AdapterView.OnItemClickListener() {

@Override
public void onItemClick(AdapterView arg0, 
View arg1,
int arg2, long arg3) {

// DO SOMETHING
}


 });


In my custom adapter layout. it contains 1 imageview, 2 textview in a
linearlayout. Focusable & Clickable for imageview and both textview
have been set to "false". Is this the correct way ?



On Jul 27, 3:58 pm, Mark Murphy  wrote:
> Clicking on a list item should be handled by the ListView and should
> take action based upon what item the user clicked. I fear that your
> proposed UI design will be very confusing to users.
>
>
>
> On Tue, Jul 27, 2010 at 3:28 AM, CG  wrote:
> > This should be a simple question because I couldn't get the answer
> > from Google .
>
> > I have  ListView in a LinearLayout .
>
> > I need to handle the click event to allow user click on the
> > LinearLayout to trigger some function.
>
> > I try to add onClickListener to the LinearLayout , and it works only
> > when I click outside of the ListView .
>
> > How do I let the click event on ListView propagate automatically to be
> > handled by the Listener of the LinearLayout ?
>
> > Android 1.6 SDK
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> _Android Programming Tutorials_ Version 2.9 Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] How to let parent handle onclick event for ListView

2010-07-27 Thread CG
This should be a simple question because I couldn't get the answer
from Google .


I have  ListView in a LinearLayout .

I need to handle the click event to allow user click on the
LinearLayout to trigger some function.

I try to add onClickListener to the LinearLayout , and it works only
when I click outside of the ListView .

How do I let the click event on ListView propagate automatically to be
handled by the Listener of the LinearLayout ?


Android 1.6 SDK

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: OpenglES issue with Acer liquid.

2010-07-16 Thread cg-dev
Hi,

I answer to myself :

I update Acer liquid to official OTA update 2.1 the issue seems fixed.
Drivers issue maybe ...

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] OpenglES issue with Acer liquid.

2010-06-29 Thread cg-dev
Hello,

I'm developping a native application for android and I face to
artefacts when rendering the scene.
I can reproduce the issue with Java code.

While the following code running, I got a green screen.
But If I move the status bar up and down over the screen, I see some
red artefacts.

Here a screenshot made with ddms :

http://picasaweb.google.com/lh/photo/42bVsuIt8JldSIbPy8x2AA?feat=directlink

The Acer liquid running Android 1.6.

Can you check on other devices and tell me if you face the same
issue ?

I would like to know if it's an Android issue or an Acer issue.

Here the code :

*** Activity Code ***

package com.cgdev.TestOpenGL;

import android.app.Activity;
import android.opengl.GLSurfaceView;
import android.os.Bundle;

public class TestOpenGL extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

mGLSurfaceView = new GLSurfaceView(this);
mGLSurfaceView.setRenderer(new MyRenderer());

setContentView(mGLSurfaceView);

 
mGLSurfaceView.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY);
}

@Override
protected void onResume() {
super.onResume();
mGLSurfaceView.onResume();
}

@Override
protected void onPause() {
super.onPause();
mGLSurfaceView.onPause();
}

private GLSurfaceView mGLSurfaceView;

}

*** Renderer code ***

package com.cgdev.TestOpenGL;

import java.nio.ByteBuffer;

import javax.microedition.khronos.egl.EGLConfig;
import javax.microedition.khronos.opengles.GL10;

import android.opengl.GLSurfaceView;

public class MyRenderer implements GLSurfaceView.Renderer {
public MyRenderer() {

}

public void onDrawFrame(GL10 gl) {

gl.glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);



gl.glReadPixels(1,1,1,1,GL10.GL_RGBA,GL10.GL_UNSIGNED_BYTE,buffer);

gl.glClearColor(0.0f, 1.0f, 0.0f, 0.0f);
gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
}

public void onSurfaceChanged(GL10 gl, int width, int height) {
gl.glViewport(0, 0, width, height);

}

public void onSurfaceCreated(GL10 gl, EGLConfig config) {
}


private ByteBuffer buffer = ByteBuffer.allocate(10);
}



-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: EditText.onKeyUp() doesn't catch all keys

2009-10-03 Thread CG

Sorry everyone; I didn't want to create any trouble here.
Thanks anyway for the TextWatcher solution; it works fine.



On Oct 2, 10:03 pm, Dianne Hackborn  wrote:
> On Fri, Oct 2, 2009 at 8:16 AM, Hannes Steiger <
>
> hannes.stei...@googlemail.com> wrote:
> > ..seems as if some people are too arrogant to give concrete help?
> > Sorry, no offense ;)
>
> Okay, I'll be sure not to give you any help in the future so you don't feel
> like I am being arrogant with you.  No offense.
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: EditText.onKeyUp() doesn't catch all keys

2009-09-30 Thread CG

On Sep 26, 8:39 pm, Dianne Hackborn  wrote:
> IMEs perform their edits through the InputConnection interface.  Apps should
> generally watch for edits on the text view rather than catching key events.

Thanks for the quick answer. This approach looks somewhat different to
the Java Swing architecture, so could you please provide me with some
more information on this topic (..either a concrete solution or texts
on Android's watcher concept/design principle?)

Thanks again,
Christian


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] EditText.onKeyUp() doesn't catch all keys

2009-09-26 Thread CG

Dear all,

I'm writing a little dictionary application for Android 1.5, and I'd
like to catch the user's keystrokes in an EditText instance. The
following code recognizes all keys, which are typed in in the Android
emulator:

 new EditText(this) {
   @Override
   public boolean onKeyUp(final int key, final KeyEvent event) {
 Log.i("Key:", Integer.toString(key));
   }
 };

..which is fine! But I open and use the soft keyboard, most input
(except for e.g. the ENTER key) is ignored. Could anyone tell me
what's the best/easiest way to identify and process these user inputs?

Thanks for your attention,
Christian
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] EditText.onKeyUp() doesn't catch all keys

2009-09-25 Thread CG

Dear all,

I'm writing a little dictionary application for Android 1.5, and I'd
like to catch the user's keystrokes in an EditText instance. The
following code recognizes all keys, which are typed in in the Android
emulator:

  new EditText(this) {
@Override
public boolean onKeyUp(final int key, final KeyEvent event) {
  Log.i("Key:", Integer.toString(key));
}
  };

..which is fine! But I open and use the soft keyboard, most input
(except for e.g. the ENTER key) is ignored. Could anyone tell me
what's the best/easiest way to identify and process these user inputs?

Thanks for your attention,
Christian


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Countries for selling priced applications in Android Market

2009-08-29 Thread CG

This is indeed very annoying, sitting in Denmark and cannot bye or
sell aps.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Advice for speeding up my drawing

2009-08-27 Thread CG

apparantly so,

I replaced 4 more string allocations in the drawing routine, the
strings are very dynamic, so i have to update the values each time.

public final char[] legendText = new char[] {'0', '0', '0', '%'};
public int legendOffset = 2;
public int legendLength = 0;
public void UpdateLegendText(int value) // a value in pct between 0
and 100
{
legendOffset = 3;
while (value != 0 && legendOffset != 0)
{
--legendOffset;
legendText[legendOffset] = (char)('0' + value % 10);
value /= 10;
}
legendLength = legendText.length-legendOffset;
}

I went from the 170-350 to 135-280... 4 string allocations.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Advice for speeding up my drawing

2009-08-27 Thread CG

I have now changed most of the strings to startup initialized char
arrays (missing 4)
and I am completely baffled by the perfomance gain.

I went from a comlpete render loop time on ~350-500 to 170-350
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Advice for speeding up my drawing

2009-08-27 Thread CG

Hi Andrei, thanks for the answer. here are my thoughts.

1.
I did not considder the string thing, and I must admit that I am a bit
sceptical about the perfomance gain of this.
On the other hand the garbage collector is more bussy than I would
have expected, i have taken care to create all classes only once, and
the collector is still quite bussy.

2.
I have no experince with this, but I guess it would make sence to this
before 1.

3.
is is something like this i would imagine gives major perfomance
gains, I hope I will find the time before ADC2 :)


On 26 Aug., 11:44, Andrei Bucur  wrote:
> If you haven't tried already:
> 1. Replace the strings that get modified with char[]. Strings are immutable
> objects so changing one means memory allocation and leaking.
> 2. Also check the Allocation Tracker for memory leaking.
> 3. For the constant strings I would use Picture or some bitmap buffer
> mechanism to store the drawn text and then just place it on the Canvas
> without overhead.
>
> On Wed, Aug 26, 2009 at 12:24 PM, CG  wrote:
>
> > Hi, I am creating an app that show some histograms off your traveling
> > speed in different time periods (histogram for the last minutte,
> > histogram for the last 2 minuttes etc.)
>
> > I would like to have an animation, and have discovered that drawing
> > everything takes arround 300-400ms. wich is to long for making my
> > animation smooth, the animation itself is quite simple (2 lines and 2
> > dots).
>
> > What i draw every frame right now is
> > 20 antialised strings, size 14,  in average ~5chars
> > 8 of these strings will change every second.
> > 1 of the string will change with the animation (this will become 5
> > strings if there is time)
>
> > the main part of the screen, the one showing the histogram data,
> > consist of a lots of squares wich needs to be updated every second.
> > (450 squares)
>
> > the presentation is split into 5 frames in the same view (has to be
> > same view as arrows in one frame might point into another frame)
>
> > invalidating only a part off the screen makes almost no difference (it
> > does becomas a bit faster, but i still execute all my drawing stuff).
> > I have tried to add a flag wheter or not the main part is dirty, but
> > if i don't draw it, it is cleared. I might be missing something
> > here...
>
> > One possibility could be to render all the mostly static stuff to a
> > bitmap, and then simply draw the bitmap.
> > that would mean 10 strings only had to rendered on orientation change.
>
> > I think it would make sence since the slowest rutine is the one
> > drawing all the text. (the following is a typical timing for the
> > drawing rutines, accmulated).
>
> > V/HMMULTIBAR(  352): 0 - Drawing time: 0 ms
> > V/HMMULTIBAR(  352): 1 - Drawing time: 53 ms
> > V/HMMULTIBAR(  352): 2 - Drawing time: 62 ms
> > V/HMMULTIBAR(  352): 3 - Drawing time: 85 ms
> > V/HMMULTIBAR(  352): 4 - Drawing time: 280 ms
> > V/HMMULTIBAR(  352): 5 - Drawing time: 303 ms
>
> > I would really appreciate comments about wheter or not offscreen
> > rendering is the way to go, or if there is a simpler way.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Advice for speeding up my drawing

2009-08-26 Thread CG

Hi, I am creating an app that show some histograms off your traveling
speed in different time periods (histogram for the last minutte,
histogram for the last 2 minuttes etc.)

I would like to have an animation, and have discovered that drawing
everything takes arround 300-400ms. wich is to long for making my
animation smooth, the animation itself is quite simple (2 lines and 2
dots).

What i draw every frame right now is
20 antialised strings, size 14,  in average ~5chars
8 of these strings will change every second.
1 of the string will change with the animation (this will become 5
strings if there is time)

the main part of the screen, the one showing the histogram data,
consist of a lots of squares wich needs to be updated every second.
(450 squares)

the presentation is split into 5 frames in the same view (has to be
same view as arrows in one frame might point into another frame)

invalidating only a part off the screen makes almost no difference (it
does becomas a bit faster, but i still execute all my drawing stuff).
I have tried to add a flag wheter or not the main part is dirty, but
if i don't draw it, it is cleared. I might be missing something
here...

One possibility could be to render all the mostly static stuff to a
bitmap, and then simply draw the bitmap.
that would mean 10 strings only had to rendered on orientation change.

I think it would make sence since the slowest rutine is the one
drawing all the text. (the following is a typical timing for the
drawing rutines, accmulated).

V/HMMULTIBAR(  352): 0 - Drawing time: 0 ms
V/HMMULTIBAR(  352): 1 - Drawing time: 53 ms
V/HMMULTIBAR(  352): 2 - Drawing time: 62 ms
V/HMMULTIBAR(  352): 3 - Drawing time: 85 ms
V/HMMULTIBAR(  352): 4 - Drawing time: 280 ms
V/HMMULTIBAR(  352): 5 - Drawing time: 303 ms

I would really appreciate comments about wheter or not offscreen
rendering is the way to go, or if there is a simpler way.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Slow GPS updates

2009-08-13 Thread CG

You know what Paul,

I double checked my calculations, and for some embarasing reason, I am
not able to substract two number,
The HTC also have delays of 1000ms.

so you should multiply above numbers by 2, sorry for the confusion.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Slow GPS updates

2009-08-13 Thread CG

Surely seems faster then.

from 2051 samples. the mean delay is 507ms
and only 14 samples is above 600ms
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Slow GPS updates

2009-08-12 Thread CG

Even tough the updates ticks with 500ms, it still takes about 3-4
seconds for the device to discover that I stopped moving.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Slow GPS updates

2009-08-11 Thread CG

I have now measured the sample rate, and it is quite consistent with
500m/s between each sample.

I removed my filter, and the application became far more responsive,
but it still takers quite some time before I get accurate readings
after stopping.

Anyway, I am quite satisfied with the response of the application...
That should teach me to start simple :)

(phone = HTC-magic)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: calculate distance using latitude and longitude

2009-08-09 Thread CG

you can use

public static void  distanceBetween  (double startLatitude, double
startLongitude, double endLatitude, double endLongitude, float[]
results)
in the Location class
http://developer.android.com/reference/android/location/Location.html#distanceBetween(double,%20double,%20double,%20double,%20float[])

On 9 Aug., 11:52, Honest  wrote:
> Hello,
>
> I want to know that how can i calculate distance between two point
> using their latitude and longitude in android ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Slow GPS updates

2009-08-09 Thread CG

Hi, I am developing a small app that works as a speedometer with a
build in histogram.

But it is quite unresponsive, I test it by driving in my car, and when
i go from 80 to 0 it takes about 4-6 seconds before my needle is
updated.

For simple outlier removal, i use a 1x3 median filter on my estimated
speed the speed. Wich obviously will give me a delay one 1 sample.

*** Here's the real question :) **
I thought i might get updates every second, and thus a delay of 2
seconds, wich wouldn't be to bad. but is GPS really that slow? or am i
doing something completely wrong?
***

I have registrered a listener like so:
  mLocationManager.requestLocationUpdates(providers.get(0), 0, 0,
mLocListener);

in the listener i estimate the speed:
  public void onLocationChanged(Location location)
  {
if (mLastLocation != null)
{
  if (location.hasSpeed() && mLastLocation.hasSpeed())
  {
float speed = (location.getSpeed() + mLastLocation.getSpeed
()) / 2; // Get speed in m/s
mSpeedFilter.add(speed);
  } else
  {
float distance = mLastLocation.distanceTo(location);
float dt = SystemClock.uptimeMillis() - mLastTimestamp;
if (dt > 0)
{
  float speed = distance / dt * 1000; // calculate speed in m/
s
  mSpeedFilter.add(speed);
}
  }
  if (mNumSamplesToIgnoreAfterStartup == 0)
  {
mApproximatedSpeed = mSpeedFilter.getMedianValue();
  }
  else
  {
--mNumSamplesToIgnoreAfterStartup;
  }
}
mLastLocation = location;
mLastTimestamp = SystemClock.uptimeMillis();
  }

to have a steady update of my speedometer, I use a timerTask to poll
the listener for the last estimated result, and updates my speedometer
view.

The timer task is setup like:
  TimerTask task = new HMGpsPoller(mLocListener, mHistometerView);
  mPollGpsTimer = new Timer();
  mPollGpsTimer.scheduleAtFixedRate(task, new Date(), 500);

and the run method of my task:
  @Override
  public void run()
  {
boolean dataReady = mGpsListener.dataReady();
boolean signalCurrent = mGpsListener.getSignalAge() <
MaxSignalAge;

// Print status for debug purpose
Log.i(TAG, String.format("Run, dataReady (%b), signal current
(%b)", dataReady, signalCurrent ));

if ( dataReady && signalCurrent)
{
  mHMView.registerSpeed( mGpsListener.getApproximatedSpeed() );
}
  }
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Persistance of dynamic objects, your advice

2009-08-08 Thread CG

Hi Yusuf. Thanks for the answer.

and don't worry, I did read the guide. my concern was more what
required fewest cpu-cycles :)

I have done the following:

public void saveSampleSequense(FileOutputStream out) throws
IOException
{
  DataOutputStream p = new DataOutputStream(out);
  p.writeInt(mMaxAge);
  int nSamples = getNumSamples();
  for (int i=0;ihttp://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Persistance of dynamic objects, your advice

2009-08-07 Thread CG

Hi I am new to this android stuff and SQLlite etc.

I am going to log some numbers at a certain interval, and will put
them into a dynamic histogram, by dynamic i mean that there will be a
maximum number of samples in the histogram, the histogram and age
stuff should be persisted either in db or plain file.

I am thinking something like this:

DynamicHistogram
  nBins
  bin
  samples
  minValue
  maxValue
  maxAge
  nSamples
  samples

  add(x)
   if (nSamples == maxAge )
  remove old sample from bin and samples
  --nSamples
   add x to bin
   ++nSamples

my concern is, what would be the optimal way to persist this?,

I am considering a single table layet such as
[name, samples]

For simplicity, I would like the samples to be stored in a blob type
datafield, but i cannot se if this is possible.
Alternative i could have another table with the samples
Or I could simply have files with filename = name and content =
samples

my concern might be unclear by now, but put simply, what is most
effecient regarding power usage?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: ListView :: How to automatically scrool to see a element ?

2009-02-22 Thread CG

Thanks !

Actually I was calling this method but right after I called a
setAdapter ... So the selection was lost !

Thanks for your helpfull answer !




On 19 fév, 13:38, for android  wrote:
> listView.setSelection(position);
>
> On Thu, Feb 19, 2009 at 5:55 PM, CG  wrote:
>
> > Dear all,
>
> > I am facing a strange an issue that should simple to solve I suppose.
> > I wonder how can I automatically scroll to see an element in a list
> > view. Let's say I know that I want to see the element view number 6 in
> > my list view, how do I scroll my list to see this element ?
>
> > I look at the API but without any success, just a word on where to
> > look will be really appreciated.
>
> > Thanks for your help.
>
> > C.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] ListView :: How to automatically scrool to see a element ?

2009-02-19 Thread CG

Dear all,

I am facing a strange an issue that should simple to solve I suppose.
I wonder how can I automatically scroll to see an element in a list
view. Let's say I know that I want to see the element view number 6 in
my list view, how do I scroll my list to see this element ?

I look at the API but without any success, just a word on where to
look will be really appreciated.

Thanks for your help.

C.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Set an EditText view editable or not

2008-11-17 Thread CG

Hi all,

I am facing an issue ...
I explain the behaviour I like to have :

I have several edittext views. Since they are in a "overriden" class
of Edit text, they have a specific look and feel.

I would like to have for them the customized L&F when my application
starts and when people look at my screen.
As soon as the user clicks on the edittext, I'd like it to become
editable.
When the user click in another place of the screen to remove the
editable state of my view

For the current time being I am doing something not clean :
I intercept the click (dedicated onclick listener) and change the L&F
(ie : Carret displayed)
When my user click on "enter" they I validate the input and restore
the old L&F

This is not exactly what I aim to have. I tries to work with focus but
I can't have 'no focus' when my app starts... At least one edit text
have the focus... and it is not beautiful.

Do you know if a method setEditable(false) exists ? I don't understand
how to use editable factory, maybe my answer is there ?
Does anyone find a way to do this behaviour ?

Thanks for reading
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Get a simple GPS position :: What is the *best* way of doing ?

2008-10-06 Thread CG

Dear all,

I don't really have an issue but I am just wondering what is the best
way to get a simple GPS position (no update required).
I just want to have the current position when my app is launched

By reading the documentation it seems really simple and this is what I
am doing :

locMgr.getLastKnownLocation(locMgr.getBestProvider(new Criteria(),
true));

But I wonder if this is the right way of doing.
Almost sometimes I could not get any Location (null returned) I don't
know why, maybe the fix sent by telnet is limited in the time...

Thanks for your advises !

C.



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Unable to create an URI for a local sound

2008-09-22 Thread CG

Hey,

I try to play a local sound in a notification. The issue I meet is the
folowing : I am unable to load the file.

My code is :

Uri uri = Uri.parse("android.resource://com.xirgonium.android/raw/
beep");
mNotify.sound = uri;

The package name is the one described in my manifest.

I get the error :

09-23 01:55:12.692: WARN/NotificationService(47): error loading sound
for android.resource://com.xirgonium.android/raw/beep
09-23 01:55:12.692: WARN/NotificationService(47): java.io.IOException:
Prepare failed.: status=0xFFFC
09-23 01:55:12.692: WARN/NotificationService(47): at
android.media.MediaPlayer.prepare(Native Method)
09-23 01:55:12.692: WARN/NotificationService(47): at
android.media.AsyncPlayer$Thread.run(AsyncPlayer.java:76)

Now if I try (as defined here :
http://code.google.com/android/reference/android/content/ContentResolver.html#SCHEME_ANDROID_RESOURCE):
Uri uri = Uri.parse("android.resource://" + PACKAGE_NAME + "/" +
R.raw.beep);
I get the error :
09-23 02:05:05.690: WARN/NotificationService(47): error loading sound
for android.resource://com.xirgonium.android/2131034112
09-23 02:05:05.690: WARN/NotificationService(47): java.io.IOException:
Prepare failed.: status=0xFFFC
09-23 02:05:05.690: WARN/NotificationService(47): at
android.media.MediaPlayer.prepare(Native Method)
09-23 02:05:05.690: WARN/NotificationService(47): at
android.media.AsyncPlayer$Thread.run(AsyncPlayer.java:76)

I am pretty sure the package name is correct because I have the
folowing apk in my emulator :
-rw-r--r-- system   system 263463 2008-09-23 02:04
com.xirgonium.android.apk

I just try to load a .wav file.

Can anyone help me on this point (code snippet is sufficient :-)) Or
how can I be sure the file is in my apk ?

Thanks for your help !


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Create custom zoom contols in Mapview

2008-09-18 Thread CG

Hi,

I'd like to create some custom zoom control in the mapview. I don't
know where to start.

I temporally did some stuff like this :

LinearLayout zoomView = (LinearLayout)
mapViewFromXML.getZoomControls();
zoomView.setLayoutParams(new
ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.FILL_PARENT));
zoomView.setGravity(Gravity.CENTER_HORIZONTAL + Gravity.TOP);

But I'd like to create my own control with my buttons (to be coherent
with my application) or at least to remove the background ot the
standard control.

Can you please give me some clues or ways of doing. I don't know how
to be able to create the same behavior (buttons + and -)

Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Alert Dialog never displayed in when call in the run() method of a separate process.

2008-09-08 Thread CG

Thank you very much Huebi and hackbod, for first the solution and
taking the time to explain.

I succeded in doing what I want with Handler.

On Sep 8, 6:28 pm, Huebi <[EMAIL PROTECTED]> wrote:
> Hi,
>
> you can only display UI stuff from the main thread. You can use the
> Handler classes post() method to put the Dialog display in the event
> queue. Just have a look at the API docs.
>
> On 8 Sep., 18:16, CG <[EMAIL PROTECTED]> wrote:
>
> > Hello,
>
> > I am facing a strange issue. I suppose it is due to my bad
> > understanding of processes and compatibilities with processes.
>
> > So here is the behavior I'd like to have :
> > When I open my map, actions are done in background.
> > So I use a progress dialog. For that I need an separate thread.
> > But if an error occurs, I'd like to display a warning pop up. This
> > popup show request is done inside the run method of the separated
> > thread.
>
> > And the warning dialog is never displayed ! I don't understand why.
> > Can anyone explain me what is wrong ?
> > I join my code snippet to give a picture of what i try to do.
>
> > I also check the API demo and try to override the method
> > OnCreateDialog method but with the same result :-(
>
> > I suppose the issue is "when" I call the show().
>
> > - Code snippet
> > public class StationNearActivity extends MapActivity implements
> > OnClickListener, Runnable {
>
> >     /** Called when the activity is first created. */
> >     public void onCreate(Bundle icicle) {
>
> >         pgd = ProgressDialog.show(this, null,
> > getString(R.string.nearest_station_progress_dialog_wait));
>
> > /*
> >  I create the dialog here
> > -*/
> >         AlertDialog.Builder builder = new AlertDialog.Builder(this);
>
> > builder.setMessage(R.string.nearest_station_gm__popup_no_address_found_label);
> >         dlg = builder.create();
>
> > /*--
> > if I display it there then it works ! But it is not the correct
> > behaviour
> > dlg.show()
> > -*/
>
> >         super.onCreate(icicle);
> >         thisInstance = this;
>
> >         mapViewFromXML.setClickable(true);
> >         mapViewFromXML.setEnabled(true);
>
> >         }
>
> >         Thread threadOfMap = new Thread(this);
> >         threadOfMap.start();
> >     }
>
> >     public void run() {
> >         Looper.prepare();
>
> >         try {
> >             Thread.sleep(200);
> >         } catch (InterruptedException e) {
> >             // TODO Auto-generated catch block
> >             e.printStackTrace();
> >         }
>
> >         // --- Fill the map
> >         try {
> >             setMapCenter();
> >             if (mapCenter == null || (mapCenter.getLatitudeE6() == 0
> > && mapCenter.getLongitudeE6() == 0)) {
>
> > /*--
> > The "progress dialog dismiss" works but the "dialog show" not !
> > -*/
>
> >                 pgd.dismiss();
> >                 dlg.show();
> >             }
>
> >             Log.d("MAP", "add overlay");
> >            //
> >             mapViewFromXML.postInvalidate();
>
> >         } catch (Exception e) {
> >             Log.e(Constant.LOG_NS2_MAP, e.toString(), e);
> >         } finally {
> >             pgd.dismiss();
> >         }
> >     }
>
> > }
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Alert Dialog never displayed in when call in the run() method of a separate process.

2008-09-08 Thread CG

Hello,

I am facing a strange issue. I suppose it is due to my bad
understanding of processes and compatibilities with processes.

So here is the behavior I'd like to have :
When I open my map, actions are done in background.
So I use a progress dialog. For that I need an separate thread.
But if an error occurs, I'd like to display a warning pop up. This
popup show request is done inside the run method of the separated
thread.

And the warning dialog is never displayed ! I don't understand why.
Can anyone explain me what is wrong ?
I join my code snippet to give a picture of what i try to do.

I also check the API demo and try to override the method
OnCreateDialog method but with the same result :-(

I suppose the issue is "when" I call the show().

- Code snippet
public class StationNearActivity extends MapActivity implements
OnClickListener, Runnable {


/** Called when the activity is first created. */
public void onCreate(Bundle icicle) {

pgd = ProgressDialog.show(this, null,
getString(R.string.nearest_station_progress_dialog_wait));

/*
 I create the dialog here
-*/
AlertDialog.Builder builder = new AlertDialog.Builder(this);
 
builder.setMessage(R.string.nearest_station_gm__popup_no_address_found_label);
dlg = builder.create();

/*--
if I display it there then it works ! But it is not the correct
behaviour
dlg.show()
-*/

super.onCreate(icicle);
thisInstance = this;

mapViewFromXML.setClickable(true);
mapViewFromXML.setEnabled(true);

}

Thread threadOfMap = new Thread(this);
threadOfMap.start();
}

public void run() {
Looper.prepare();

try {
Thread.sleep(200);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

// --- Fill the map
try {
setMapCenter();
if (mapCenter == null || (mapCenter.getLatitudeE6() == 0
&& mapCenter.getLongitudeE6() == 0)) {


/*--
The "progress dialog dismiss" works but the "dialog show" not !
-*/

pgd.dismiss();
dlg.show();
}

Log.d("MAP", "add overlay");
   //
mapViewFromXML.postInvalidate();

} catch (Exception e) {
Log.e(Constant.LOG_NS2_MAP, e.toString(), e);
} finally {
pgd.dismiss();
}
}
}
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: SharedPreferences not stored betweed 2 emulator launch

2008-08-29 Thread CG

Thanks,

actually it was not working in API demos also and I have no specific
error message.

I wiped the data and everything is now clear.
Thanks a lot for your help Hackbod !

On 29 août, 10:32, hackbod <[EMAIL PROTECTED]> wrote:
> It does work, it is used in many of the apps, and the ApiDemos example
> shows it too.  Have you looked at the log to see any error messages
> reported?  You also might want to try wiping data to make sure you
> data partition is all in good shape.
>
> On Aug 29, 1:10 am, CG <[EMAIL PROTECTED]> wrote:
>
> > I just up the subject because it seems to be a bug or a mess in the
> > documentation.
>
> > Before trying to use the new preference mechanism I try my previous
> > preference storage (that worked perfectly under m5).
> > This mechanism worked before like that :
>
> > Restore :
>
> >    public static void restoreConfig(Activity act) {
> >         //--- OLD
> >         SharedPreferences settings =
> > act.getSharedPreferences(Constant.CONFIG_FILE_NAME,
> > Context.MODE_PRIVATE);
> > .
>
> > Save :
> >  public static void saveConfig(Context act) {
> > //--- OLD
> >         SharedPreferences settings =
> > act.getSharedPreferences(Constant.CONFIG_FILE_NAME,
> > Context.MODE_PRIVATE);
> >         SharedPreferences.Editor editor = settings.edit();
> >         editor.clear();
>
> >         editor.putInt(Constant.CONFIG_KEY_STATION_RETURNED,
> > getMaxStationReturned());
> > 
> >         editor.commit();
>
> >     }
>
> > I saw no changes in the documentation regardding this point and the
> > code still compiles, even after the 0.9 migration.
> > So my other question is : why does this mechanism does not work after
> > the 0.9 migration ?
> > Do we have to put specific permission ?
>
> > Then I still don't understand the new mechanism does not save
> > persistent data.
>
> > Thx for your help.
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: SharedPreferences not stored betweed 2 emulator launch

2008-08-29 Thread CG

I just up the subject because it seems to be a bug or a mess in the
documentation.

Before trying to use the new preference mechanism I try my previous
preference storage (that worked perfectly under m5).
This mechanism worked before like that :

Restore :

   public static void restoreConfig(Activity act) {
//--- OLD
SharedPreferences settings =
act.getSharedPreferences(Constant.CONFIG_FILE_NAME,
Context.MODE_PRIVATE);
.

Save :
 public static void saveConfig(Context act) {
//--- OLD
SharedPreferences settings =
act.getSharedPreferences(Constant.CONFIG_FILE_NAME,
Context.MODE_PRIVATE);
SharedPreferences.Editor editor = settings.edit();
editor.clear();

editor.putInt(Constant.CONFIG_KEY_STATION_RETURNED,
getMaxStationReturned());

editor.commit();

}

I saw no changes in the documentation regardding this point and the
code still compiles, even after the 0.9 migration.
So my other question is : why does this mechanism does not work after
the 0.9 migration ?
Do we have to put specific permission ?

Then I still don't understand the new mechanism does not save
persistent data.

Thx for your help.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] SharedPreferences not stored betweed 2 emulator launch

2008-08-28 Thread CG

Hi,

I have the following unexpected behaviour :
-> 1 start my application
-> I define a preference, thanks to the new mechanism (preferences
inflated from XML)
-> I stop my application

OPTION 1 :
-> I start my application for a second time, I check the preferences,
value is OK

OPTION 2 :
-> I close the emulator
-> I restart the emulator
-> I start my application, I check the preferences, value is NOT ok
(as not defined).

I was thinking the preferences are saved between two emulator
sessions.

Do I miss a point ?

Here is my preferences.xml file :

http://schemas.android.com/apk/res/android";>






Thanks for your help.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Simple Mock Location Provider

2008-08-25 Thread CG

Hi,

I'd just like to create to get a location (not tracking, just get the
last postion fixed), but for my mock location provider, I'd like this
fix change time to time.

I tried the old method by creating a new directory under the location
directory but it seems it does not work anymore (as documented by the
way :-) ).

I also add the test providers with the method :
public static void addMyMockLocationProvider(LocationManager locmgr) {

String mocLocationProvider = LocationManager.GPS_PROVIDER;

if (locmgr.getProvider(mocLocationProvider) == null || !
locmgr.isProviderEnabled(mocLocationProvider)) {
locmgr.addTestProvider(mocLocationProvider, false, 
false, false,
false, false, false, false, 0, 5);
locmgr.setTestProviderEnabled(mocLocationProvider, 
true);
   }
}

But I still don't have the position given in KML file I send thanks to
DDMS  (or even GPX files) (I import files and then push on the "PLAY"
button when clickable).

I have the folowing error in the logcat:
08-25 19:11:30.926: ERROR/LocationManagerService(52):
isProviderEnabled got exception:
08-25 19:11:30.926: ERROR/LocationManagerService(52):
java.lang.IllegalArgumentException: provider=network
08-25 19:11:30.926: ERROR/LocationManagerService(52): at
com.android.server.LocationManagerService._isProviderEnabled(LocationManagerService.java:
1145)
08-25 19:11:30.926: ERROR/LocationManagerService(52): at
com.android.server.LocationManagerService.isProviderEnabled(LocationManagerService.java:
1131)
08-25 19:11:30.926: ERROR/LocationManagerService(52): at
android.location.ILocationManager
$Stub.onTransact(ILocationManager.java:211)


I can't also succeed in having my current location in the standard
maps application. The system still returns 0, 0 !

Does anyone here can provide a quick step by step solution to have a
mock location provider working ?

Thx !


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---