[android-developers] Re: How to bring Activity to top of stack and reset it?

2011-01-28 Thread Streets Of Boston
Wouldn't 'singleTop' be better in his example?

On Jan 28, 5:37 pm, Kostya Vasilyev  wrote:
> Moto,
>
> You can try overriding onNewIntent and setting launchMode to singleTask in
> the manifest.
>
> http://developer.android.com/reference/android/app/Activity.html#onNe...)
>
> --
> Kostya Vasilyev --http://kmansoft.wordpress.com
> 29.01.2011 1:07 пользователь "Mark Murphy" 
> написал:

-- 
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 bring Activity to top of stack and reset it?

2011-01-28 Thread Streets Of Boston
If i understand you correctly, you'd want to assign 'singleTop' to an
activity's Launch Mode (in the manifest).

This mode makes sure that there is at most one instance of your
activity in your app, never more than one.

When a 'singleTop' activity is created, its onCreate method is called.
When a 'singleTop' activity is brought back to the front by some other
activity/context calling startActivity with an intent, its onNewIntent
method is called (be sure to call setIntent(...) within the
onNewIntent method).

(When a (singleTop) activity is brought back to the front by a 'BACK-
key' press, the activity's onStart, onResume methods are called)

On Jan 28, 5:27 pm, Moto  wrote:
> Not sure you understand the question or I don't understand the process so
> please let me explain what I think it's happening.
>
> Using flag FLAG_ACTIVITY_REORDER_TO_FRONT brings the activities to the
> front.  If already is somewhere in the history stack than it will be brought
> to the front and if not it will be created and than put at front of the
> history stack.  This behavior allows keeping the history stack "clean" so
> the user doesn't press back and continue to see repeated activities left and
> right like so many apps on the Android Market. "THAT"S WHAT I WANT TO
> AVOID!"
>
> Thinking on that behavior I wanted to find out if I could somehow have
> identical behavior but having the activity be restarted as it's brought to
> the front.
>
> >>That is like saying that red is not blue, and you want to know how to
> >>make red be blue, because you always want blue.
>
> I'm sorry but this question is nothing like red is not blue.. etc... Please
> take the time to read and help, and not try to degrade the developer!

-- 
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: HoneyComb and LayoutInflator-cloning seems broken

2011-01-29 Thread Streets Of Boston
Thank you Dianne,

When I get back to work, I'll give you an API with that problem.

On Jan 28, 11:39 pm, Dianne Hackborn  wrote:
> Actually just the .apk binary with a description of what to look for should
> be sufficient initially.
>
> On Fri, Jan 28, 2011 at 7:13 PM, Dianne Hackborn wrote:
>
>
>
>
>
> > It's not by design.  If you could me code + an .apk that runs on both GB
> > and HC and tell me what to look for in different behavior between the two, I
> > can take a look.
>
> > On Fri, Jan 28, 2011 at 1:43 PM, Streets Of Boston <
> > flyingdutc...@gmail.com> wrote:
>
> >> I have this piece of code:
>
> >>  final LayoutInflater liCloned =
> >> LayoutInflater.from(this).cloneInContext(this);
> >>  liCloned.setFactory(new KMInflaterFactory());
> >>  return liCloned;
>
> >> It returns a layout-inflator with my own custom factory
> >> 'KMInflatorFactory'.
> >> The KMInflatorFactory's method 'onCreateView' is never called (i tried
> >> both target-sdk-version of "8" and "Honeycomb").
>
> >> Is this by design or a bug in the preview-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 >>  cr...@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.
>
> --
> 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: HoneyComb and LayoutInflator-cloning seems broken

2011-01-31 Thread Streets Of Boston
Hi Dianne,

I haven't made an apk yet (i can't send you our entire app, my boss
would kill me :-)), but when i do send the apk-sample, where do i send
it? To your e-mail address?


On Jan 29, 10:23 pm, Streets Of Boston 
wrote:
> Thank you Dianne,
>
> When I get back to work, I'll give you an API with that problem.
>
> On Jan 28, 11:39 pm, Dianne Hackborn  wrote:
>
>
>
> > Actually just the .apk binary with a description of what to look for should
> > be sufficient initially.
>
> > On Fri, Jan 28, 2011 at 7:13 PM, Dianne Hackborn wrote:
>
> > > It's not by design.  If you could me code + an .apk that runs on both GB
> > > and HC and tell me what to look for in different behavior between the 
> > > two, I
> > > can take a look.
>
> > > On Fri, Jan 28, 2011 at 1:43 PM, Streets Of Boston <
> > > flyingdutc...@gmail.com> wrote:
>
> > >> I have this piece of code:
>
> > >>  final LayoutInflater liCloned =
> > >> LayoutInflater.from(this).cloneInContext(this);
> > >>  liCloned.setFactory(new KMInflaterFactory());
> > >>  return liCloned;
>
> > >> It returns a layout-inflator with my own custom factory
> > >> 'KMInflatorFactory'.
> > >> The KMInflatorFactory's method 'onCreateView' is never called (i tried
> > >> both target-sdk-version of "8" and "Honeycomb").
>
> > >> Is this by design or a bug in the preview-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 > >>  cr...@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.
>
> > --
> > 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.- Hide quoted text -
>
> - Show quoted text -

-- 
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: HoneyComb and LayoutInflator-cloning seems broken

2011-01-31 Thread Streets Of Boston
Email is on its way.
Thank you!

On Jan 31, 2:20 pm, Dianne Hackborn  wrote:
> Yeah just send it to me e-mail address.  Thanks!
>
> On Mon, Jan 31, 2011 at 7:59 AM, Streets Of Boston
> wrote:
>
>
>
>
>
> > Hi Dianne,
>
> > I haven't made an apk yet (i can't send you our entire app, my boss
> > would kill me :-)), but when i do send the apk-sample, where do i send
> > it? To your e-mail address?
>
> > On Jan 29, 10:23 pm, Streets Of Boston 
> > wrote:
> > > Thank you Dianne,
>
> > > When I get back to work, I'll give you an API with that problem.
>
> > > On Jan 28, 11:39 pm, Dianne Hackborn  wrote:
>
> > > > Actually just the .apk binary with a description of what to look for
> > should
> > > > be sufficient initially.
>
> > > > On Fri, Jan 28, 2011 at 7:13 PM, Dianne Hackborn  > >wrote:
>
> > > > > It's not by design.  If you could me code + an .apk that runs on both
> > GB
> > > > > and HC and tell me what to look for in different behavior between the
> > two, I
> > > > > can take a look.
>
> > > > > On Fri, Jan 28, 2011 at 1:43 PM, Streets Of Boston <
> > > > > flyingdutc...@gmail.com> wrote:
>
> > > > >> I have this piece of code:
>
> > > > >>  final LayoutInflater liCloned =
> > > > >> LayoutInflater.from(this).cloneInContext(this);
> > > > >>  liCloned.setFactory(new KMInflaterFactory());
> > > > >>  return liCloned;
>
> > > > >> It returns a layout-inflator with my own custom factory
> > > > >> 'KMInflatorFactory'.
> > > > >> The KMInflatorFactory's method 'onCreateView' is never called (i
> > tried
> > > > >> both target-sdk-version of "8" and "Honeycomb").
>
> > > > >> Is this by design or a bug in the preview-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 > cr...@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.
>
> > > > --
> > > > 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.- Hide quoted text -
>
> > > - Show quoted text -
>
> > --
> > 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.- Hide quoted text -
>
> - Show quoted text -

-- 
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: Honeycomb Preview is back

2011-01-31 Thread Streets Of Boston
There was word from google (although a bit burried :-)):
http://twitter.com/#!/androiddev


On Jan 31, 4:13 pm, tvo  wrote:
> FYI, am downloading the Honeycomb preview now via the SDK & AVD
> Manager. Did not work an hour ago, now it does. Do not know what
> happened since it disappeared last Friday. No word from Google.
> Anyway it is back again.

-- 
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 develop new android apps considering that the app will also be developed for other phones

2011-02-01 Thread Streets Of Boston
This problem you describe is hard. If you find the magic bullet, you'd
be rich. However, others have tried to solve this problem:

I'm not sure which platforms (i.e. phones) are currently supported by
each of them, but try to use PhoneGap, AppCelerator, RhoMobile, etc.
or just plain HTML5.


On Feb 1, 8:37 pm, Christian Chabtini  wrote:
> Hi,
>
> I want to know what kind of general strategy i would have to follow
> while developing android apps in order to easily make my app available
> to other phones .. in other words easily transferable.
>
> For example, i would like to know the basic strategy i need to follow
> to make an app available to an iphone OS,blackberry OS, Windows and
> Nokia.
>
> It would be nice to develop an app that translates existing apps from
> one phone to another despite the differences in libraries, languages
> and security... not to mention hardware.. thats another s
>
> Just want to make sure that i am starting my project right 
>
> ---­-
> Thank you,
> Christian Chabtini
> Software Engineer
> EMIDA

-- 
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: Dual mode (Honeycomb & Gingerbread) is the same APK.

2011-02-03 Thread Streets Of Boston
I read this on android-developers.blogspot.com, from Dianna:
http://android-developers.blogspot.com/2011/02/android-30-fragments-api.html

Quote:
"To address this, we plan to have the same fragment APIs (and the new
LoaderManager as well) described here available as a static library
for use with older versions of Android"

... where "this" is the issue you're asking about.


One thing i'm not quite understanding:
"Our goal is to make these APIs nearly identical, so you can start
using them now and, at whatever point in the future you switch to
Android 3.0 as your minimum version, move to the platform’s native
implementation with few changes in your app."

What happens before our app's minimum version is set to Android 3.0?
We would ship the app with the static library. This would mean that
even Android 3.0 (and higher) devices would run this static library
instead of its 'native' implementation. Or will there be some 'magic'
compatibility code that kicks in making use of the 'native'
imlementation?



On Jan 28, 6:32 pm, Zsolt Vasvari  wrote:
> What are the best practices to maintain an app that would run on both
> Honeycomb and pre-Honeycomb?  I do want to make use of Fragments and
> the other goodies, but I have a feeling this will be a major
> P.i.t.A.   I certainly don't want to maintain 2 separate apps.

-- 
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: Is Android good for this?

2011-02-03 Thread Streets Of Boston
LOL

And not much of snow melt or ice-away pellets either!

On Feb 3, 11:44 pm, "Maps.Huge.Info (Maps API Guru)"
 wrote:
> >> Android is good for everything!
> >> EVERYTHING I say!!!
>
> I can tell you from experience, Android makes a very poor laundry
> additive.
>
> -John Coryat

-- 
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] Android Layout Editor for 'Honeycomb (Preview)' issue with color values: Exception thrown in Eclipse.

2011-02-04 Thread Streets Of Boston
Hi,

The Android Layout Editor has been somewhat problematic for me when it
shows the layout of the widgets on the screen. Some of the widgets are
all shown crowded to the top. However, when showing the outline of the
widgets, the outlines are drawn in the correct spot.

However, when i select 'Android Honeycomb (Preview)', all the widgets
suddenly are shown in the correct location... no more crowding to the
top.  If i select any other value (e.g. Android 2.2), the widgets
start crowding to the top again.

One thing remains, though, to make it even more useful. When selecting
'Android Honeycomb (Preview), this is shown in the Error log:
(Shown on Eclipse Helios 3.6.1 with Android plugin version
9.0.0.v201101191456-93220, Windows XP, Android tools rev 9, Android
platform-tools rev 2)

java.lang.NumberFormatException: Color value '@color/screen_bg_top'
must start with #
at
com.android.layoutlib.bridge.impl.ResourceHelper.getColor(ResourceHelper.java:
68)
at
com.android.layoutlib.bridge.android.BridgeTypedArray.getColor(BridgeTypedArray.java:
273)
at
android.graphics.drawable.GradientDrawable.inflate(GradientDrawable.java:
684)
at
android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:
832)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:
769)
at
com.android.layoutlib.bridge.impl.ResourceHelper.getDrawable(ResourceHelper.java:
194)
at
com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:
364)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:303)
at
com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:
274)
at
com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.renderWithBridge(Unknown
Source)
at
com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.renderWithBridge(Unknown
Source)
at
com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart.recomputeLayout(Unknown
Source)
at
com.android.ide.eclipse.adt.internal.editors.layout.gle2.GraphicalEditorPart
$ConfigListener.onThemeChange(Unknown Source)
at
com.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigurationComposite.onThemeChange(Unknown
Source)
at
com.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigurationComposite.access
$8(Unknown Source)
at
com.android.ide.eclipse.adt.internal.editors.layout.configuration.ConfigurationComposite
$7.widgetSelected(Unknown Source)
at
org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:
234)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:
4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:
2640)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:
332)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:
664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:
149)
at
org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:
115)
at
org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:
196)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:
110)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:
79)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:
369)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:
179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)

It seems that the ResourceHelper.getColor should support color-
references, not only constant color-values (starting with #).

When i select any other value than 'Android Honeycomb (Preview)', e.g
'Android 2.2', this exception does not happen.


-- 
You received this message because you are subscribed to the Google
Groups "Android Devel

[android-developers] Re: AsyncTask in Honeycomb

2011-02-04 Thread Streets Of Boston
Why do i really really really want a serialized queue?
Our app uses AsyncTasks to complete HTTP requests. Multiple requests
can happen at the same time and in some situations we really really
really want it that way. As long as the onPostExecute is called
correctly, it should not be a problem


On Feb 4, 2:04 pm, Dianne Hackborn  wrote:
> It will be back to a pool in the final release, but we plan on changing this
> to be serialized (as it was when first introduced into the platform) in a
> future release.
>
> There will be a blog post on this some time soon.  Basic situation: you
> really really REALLY want to have a serialized queue, unless you deeply know
> what you are doing.
>
> On Fri, Feb 4, 2011 at 10:56 AM, Mark Murphy wrote:
>
>
>
>
>
> > On Fri, Feb 4, 2011 at 1:52 PM, Romain Guy  wrote:
> > > The Honeycomb preview uses a serialized queue to execute AsyncTasks, so
> > they
> > > will execute one after the other.
>
> > Is this a temporary thing? If not, that is a pretty major change,
> > rolling all the way back to Android 1.5-era functionality.
>
> > --
> > Mark Murphy (a Commons Guy)
> >http://commonsware.com|http://github.com/commonsguy
> >http://commonsware.com/blog|http://twitter.com/commonsguy
>
> > _The Busy Coder's Guide to *Advanced* Android Development_ Version 1.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
>
> --
> 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.- Hide quoted text -
>
> - Show quoted text -

-- 
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: AsyncTask in Honeycomb

2011-02-04 Thread Streets Of Boston
Perfect! :)

On Feb 4, 3:29 pm, Romain Guy  wrote:
> That's why AsyncTask now lets you execute tasks on your own thread pool.
>
> On Fri, Feb 4, 2011 at 11:51 AM, Shane Isbell wrote:
>
>
>
>
>
>
>
> > On Fri, Feb 4, 2011 at 11:24 AM, Streets Of Boston <
> > flyingdutc...@gmail.com> wrote:
>
> >> Why do i really really really want a serialized queue?
> >> Our app uses AsyncTasks to complete HTTP requests. Multiple requests
> >> can happen at the same time and in some situations we really really
> >> really want it that way. As long as the onPostExecute is called
> >> correctly, it should not be a problem
>
> > It really depends on the app. I've encountered problems with AsyncTask on
> > some apps. I had to replace the queue implementation in the AsyncTask for it
> > to work. Later when I customized the HttpUrlConnection to account for some
> > threading problem, I found the original queue in AsyncTask worked fine.
> > Something there seems a little goofy.
>
> > Shane
>
> >  --
> > 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
>
> --
> Romain Guy
> Android framework engineer
> romain...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support.  All such questions should be posted on public
> forums, where I and others can see and answer them- Hide quoted text -
>
> - Show quoted text -

-- 
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 Layout Editor for 'Honeycomb (Preview)' issue with color values: Exception thrown in Eclipse.

2011-02-04 Thread Streets Of Boston
Hi Xavier,

I sent you an e-mail with a zip file containing the XML.

On Feb 4, 4:18 pm, Xavier Ducrohet  wrote:
> Streets, can you send me the XML you're inflating?
>
> thanks,
> Xav
>
>
>
>
>
> On Fri, Feb 4, 2011 at 1:11 PM, Xavier Ducrohet  wrote:
> > On Fri, Feb 4, 2011 at 1:02 PM, Tor Norbye  wrote:
> >>> java.lang.NumberFormatException: Color value '@color/screen_bg_top'
> >>> must start with #
> >>>        at
> >>> com.android.layoutlib.bridge.impl.ResourceHelper.getColor(ResourceHelper.ja­va:
> >>> ...
> >>> It seems that the ResourceHelper.getColor should support color-
> >>> references, not only constant color-values (starting with #).
>
> >> The documentation for color resources seems to indicate that these
> >> colors must be specified as hex colors:
>
> >>http://developer.android.com/guide/topics/resources/color-list-resour...
>
> >> "android:color
> >> Hexadeximal color. Required. The color is specified with an RGB value
> >> and optional alpha channel.
> >> The value always begins with a pound (#) character and then followed
> >> by the Alpha-Red-Green-Blue information in one of the following
> >> formats:"
>
> > I think it's a case of not resolving the references. I'll look into it.
>
> > --
> > Xavier Ducrohet
> > Android SDK Tech Lead
> > Google Inc.
> >http://developer.android.com|http://tools.android.com
>
> > Please do not send me questions directly. Thanks!
>
> --
> Xavier Ducrohet
> Android SDK Tech Lead
> Google Inc.http://developer.android.com|http://tools.android.com
>
> Please do not send me questions directly. Thanks!- Hide quoted text -
>
> - Show quoted text -

-- 
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: OpenJDK on Android

2011-02-04 Thread Streets Of Boston
nope, i don't think a web-page that loads a java-applet will be
displayed on an Android browser. You'll probably get a warning/message/
text that the incorrect JRE is loaded.

On Feb 4, 6:47 pm, Indicator Veritatis  wrote:
> Applets running under Android: but don't we already have that in the
> browser on every Android phone? That runs applets. What more could you
> want?
>
> On Feb 3, 10:56 pm, koala  wrote:
>
>
>
> > Okay, seems that i don't know what i am talking about but you know
> > that i don't know what i am talking about.
>
> > Now see if you know how to make me know what i am talking about too.
>
> > But even if i don't know what i am talking about I guess i do know
> > what I want to know
>
> > Okay, how about running applets on Android? would that be possible?
> > would you be happy with that? or is it such a ridiculous question to
> > ask?
>
> > How about Apache Harmony instead of OpenJDK, does that sound better to
> > you?
>
> > On Jan 19, 4:10 pm, Marcin Orlowski  wrote:> On 
> > 14 January 2011 15:16, koala  wrote:
>
> > > > Is it all about the price of google's shares vs the price of oracle's
> > > > shares?
>
> > > It's rather matter of you now really knowing what you talk about.- Hide 
> > > quoted text -
>
> - Show quoted text -

-- 
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: ConditionVariable Usage

2009-04-22 Thread Streets Of Boston

I'm not quite sure what you want.

But about this sentence "Block Thread i am planning to keep as GUI
thread":
I assume you mean that you plan to block the main GUI thread until a
message arrives?
This is a bad idea. Never block the GUI thread. If you do, your app's
users get the "application not responding" message and an offer to
kill your app.

Personally, I use the ExecutorService classes from
java.util.concurrent to execute background tasks. Then, when done,
these tasks will post (post, postDelayed, etc) their results back to
the GUI thread.

On Apr 21, 8:45 am, Asif k  wrote:
> Hi,
>
> I'm trying to use a ConditionVariable to control the execution
> sequence of two threads. I can create a ConditionVariable in one
> thread and block on it. But I would like to be able to access it from
> another Thread  and unblock it from that thread.. ?
>
>    Blocked Thread i am planning to keep as GUI thread and it should
> update the messages which are sent by b/g thread on the screen during
> its block state and will be unblocked by b/g thread in the end by
> calling open(); method.
>
>   Can you please the proper way to accomplish this??
>
> Thanks,
> Asif
--~--~-~--~~~---~--~~
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 in drawaing square using open GL

2009-04-22 Thread Streets Of Boston

Honestly! What is your problem!!!??? :-) lol

Now a bit more seriously:
Could you describe exactly what problem you have? Your description is
rather vague.

Also, this is not all the code you need. I'm missing the Renderer-
thread that actually obtains the gl from the canvas can calls drawFrame
(gl) repeatedly in its 'run()' method.

On Apr 22, 1:06 am, Honest  wrote:
> Hello,
>
> I am facing problem in drawing square in open gl. The following is my
> code so please let me know if any thing wrong in it.
>
> /*
>  * Copyright (C) 2008 Google Inc.
>  *
>  * Licensed under the Apache License, Version 2.0 (the "License");
>  * you may not use this file except in compliance with the License.
>  * You may obtain a copy of the License at
>  *
>  *      http://www.apache.org/licenses/LICENSE-2.0
>  *
>  * Unless required by applicable law or agreed to in writing, software
>  * distributed under the License is distributed on an "AS IS" BASIS,
>  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
>  * See the License for the specific language governing permissions and
>  * limitations under the License.
>  *
>  */
>
> package com.saltriver.TriRender;
>
> //import com.example.android.apis.R;
> import java.io.IOException;
> import java.io.InputStream;
> import java.nio.ByteBuffer;
> import java.nio.ByteOrder;
> import java.nio.FloatBuffer;
> import java.nio.ShortBuffer;
>
> import android.content.Context;
> import android.graphics.Bitmap;
> import android.graphics.BitmapFactory;
> import android.opengl.GLU;
> import android.opengl.GLUtils;
> import android.os.SystemClock;
>
> import javax.microedition.khronos.egl.EGL10;
> import javax.microedition.khronos.opengles.GL10;
>
> public class TriangleRenderer implements GLSurfaceView.Renderer
> {
>
>     public TriangleRenderer(Context context) {
>         mContext = context;
>         mTriangle = new Triangle();
>     }
>
>     public int[] getConfigSpec()
>     {
>         // We don't need a depth buffer, and don't care about our
>         // color depth.
>         int[] configSpec =
>         {
>                 EGL10.EGL_DEPTH_SIZE, 0,
>                 EGL10.EGL_NONE
>         };
>         return configSpec;
>
>     }
>
>     public void surfaceCreated(GL10 gl)
>     {
>         /*
>          * By default, OpenGL enables features that improve quality
>          * but reduce performance. One might want to tweak that
>          * especially on software renderer.
>          */
>
>         gl.glDisable(GL10.GL_DITHER);
>
>         /*
>          * Some one-time OpenGL initialization can be made here
>          * probably based on features of this particular context
>          */
>         gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT,
>                 GL10.GL_FASTEST);
>
>         gl.glClearColor(.5f, .5f, .5f, 1);
>         gl.glShadeModel(GL10.GL_SMOOTH);
>         gl.glEnable(GL10.GL_DEPTH_TEST);
>         gl.glEnable(GL10.GL_TEXTURE_2D);
>
>         /*
>          * Create our texture. This has to be done each time the
>          * surface is created.
>          */
>
>         int[] textures = new int[1];
>         gl.glGenTextures(1, textures, 0);
>
>         mTextureID = textures[0];
>         gl.glBindTexture(GL10.GL_TEXTURE_2D, mTextureID);
>
>         gl.glTexParameterf(GL10.GL_TEXTURE_2D,
> GL10.GL_TEXTURE_MIN_FILTER,
>                 GL10.GL_NEAREST);
>         gl.glTexParameterf(GL10.GL_TEXTURE_2D,
>                 GL10.GL_TEXTURE_MAG_FILTER,
>                 GL10.GL_LINEAR);
>
>         gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S,
>                 GL10.GL_CLAMP_TO_EDGE);
>         gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T,
>                 GL10.GL_CLAMP_TO_EDGE);
>
>         gl.glTexEnvf(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE,
>                 GL10.GL_REPLACE);
>
>         InputStream is = mContext.getResources()
>                 .openRawResource(R.drawable.robot);
>         Bitmap bitmap;
>         try {
>             bitmap = BitmapFactory.decodeStream(is);
>         } finally {
>             try {
>                 is.close();
>             } catch(IOException e) {
>                 // Ignore.
>             }
>         }
>
>         GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
>         bitmap.recycle();
>
>     }
>
>     public void drawFrame(GL10 gl)
>     {
>
>         /*
>          * By default, OpenGL enables features that improve quality
>          * but reduce performance. One might want to tweak that
>          * especially on software renderer.
>          */
>         gl.glDisable(GL10.GL_DITHER);
>
>         gl.glTexEnvx(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE,
>                 GL10.GL_ADD);//GL_SUBTRACT // GL_MODULATE
>
>         /*
>          * Usually, the first thing one might want to do is to clear
>          * the screen. The most efficient way of doing this is to use
>          * glClear().
>          */
>
>         gl.glClear(GL10.GL_COLOR_BUFFER_

[android-developers] Re: Java 1.6?

2009-04-22 Thread Streets Of Boston

No you can't 'use' JDK1.6

When setting up eclipse, for example, you don't link your Android
projects to any JRE. You link it to the Android SDK. If i'm not
mistaken, the Android SDK adhers to the Java 1.5 language spec. But
for the available packages, apis, etc, Android bundles all the java.*,
javax.* packages. Consult developer.android.com for the API docs.


On Apr 22, 1:11 pm, Keith Wiley  wrote:
> Simple question, I did a cursory search on the dev guide and didn't
> get any obvious hits, although maybe I missed it (there's something
> about JDK versions, but they don't correlate to 1.5 or 1.6, they are
> more like 5 or 6 if you get my meaning).  I would like to use Java 1.6
> for some things.  In particular, I provides much better Collection
> interfaces.  Before I go to all the trouble is switching everything
> over (which I'm kinda unclear about anyway (Mac version, Mac Java
> version, Eclipse version, Android SDK/JDK/JRE/ AAH!), I just want to
> know if it's a fruitless endeavor.  Can I use Java 1.6 on an Android
> device?
>
> Thanks for any clarification.
>
> Cheers!
--~--~-~--~~~---~--~~
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: SeekBar

2009-04-22 Thread Streets Of Boston

What are you trying to accomplish?

Maybe you don't need to override onProgressRefresh.
Maybe you can implement your own SeekBar.OnSeekBarChangeListener and
register this listener with your seek-bar
(seekbar.setOnSeekBarChangeListener(...)).

On Apr 22, 5:03 pm, lggaleon  wrote:
> On Apr 22, 12:24 pm, Mark Murphy  wrote:
>
>
>
>
>
> > lggaleon wrote:
> > > Hello , everybody!
>
> > > I want to make my own Seek Bar. When I try to override
> > > onProgressRefresh method,
>
> > > Eclipse give me an error: the method onProgressRefresh is undefined
> > > for the type SeekBar.
>
> > > I cheked listing SeekBar.java and this method is in. Any ideas why
> > > this happend?
>
> > I do not see onProgressRefresh in the 1.1 SDK, and the method is
> > declared as package-private in the current source code. Hence, it is not
> > available to SDK developers.
>
> > --
> > Mark Murphy (a Commons 
> > Guy)http://commonsware.com|http://twitter.com/commonsguy
>
> > _The Busy Coder's Guide to Android Development_ Version 2.0 Available!
>
> Thank you very much.
> That's too bad. So,if I want to make my own seek bar, I need copy and
> modify AbsSeekBar and SeekBar
> classes? Doesn't make any sense for me- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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 Killswitch

2009-04-22 Thread Streets Of Boston

Thanks JP!

If you're worried about the cache, don't use the browser.
Instead, use DefaultHttpClient/HttpURLConnection to download your HTML
file from your web-site (be sure to set the DefaultHttpClient/
HttpURLConnection not to use any cache). Then show the data from this
downloaded HTML file in a WebView.


On Apr 22, 10:24 pm, JP  wrote:
> On Apr 22, 9:48 am, "auj...@gmail.com"  wrote:
>
> > I am looking for any information on the Android Kill switch ?
>
> Well, AFAIK there is no Android Kill switch. Some home cooking is in
> order. Here's my recipe. The beauty here - you can spice it up as much
> as you like.
> As a prerequisite, you need to have a web site to anchor the "kill
> switch". Below a code snippet that you can use and (must) modify (use
> proper domain names). I've pulled this together from a few classes so
> it might not work out of the box. DIY spirit required (;->).
>
> <- snip
> --->
> Context appContext = this.getApplicationContext();
>
> // Read app version
> String versionName = "";
> try {
>         PackageManager pM = appContext.getPackageManager();
>         PackageInfo pI =  pM.getPackageInfo("com.yourdomain.yourapp", 0);
>         versionName = pI.versionName;} catch (Exception e) {
>
>         Log.v("Exception", "Exception version check: " + e.getMessage());
>
> }
>
> // Read network state (requires network state permission in
> AndroidManifest.xml):
> //       android:name="android.permission.ACCESS_NETWORK_STATE" />
> NetworkInfo.State networkState = NetworkInfo.State.DISCONNECTED;
> ConnectivityManager systemService = (ConnectivityManager)
> appContext.getSystemService(Context.CONNECTIVITY_SERVICE);
> if (systemService != null && systemService.getActiveNetworkInfo() !=
> null)
>         networkState = systemService.getActiveNetworkInfo().getState();
>
> // If network is available, reach out and see if "kill switch" page is
> posted
> try {
>         if (networkState == NetworkInfo.State.CONNECTED) {
>                 URL url = new URL("http://www.yourwebsite.com/"; + versionName 
> +
> ".html");
>                 URLConnection connection = 
> (URLConnection)url.openConnection();
>                 connection.setDefaultUseCaches(false);
>                 connection.setUseCaches(false);
>                 connection.connect();
>                 InputStream is = connection.getInputStream();
>                 if (is.read() != null) {
>                         // "Kill switch" triggered, open Android browser with
> "kill switch" file
>                         Intent myIntent = new Intent(Intent.ACTION_VIEW,
> Uri.parse("http://www.yourwebsite.com/"; + version + ".html"));
>                         myIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
>                         startActivity(myIntent);
>                         this.finish(); // Comment this out and this will 
> "only" be a nag
> screen
>                 }
>         }} catch (Exception e) {
>
>         Log.v("Check", "Check version authorization exception: " +
> e.getMessage());
>
> }
>
> <- snip
> --->
>
> The network state analysis can probably be omitted. I need the network
> state for other app functionality, so I've included it in the
> implementation.
> The "kill switch" can be tied to any condition you can determine
> within your running app. I've used the app's version, so let's run
> with this example.
> Assuming the app version is "1.0": When you post a file 1.0.html 
> onhttp://www.yourwebsite.com/, the "kill switch" will be triggered, and
> your app opens the Android browser with the content of 1.0.html before
> finishing. This happens without user interaction. Posting the "kill
> switch" page is not to be taken lightly. Even after you unpost it, it
> remains in Android's HTTP cache for a while, and the "kill switch"
> condition will be triggered regardless you unposting 1.0.html. I could
> not figure that part out completely, so I assume throwing the "kill
> switch" an irreversible operation.
> If the "kill switch" file has not been posted, the code above will
> throw an exception, and just log a "Check version authorization
> exception". The user will not notice anything. I recommend you execute
> this in a Thread separate from you main UI cycle in order to avoid
> getting hit by any delays reaching out to yourwebsite.com.
> In rare cases I found that the exception is not thrown, even though
> the "kill switch" page has never been posted - I consider this a bug
> in Android. I couldn't narrow this down, except for the impression
> this might have to do with switching networks between 3G/Edge and
> Wifi. When this happens, the browsers opens with a 404. Again, this is
> rare.
>
> Going back to the kill switch page (1.0.html). You have to be very
> articulate and nice in explaining why this page pops up.
> This is important, because on this page, you will steer the us

[android-developers] Re: SeekBar

2009-04-22 Thread Streets Of Boston

Note that with 9-Patch drawables and the possibility of setting the
progress-drawable  (and sub-progress-drawable) you can create pretty
funky SeekBars without creating your own version from scratch (maybe a
bit of sub-classing of SeekBar).

On Apr 22, 7:08 pm, Raphael  wrote:
> On Wed, Apr 22, 2009 at 2:47 PM, lggaleon  wrote:
> > I try to make " universal" seek bar, where I can easy change all
> > parameters(graphic elements, orientation, min and max values etc.)
>
> IIRC you can customize most of the drawables used for the graphic elements.
>
> If you really want to customize *everything*, wouldn't it be just
> easier to make your own seekbar?
>
> R/
--~--~-~--~~~---~--~~
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: HttpUrlConnection problem

2009-04-23 Thread Streets Of Boston

I had a similar issue and i gave up.
Instead i used the DefaultHttpClient class together with HttpPut/
HttpGet/HttpResponse classes.

This works fine.

On Apr 23, 5:50 am, Mika  wrote:
> Hi all,
>
> I have a strange problem with HttpUrlConnection. I can send data (with
> POST), but the receiving succeeds only every second time or after a
> sufficiently long (< 5 min) pause between the sends. I basically start
> a new thread where the initialization of the HttpUrlConnection,
> writing/reading from output/input streams and closing the connection
> is done. If I don't close the input and the output streams the sending
> works correctly each time.
>
> Any suggestions where's the problem? The same problem was discussed in
> herehttp://groups.google.com/group/android-developers/browse_thread/threa...
> but no solution were found.
>
> -Mika
--~--~-~--~~~---~--~~
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: JPEG PixelFormat

2009-04-24 Thread Streets Of Boston

If any assumption has to be made, the JPEG data is likely to be in
sRGB colorspace, which is most widely used, especially for online
viewing.

Usually, if an RGB file (JPEG/PNG/TIFF) is read without ICC data, sRGB
is assumed.

I doubt the quality of G1's camera is good enough to warrant adobeRGB
or a colorspace with even a wider gamut.

But, you never know for future phones: I hope that future phones, that
do embed colorspace info, will do so by automatically embedding the
correct colorspace or colorprofile in the JPEG data (the byte[]).


On Apr 24, 2:20 am, Sheado  wrote:
> Hi,
>
> Is the JPEG image returned by Camera.takePicture(...) always going to
> be in the same color space, regardless of the phone Android is on?
>
> Thank in Advance!
--~--~-~--~~~---~--~~
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 draw a piece of Bitmap

2009-04-27 Thread Streets Of Boston

My app zooms in and out of pics and lets the user moved the (zoomed)
in pic around.
The key methods for mapping a sub-picture (the one the size of the
screen) is done by using the calls Matrix.setRectToRect and
Bitmap.createBitmap(Bitmap source, int x, int y, int width, int
height, Matrix m, boolean filter), with x=y=0 (letting the Matrix m do
all the translations), and 'width' and 'height' set to the size of the
full-sized image (letting the Matrix m do all the scaling).


On Mar 9, 12:50 pm, Nick  wrote:
> Hello!
> I'm creating a simple game for Android and faced with a problem: Idea
> is to have a huge "map" image file and re-draw only small part of it
> (320*480) depending on user actions.
>
> I didn't find a better solution than using "public static Bitmap
> createBitmap (Bitmap source, int x, int y, int width, int height)"
> method and decided to try it (expected huge performance degradation),
> but actually it's appeared that this method changes source bitmap and
> when i call it second time source size is significantly reduced. For
> instance this code:
>
> int bitHeight = mBackgroundImage.getHeight();
> int bitWidth = mBackgroundImage.getWidth();
> Bitmap curMap = Bitmap.createBitmap(mBackgroundImage,
>                 0, mY, 320, 480);
> canvas.drawBitmap(curMap, 0, 0, null);
>
> gives 320*960 (initial source image size) size for the first time and
> 320*455 for the second call
>
> I hope this is not a best solution and look forward to hearing a new
> direction or at least clarification on createBitmap method.
>
> p.s i'm not a native english speaker and i apologise for possible
> mistakes.
--~--~-~--~~~---~--~~
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 display RGB 565 byte array on the screen

2009-04-27 Thread Streets Of Boston

Take a look at this method on developer.android.com:

Bimtap BitmapFactory.decodeByteArray(byte[] data, int offset, int
length, BitmapFactory.Options opts)

and how to draw a Bitmap on the screen (onDraw; dispatchDraw; Canvas;
etc.)

On Apr 27, 6:20 am, lohith  wrote:
> Hi,
>
> Can please anyone let me know how to display a raw RGB 565 byte array on the
> screen
>
> 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
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Framerate killed by onTouchEvent spam

2009-04-27 Thread Streets Of Boston

One work-around works rather well if you do the onTouchEvent handling
in the main GUI-thread and drawing the screen in another (background)
thread.

In your handling of your onTouchEvent (especially when handling the
ACTION_MOVE) add a sleep statement for about 20 milliseconds (or a bit
longer) (try { Thread.sleep(20); } catch (Execption e) {}). Try other
values (more than 20 millisecs, but no more than 100).

This is an *ugly* solution, but it does throttle down the onTouchEvent
and give other threads a better chance to run more smoothly.


On Apr 27, 12:24 am, piecewise  wrote:
> I've got a problem with a flood of touch events destroying my game's
> framerate while there is a touch active.
>
> Basically onTouchEvent is called (with getAction = ACTION_MOVE, x = 0
> and y = 0) about a hundred times a second for as long as the finger is
> touching the screen. I've tried returning from onTouchEvent straight
> away, and even removing its implementation at all, but it doesn't help
> - the app slows to a crawl as soon as a finger is down.
>
> I asked on the IRC channel and Romain Guy advised me that they're
> aware of the problem but didn't have time to fix it for Cupcake, so
> I'm not expecting a full solution!
>
> I was just wondering if anyone else has encountered this and figured
> out a way around it.
>
> Cheers,
> Tom
--~--~-~--~~~---~--~~
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: java.lang.OutOfMemoryError: bitmap size exceeds VM budget

2009-04-27 Thread Streets Of Boston

I do this in my app as well, and it works fine using BitmapFactory.
But i make sure that this large bitmap (full-size image, 6Mpix) is
about the only one loaded in my application. If not, i get the same
exception.

Opening 2 of these large ones will give me this exception, whatever i
do.

On Apr 26, 11:10 am, "anthony.dahanne" 
wrote:
> Hello !
> While I'm trying to resize a photo (originally on a sd card), grabbed
> using :
>
> InputStream openInputStream = contentResolver.openInputStream
> (photoUri);
>
> I got the following stack trace when calling : Bitmap bitmap =
> BitmapFactory.decodeStream(openInputStream);
>
> 04-26 14:57:57.213: ERROR/dalvikvm-heap(349): 6291456-byte external
> allocation too large for this process.
> 04-26 14:57:57.224: ERROR/(349): VM won't let us allocate 6291456
> bytes
> 04-26 14:57:57.234: DEBUG/skia(349): 
> allocPixelRef failed
> 04-26 14:58:58.005: WARN/dalvikvm(349): threadid=15: thread exiting
> with uncaught exception (group=0x4000fe68)
> 04-26 14:58:58.014: ERROR/AndroidRuntime(349): Uncaught handler:
> thread Thread-19 exiting due to uncaught exception
> 04-26 14:58:58.153: ERROR/AndroidRuntime(349):
> java.lang.OutOfMemoryError: bitmap size exceeds VM budget
> 04-26 14:58:58.153: ERROR/AndroidRuntime(349):     at
> android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
> 04-26 14:58:58.153: ERROR/AndroidRuntime(349):     at
> android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:304)
> 04-26 14:58:58.153: ERROR/AndroidRuntime(349):     at
> android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:149)
> 04-26 14:58:58.153: ERROR/AndroidRuntime(349):     at
> android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:174)
>
> Do you know an alternative way to resize a picture ? without calling
> BitmapFactory ? and without getting such an exception ?
> Thanks in advance for your help
> Anthony
--~--~-~--~~~---~--~~
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: GridView and BaseAdapter position bug

2009-04-27 Thread Streets Of Boston

The child/item-views in list-views and grid-views are re-used
(convertView input parameter). I suspect that depending on the layout/
measurements/visibility of the child-views and the way you implement
getView (re-using convertView or ignoring it and returning a brand-new
child-view every time), the order in which these child-views are
called (value of 'position' parameter in the getView method) can be
random.

On Apr 27, 11:30 am, Illidane  wrote:
> Why number of getView calls is different??
> One time it's 102 ( but need to be 100 ) and the second and greater is
> 101.
>
> On 27 апр, 18:15, Romain Guy  wrote:
>
>
>
> > It's not a bug. There's no guarantee in the order of the calls wrt to
> > the position value. It also depends on how the GridView is
> > measured/laid out.
>
> > On Mon, Apr 27, 2009 at 6:38 AM, Illidane  wrote:
>
> > > Hi,
> > > I'm using GridView in my app, and myAdapter ( extends BaseAdapter) for
> > > it. I have overrited method getView(int position, View convertView,
> > > ViewGroup parent) of Adapter and 100 cells in GridView.
>
> > > If I set logger:
> > > android.util.Log.w("bla", (new StringBuilder()).append
> > > (position).toString()); where is in the getView then I'll see that
> > > position is changed like: 0, 0, 1, 2, 3... 99, 0. -WTF? ( thats for
> > > the first time) and then I call mGameGrid.setAdapter(mAdapter) and
> > > position is going: 0, 0, 1, 2, 3...99.
> > > I think it's a bug of BaseAdapter, isn't it?
>
> > --
> > Romain Guy
> > Android framework engineer
> > romain...@android.com
>
> > Note: please don't send private questions to me, as I don't have time
> > to provide private support.  All such questions should be posted on
> > public forums, where I and others can see and answer them- Hide quoted text 
> > -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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: GridView and BaseAdapter position bug

2009-04-27 Thread Streets Of Boston

It's not buggy. I use the adapters and grid/list-views in my apps and
they work fine. I think they are not designed for your purpose.

e.g. If your adapter has 100 elements and the grid/list-view only
shows about 15 at a time on the screen, the getView is called about 15
times. Sometimes more times, depending whether a little bit (a few
pixels) of the top or bottom child-view become visible or not. Then,
when you start scrolling, getView gets called again and again when
child-views become visible and others become invisible.

Also, seriously consider re-using the convertView for your grid- or
list-view. My experience is that it can really slow down your app if
you just return new View instances for each child-view/cell:
public ... getView() {
  View view = convertView != null ? convertView : createNewView(...);
  ...
  ...
  return view;
}

The implementation of the adapter+listviews does not need to rely on
the order in which the getView is called. As long as it is called for
every child-view that becomes visible.

Isn't is possible to start a child-view's (cell's) animation when you
handle it the getView(...) method?

If you really want at least 100 child-views/cells to be created (i
won't recommend it... it's a LOT), you can override the Adapter's
getViewTypeCount() and getItemViewType(int pos). Even with this, I'm
still not sure if getView would get called in the order you want.

...
  private static int EXPECTED_CELL_COUNT = 100;

  public int getViewTypeCount() { return EXPECTED_CELL_COUNT; }
  public int getItemViewType(int pos) { return pos %
EXPECTED_CELL_COUNT; }



On Apr 27, 1:07 pm, Illidane  wrote:
> And you think it's not a bug? where is guarantee that it will work in
> general?
> Where adapter takes it's magic number N?
>
> On 27 апр, 19:56, Romain Guy  wrote:
>
>
>
> > There is no guarantee it's going to be called N times either.
>
> > 2009/4/27 Illidane :
>
> > > Even with convertView problem is still same - last cell is not
> > > animating.
> > > And... you said WHEN getView()... I think it's no matter, matter HOW
> > > MANY times getView() called.
> > > It calls more than 100 times, whats very strange.
> > > For the first time it's called 102 times and all animations was
> > > working. For the second and next times it was 101, and last animation
> > > was static.
> > > I think where is some bug regularity...
>
> > > On 27 апр, 19:31, Romain Guy  wrote:
> > >> You should ALWAYS reuse the convertView, oherwise you're gonna eat up
> > >> memory and just slow down your app. And like I said, there is no
> > >> guarantee on how and when getView() is called so you cannot rely on it
> > >> with your anim counter.
>
> > >> 2009/4/27 Illidane :
>
> > >> > I dont use convertView parametr and return new child-view.
>
> > >> > Each cell has an animation. In the getView I generate an array of
> > >> > animations, wich I start when the adapter stops his work ( e.g. when
> > >> > my mAnimCounter == 102 ( but need be max 100, lol ) When I run app,
> > >> > all 100 cells are animated. But when I re-check the field as I need
> > >> > and call mGameGrid.setAdapter(mAdapter), new animations working, but
> > >> > last. Last cell are NOT animated. Problem can be only in getView and
> > >> > method how it works. I very doubt that it's not a bug of GridView or
> > >> > Adapter.
>
> > >> > On 27 апр, 18:59, Streets Of Boston  wrote:
> > >> >> The child/item-views in list-views and grid-views are re-used
> > >> >> (convertView input parameter). I suspect that depending on the layout/
> > >> >> measurements/visibility of the child-views and the way you implement
> > >> >> getView (re-using convertView or ignoring it and returning a brand-new
> > >> >> child-view every time), the order in which these child-views are
> > >> >> called (value of 'position' parameter in the getView method) can be
> > >> >> random.
>
> > >> >> On Apr 27, 11:30 am, Illidane  wrote:
>
> > >> >> > Why number of getView calls is different??
> > >> >> > One time it's 102 ( but need to be 100 ) and the second and greater 
> > >> >> > is
> > >> >> > 101.
>
> > >> >> > On 27 апр, 18:15, Romain Guy  wrote:
>
> > >> >> > > It's not a bug. There's no guarantee in the order of the calls 
> > >> >>

[android-developers] Re: Android Market: Can you download apps without publishing them? Do you pay for your own apps? +signing problems

2009-04-27 Thread Streets Of Boston

I tried buying my own app once to try out how updates would work, etc.
I could not do it (i put in my credit-card details and i got some
weird server-errors and that was the end of it).

Maybe this has changed recently...

On Apr 27, 2:50 pm, "Justin (Google Employee)" 
wrote:
> Having the app installed with two different certs used for signing
> would have definitely caused a problem. What's your app? What does
> logcat say when you try to download?
>
> As far as paying for your own app, I think you do, not really sure.
> This is pretty simple to test and it doesn't seem like giving yourself
> money is a problem, per se, although perhaps inconvenient.
>
> Cheers,
> Justin
> Android Team @ Google
>
> On Apr 27, 11:42 am, Just Checking  wrote:
>
>
>
> > I already did have the app installed through Eclipse. Before uploading
> > the app, I exported the apk, then signed it with jarsigner. I also
> > tried adb uninstall before downloading; no luck there either.
>
> > How about my other questions?- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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: Layout question - how to replicate what the iPhone does...

2009-04-27 Thread Streets Of Boston

Hi Anna,

You can have any view inside your list-items.

Create a ListView with an Adapter (BaseAdapter or any other type of
Adapter).
The Adapter has 4 elements; your four tasks.

Then override the Adapter's getView(...) method.
Based upon the 'position' (from the parameters of getView()), you
can return a View that is as complex as you want. You can use
'inflate' this view from XML or create the entire view
programatically. Look at the API Demos for list-view for sample code.

This complex view is selectable, since it is a list-item.

On Apr 27, 5:01 pm, Anna PS  wrote:
> Hi there,
>
> I have an application that consists of a series of tasks, and I'm
> struggling to replicate a user experience that is simple to implement
> on the iPhone.
>
> In the abstract: on the home screen, I'd like there to be a list of
> four tasks, of various kinds.
>
> -- Two will invite the user to click on them, with an arrow. When they
> are complete, they show a tick.
> -- One task is dependent on the others, so it will be greyed out until
> the others are completed. Then it looks like the others.
> -- Another task runs in the background, so it has a progress icon
> running until it's finished, instead of an arrow.
>
> To show what I mean concretely, this is the application that I'm
> trying to replicate - check out the home 
> screen:http://www.fixmystreet.com/iphone/
>
> How would I even start to create a home screen that looks like this in
> Android? Essentially I need clickable areas with text and icons.
> Buttons can't have images attached, nor can they be greyed out. Maybe
> a List... but you can't attach checkboxes or progress indicators to
> individual items. Is a series of WebViews the best way?
>
> Or should I use something radically different like a TabWidget? I do
> like the layout here, though...
>
> Can anyone help? I'm really struggling to know what to do!
>
> Thank you for your help!
>
> Anna
--~--~-~--~~~---~--~~
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: Application doesnot quit on calling finish()

2009-04-28 Thread Streets Of Boston

Probably System.exit().

But why would you want to do that? Why not leave it up the the OS to
kill your process when necessary?
Your activities should be able to handle the Android life-cycle
process correctly (onCreate, onResume, onPause, onDestroy, etc).


On Apr 28, 8:56 am, Sudha  wrote:
> So can you please just brief me on where to concentrate and what all
> should be done while closing an app so that it is entirely erased from
> the memory when exited...?
>
> On Apr 28, 5:51 pm, Jean-Baptiste Queru  wrote:
>
>
>
> > finish() doesn't close your application, is just closes your activity.
> > The Appliction object itself stays behind, as well, as the entire
> > process, as long as there's memory available to keep them around, so
> > that re-launching your app is faster then next time around.
>
> > JBQ
>
> > On Tue, Apr 28, 2009 at 5:40 AM, Sudha  wrote:
>
> > > Hi,
>
> > > I have been developing a game on Android and wrote a wrapper for J2ME
> > > classes,
>
> > > When notifyDestroyed() is called in my ME program and calling finish()
> > > but the application doesn't close correctly.
>
> > > The App goes to background and when launched again it shows an error
> > > message and presents an option to "force close" the App, if i force
> > > close it and launch again, the app launches fine but again the same
> > > has to be repeated upon every launch..
>
> > > Can you please explain why the App is not being erased from memory
> > > when finish() is called.\
>
> > > when i check the log i found no exceptions when closing but when
> > > launched again it throws a null pointer exception.
>
> > > for now to work around I placed "System.exit(0)" after calling finish
> > > () so that the app is exited abruptly, but am waiting for a valid
> > > answer on whats going on behind...?
>
> > --
> > Jean-Baptiste M. "JBQ" Queru
> > Android Engineer, Google.
>
> > Questions sent directly to me that have no reason for being private
> > will likely get ignored or forwarded to a public forum with no further
> > warning.- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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: GridView and BaseAdapter position bug

2009-04-28 Thread Streets Of Boston

Don't rely on the order in which getView is called. It is not a bug.
It is a decision of the design of the grid/list view not to be
dependent on the order in which getView is called. Why getView with
position '0' is called three times... i don't know. *If* this is a
bug, it is only a peformance issue. Maybe it has to do with lay-out
issues (layout 'weights' are used)? Just don't rely on the order.

However, maybe you can do this instead. Below is code that does not
rely on the number of times getView is called nor the order in which
it is called:

You know that you have 100 cells. Make an array of 100 booleans as an
instance variable of your adapter or activity (e.g. boolean[] _visited
= new boolean[100]). Initially, set every element in this array to
false. When getView is called with a value of position, do this inside
of your getView method:

  ...
  ...
  _visited[position] = true;
  boolean allCellsAreShown = true;
  for (int i = 0; i < _visited.length; i++) {
if (!_visited[i]) {
  allCellsAreShown = false;
  break;
}
  }
  if (allCellsAreShown) {
... // start your animation.
  }
  ...
  ...

(you could optimize the above code a bit... but i think you'd get the
idea :=) ).


On Apr 28, 9:43 am, "yarik...@gmail.com"  wrote:
> I have exactly same problem. Why do we have 102 values of position
> when there is only 100 cells displayed on screen?
> "position is changed like: 0, 0, 1, 2, 3... 99, 0" - what is the cause
> of that? Can someone from google team answer?
> That seems to be a bug, very annoying bug. Answer "It's not a bug" is
> not answer! How do you generate position?
>
> On Apr 27, 9:40 pm, Illidane  wrote:
>
>
>
> > There is a way to make GridView without Adapter ( e.g. something
> > like .addView() method ) ?
>
> > On 27 апр, 21:38, Illidane  wrote:
>
> > > My GridView shows all 100 cells on the screen ( all visible at one
> > > moment )
> > > and all the animation works fine, and pretty fast ( on all 100
> > > elements ),
> > > but than begin problems with last cell.
> > > Animation not child-view's. Each cell is a imageView with animation on
> > > it.
>
> > > On 27 апр, 20:43, Streets Of Boston  wrote:
>
> > > > It's not buggy. I use the adapters and grid/list-views in my apps and
> > > > they work fine. I think they are not designed for your purpose.
>
> > > > e.g. If your adapter has 100 elements and the grid/list-view only
> > > > shows about 15 at a time on the screen, the getView is called about 15
> > > > times. Sometimes more times, depending whether a little bit (a few
> > > > pixels) of the top or bottom child-view become visible or not. Then,
> > > > when you start scrolling, getView gets called again and again when
> > > > child-views become visible and others become invisible.
>
> > > > Also, seriously consider re-using the convertView for your grid- or
> > > > list-view. My experience is that it can really slow down your app if
> > > > you just return new View instances for each child-view/cell:
> > > > public ... getView() {
> > > >   View view = convertView != null ? convertView : createNewView(...);
> > > >   ...
> > > >   ...
> > > >   return view;
>
> > > > }
>
> > > > The implementation of the adapter+listviews does not need to rely on
> > > > the order in which the getView is called. As long as it is called for
> > > > every child-view that becomes visible.
>
> > > > Isn't is possible to start a child-view's (cell's) animation when you
> > > > handle it the getView(...) method?
>
> > > > If you really want at least 100 child-views/cells to be created (i
> > > > won't recommend it... it's a LOT), you can override the Adapter's
> > > > getViewTypeCount() and getItemViewType(int pos). Even with this, I'm
> > > > still not sure if getView would get called in the order you want.
>
> > > > ...
> > > >   private static int EXPECTED_CELL_COUNT = 100;
>
> > > >   public int getViewTypeCount() { return EXPECTED_CELL_COUNT; }
> > > >   public int getItemViewType(int pos) { return pos %
> > > > EXPECTED_CELL_COUNT; }
>
> > > > On Apr 27, 1:07 pm, Illidane  wrote:
>
> > > > > And you think it's not a bug? where is guarantee that it will work in
> > > > > general?
> > > > > Where adapter takes it's magic number N?
>
> > > > > O

[android-developers] Re: GridView and BaseAdapter position bug

2009-04-28 Thread Streets Of Boston

Yikes

Another option would be to start a timer at each getView call (using
postDelayed and removeCallbacks methods; postDelayd to start timer,
removeCallbacks to remove previous timer until the last call to
getView).

When the last timer times-out (the last non-remove postDelayed), the
task (Runnable provided to the postDelayed call) could get the
GridView and loop over its child-views (which are the cells). This
means you will start the animations 'outside' of the getView method,
after the grid-view has finished all its work.

Maybe there is a better way than using a timer to figure out when a
listview or gridview are done laying out their child-views, though


On Apr 28, 11:40 am, Illidane  wrote:
> I have tried to do that - doesn't working for me :(
> Animation is running always without last cell.
> I think so:
> In first case there is a '0' at the end of position values. Without
> your algorithm all 100 animations is running, than without last ( and
> there is no '0' at the end ).
> With you alhorithm animation will start before position will be a '0'
> for the third time, because _visited[0] will be true;
> I think there is some regularity here.
>
> And one more thing... I would like to start animations in some other
> function. Than it's working fine. For example in onCreate method in
> the my grid click listener: after mGameGrid.setAdapter(mAdapter). But
> I need to set timer in 200, or 500 ms for waiting for getView finish
> its work ( but even so, it's not always make it in time and I see only
> half or 2/3 of all animations running). If I call start animation
> after setAdapter without timer - it's doesn't work. Why animation is
> working fine in that case, but don't working if I run it in getView
> method, even with your algorithm?
>
> On 28 апр, 16:55, Streets Of Boston  wrote:
>
>
>
> > Don't rely on the order in which getView is called. It is not a bug.
> > It is a decision of the design of the grid/list view not to be
> > dependent on the order in which getView is called. Why getView with
> > position '0' is called three times... i don't know. *If* this is a
> > bug, it is only a peformance issue. Maybe it has to do with lay-out
> > issues (layout 'weights' are used)? Just don't rely on the order.
>
> > However, maybe you can do this instead. Below is code that does not
> > rely on the number of times getView is called nor the order in which
> > it is called:
>
> > You know that you have 100 cells. Make an array of 100 booleans as an
> > instance variable of your adapter or activity (e.g. boolean[] _visited
> > = new boolean[100]). Initially, set every element in this array to
> > false. When getView is called with a value of position, do this inside
> > of your getView method:
>
> >   ...
> >   ...
> >   _visited[position] = true;
> >   boolean allCellsAreShown = true;
> >   for (int i = 0; i < _visited.length; i++) {
> > if (!_visited[i]) {
> >   allCellsAreShown = false;
> >   break;
> > }
> >   }
> >   if (allCellsAreShown) {
> > ... // start your animation.
> >   }
> >   ...
> >   ...
>
> > (you could optimize the above code a bit... but i think you'd get the
> > idea :=) ).
>
> > On Apr 28, 9:43 am, "yarik...@gmail.com"  wrote:
>
> > > I have exactly same problem. Why do we have 102 values of position
> > > when there is only 100 cells displayed on screen?
> > > "position is changed like: 0, 0, 1, 2, 3... 99, 0" - what is the cause
> > > of that? Can someone from google team answer?
> > > That seems to be a bug, very annoying bug. Answer "It's not a bug" is
> > > not answer! How do you generate position?
>
> > > On Apr 27, 9:40 pm, Illidane  wrote:
>
> > > > There is a way to make GridView without Adapter ( e.g. something
> > > > like .addView() method ) ?
>
> > > > On 27 апр, 21:38, Illidane  wrote:
>
> > > > > My GridView shows all 100 cells on the screen ( all visible at one
> > > > > moment )
> > > > > and all the animation works fine, and pretty fast ( on all 100
> > > > > elements ),
> > > > > but than begin problems with last cell.
> > > > > Animation not child-view's. Each cell is a imageView with animation on
> > > > > it.
>
> > > > > On 27 апр, 20:43, Streets Of Boston  wrote:
>
> > > > > > It's not buggy. I use the adapters and grid/list-views in my apps 
> &

[android-developers] Re: GridView and BaseAdapter position bug

2009-04-28 Thread Streets Of Boston

I have to defend Romain here.
The gridview and/or listview is just not designed to do this. You're
trying to put a round peg in a square hole.

Maybe the decision to use a GridView for your purposes is not a good
idea, because of its design that does not fit what you need.

If all 100 cells are visible at the same time (then there's no
scrolling needed), why do you need a gridview? Maybe you should
subclass your own view and draw the 100 cells as 100 drawables (which
you can animate) yourself in its onDraw or dispatchDraw method.

On Apr 28, 2:53 pm, Illidane  wrote:
> Ok-ok, I gotcha what you mean.
> But with such position to developers you will never make android lead
> platform.
> Sory, if I speak the truth boldly.
>
> On 28 апр, 19:44, Romain Guy  wrote:
>
>
>
> > No, you are just making assumptions about how it should work. Nowhere
> > does it say that it should work the way you want it to work, that's
> > not how it works and that's not how it will work.
>
> > 2009/4/28 Illidane :
>
> > > To Romain Guy:
> > > Ok, I understood that you think that it's NOT a bug and that you
> > > implement it how you want it be.
> > > But I need to say you, that in such situation is very hard, or
> > > sometimes is impossible to write good, stable, beauty, useful and
> > > competitive apps for Android, not only for me, but for all Android
> > > programmers.
> > > And I think you know that.
>
> > > On 28 апр, 18:53, Romain Guy  wrote:
> > >> I am from the Google team (and I did implement a lot of GridView and
> > >> ListView) and it is NOT a bug. GridView and ListView can call
> > >> getView() out of order and more times than the number of views that
> > >> will fit on screen, depending how the Grid/ListView is measured/laid
> > >> out.
>
> > >> 2009/4/28 yarik...@gmail.com :
>
> > >> > I have exactly same problem. Why do we have 102 values of position
> > >> > when there is only 100 cells displayed on screen?
> > >> > "position is changed like: 0, 0, 1, 2, 3... 99, 0" - what is the cause
> > >> > of that? Can someone from google team answer?
> > >> > That seems to be a bug, very annoying bug. Answer "It's not a bug" is
> > >> > not answer! How do you generate position?
>
> > >> > On Apr 27, 9:40 pm, Illidane  wrote:
> > >> >> There is a way to make GridView without Adapter ( e.g. something
> > >> >> like .addView() method ) ?
>
> > >> >> On 27 апр, 21:38, Illidane  wrote:
>
> > >> >> > My GridView shows all 100 cells on the screen ( all visible at one
> > >> >> > moment )
> > >> >> > and all the animation works fine, and pretty fast ( on all 100
> > >> >> > elements ),
> > >> >> > but than begin problems with last cell.
> > >> >> > Animation not child-view's. Each cell is a imageView with animation 
> > >> >> > on
> > >> >> > it.
>
> > >> >> > On 27 апр, 20:43, Streets Of Boston  wrote:
>
> > >> >> > > It's not buggy. I use the adapters and grid/list-views in my apps 
> > >> >> > > and
> > >> >> > > they work fine. I think they are not designed for your purpose.
>
> > >> >> > > e.g. If your adapter has 100 elements and the grid/list-view only
> > >> >> > > shows about 15 at a time on the screen, the getView is called 
> > >> >> > > about 15
> > >> >> > > times. Sometimes more times, depending whether a little bit (a few
> > >> >> > > pixels) of the top or bottom child-view become visible or not. 
> > >> >> > > Then,
> > >> >> > > when you start scrolling, getView gets called again and again when
> > >> >> > > child-views become visible and others become invisible.
>
> > >> >> > > Also, seriously consider re-using the convertView for your grid- 
> > >> >> > > or
> > >> >> > > list-view. My experience is that it can really slow down your app 
> > >> >> > > if
> > >> >> > > you just return new View instances for each child-view/cell:
> > >> >> > > public ... getView() {
> > >> >> > >   View view = convertView != null ? convertView : 
> > 

[android-developers] Re: Why doesn't w.requestFeature(Window.FEATURE_RIGHT_ICON);work?

2009-04-29 Thread Streets Of Boston

It's a bug. I don't know if it's fixed in Cupcake, but in 1.1 and 1.0
this does not work. The icon will always be on the left.

On Apr 29, 4:39 am, quill  wrote:
> Hi all,
> I just want to set an icon in the right of titlebar, so I use:
>         Window  w = getWindow();
>         w.requestFeature(Window.FEATURE_RIGHT_ICON);
>         setContentView(R.layout.main);
>         w.setFeatureDrawableResource(Window.FEATURE_RIGHT_ICON,
>                         R.drawable.icon);
> but it doesn't work, the icon is still at left. Did I miss something?
> Pls help me, 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
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: GridView and BaseAdapter position bug

2009-04-29 Thread Streets Of Boston

If you have all 100 cells visible at once at all time, the GridView
does not add much functionality (no scrolling necessary), except for
selecting cells.

I'm not familiar with your app, but i think it would be 'easier' than
wrestling with GridView to subclass 'View' (or 'ViewGroup' if you need
additional child-views) and have this sub-class handle the 100 cells
(implement onDraw, dispatchDraw) and draw your cells using Drawables.
This also removes the need of having 100 child-views (1 for each
cells), which could become more problematic for the Cupcake release
(see its note about how it is more finnicky about the depth and width
of view-hierarchies). Instead, you have just one view with 100 small
bitmaps/drawables.

On Apr 29, 3:03 am, Illidane  wrote:
> Extend the GridView or write my own class which will manipulating 100
> cells as drawables?
>
> On 29 апр, 00:27, Streets Of Boston  wrote:
>
>
>
> > I have to defend Romain here.
> > The gridview and/or listview is just not designed to do this. You're
> > trying to put a round peg in a square hole.
>
> > Maybe the decision to use a GridView for your purposes is not a good
> > idea, because of its design that does not fit what you need.
>
> > If all 100 cells are visible at the same time (then there's no
> > scrolling needed), why do you need a gridview? Maybe you should
> > subclass your own view and draw the 100 cells as 100 drawables (which
> > you can animate) yourself in its onDraw or dispatchDraw method.
>
> > On Apr 28, 2:53 pm, Illidane  wrote:
>
> > > Ok-ok, I gotcha what you mean.
> > > But with such position to developers you will never make android lead
> > > platform.
> > > Sory, if I speak the truth boldly.
>
> > > On 28 апр, 19:44, Romain Guy  wrote:
>
> > > > No, you are just making assumptions about how it should work. Nowhere
> > > > does it say that it should work the way you want it to work, that's
> > > > not how it works and that's not how it will work.
>
> > > > 2009/4/28 Illidane :
>
> > > > > To Romain Guy:
> > > > > Ok, I understood that you think that it's NOT a bug and that you
> > > > > implement it how you want it be.
> > > > > But I need to say you, that in such situation is very hard, or
> > > > > sometimes is impossible to write good, stable, beauty, useful and
> > > > > competitive apps for Android, not only for me, but for all Android
> > > > > programmers.
> > > > > And I think you know that.
>
> > > > > On 28 апр, 18:53, Romain Guy  wrote:
> > > > >> I am from the Google team (and I did implement a lot of GridView and
> > > > >> ListView) and it is NOT a bug. GridView and ListView can call
> > > > >> getView() out of order and more times than the number of views that
> > > > >> will fit on screen, depending how the Grid/ListView is measured/laid
> > > > >> out.
>
> > > > >> 2009/4/28 yarik...@gmail.com :
>
> > > > >> > I have exactly same problem. Why do we have 102 values of position
> > > > >> > when there is only 100 cells displayed on screen?
> > > > >> > "position is changed like: 0, 0, 1, 2, 3... 99, 0" - what is the 
> > > > >> > cause
> > > > >> > of that? Can someone from google team answer?
> > > > >> > That seems to be a bug, very annoying bug. Answer "It's not a bug" 
> > > > >> > is
> > > > >> > not answer! How do you generate position?
>
> > > > >> > On Apr 27, 9:40 pm, Illidane  wrote:
> > > > >> >> There is a way to make GridView without Adapter ( e.g. something
> > > > >> >> like .addView() method ) ?
>
> > > > >> >> On 27 апр, 21:38, Illidane  wrote:
>
> > > > >> >> > My GridView shows all 100 cells on the screen ( all visible at 
> > > > >> >> > one
> > > > >> >> > moment )
> > > > >> >> > and all the animation works fine, and pretty fast ( on all 100
> > > > >> >> > elements ),
> > > > >> >> > but than begin problems with last cell.
> > > > >> >> > Animation not child-view's. Each cell is a imageView with 
> > > > >> >> > animation on
> > > > >> >> > it.
>
>

[android-developers] Re: GridView and BaseAdapter position bug

2009-04-29 Thread Streets Of Boston

Good to hear!

I'm curious: what did you do to get around this problem?
(yarik may want to know as well :-))

On Apr 29, 11:13 am, Illidane  wrote:
> No matter.. it's all working now with the GridView, I have fixed that
> bug by the hand.
> Thank you for your help)
>
> On 29 апр, 17:07, Streets Of Boston  wrote:
>
>
>
> > If you have all 100 cells visible at once at all time, the GridView
> > does not add much functionality (no scrolling necessary), except for
> > selecting cells.
>
> > I'm not familiar with your app, but i think it would be 'easier' than
> > wrestling with GridView to subclass 'View' (or 'ViewGroup' if you need
> > additional child-views) and have this sub-class handle the 100 cells
> > (implement onDraw, dispatchDraw) and draw your cells using Drawables.
> > This also removes the need of having 100 child-views (1 for each
> > cells), which could become more problematic for the Cupcake release
> > (see its note about how it is more finnicky about the depth and width
> > of view-hierarchies). Instead, you have just one view with 100 small
> > bitmaps/drawables.
>
> > On Apr 29, 3:03 am, Illidane  wrote:
>
> > > Extend the GridView or write my own class which will manipulating 100
> > > cells as drawables?
>
> > > On 29 апр, 00:27, Streets Of Boston  wrote:
>
> > > > I have to defend Romain here.
> > > > The gridview and/or listview is just not designed to do this. You're
> > > > trying to put a round peg in a square hole.
>
> > > > Maybe the decision to use a GridView for your purposes is not a good
> > > > idea, because of its design that does not fit what you need.
>
> > > > If all 100 cells are visible at the same time (then there's no
> > > > scrolling needed), why do you need a gridview? Maybe you should
> > > > subclass your own view and draw the 100 cells as 100 drawables (which
> > > > you can animate) yourself in its onDraw or dispatchDraw method.
>
> > > > On Apr 28, 2:53 pm, Illidane  wrote:
>
> > > > > Ok-ok, I gotcha what you mean.
> > > > > But with such position to developers you will never make android lead
> > > > > platform.
> > > > > Sory, if I speak the truth boldly.
>
> > > > > On 28 апр, 19:44, Romain Guy  wrote:
>
> > > > > > No, you are just making assumptions about how it should work. 
> > > > > > Nowhere
> > > > > > does it say that it should work the way you want it to work, that's
> > > > > > not how it works and that's not how it will work.
>
> > > > > > 2009/4/28 Illidane :
>
> > > > > > > To Romain Guy:
> > > > > > > Ok, I understood that you think that it's NOT a bug and that you
> > > > > > > implement it how you want it be.
> > > > > > > But I need to say you, that in such situation is very hard, or
> > > > > > > sometimes is impossible to write good, stable, beauty, useful and
> > > > > > > competitive apps for Android, not only for me, but for all Android
> > > > > > > programmers.
> > > > > > > And I think you know that.
>
> > > > > > > On 28 апр, 18:53, Romain Guy  wrote:
> > > > > > >> I am from the Google team (and I did implement a lot of GridView 
> > > > > > >> and
> > > > > > >> ListView) and it is NOT a bug. GridView and ListView can call
> > > > > > >> getView() out of order and more times than the number of views 
> > > > > > >> that
> > > > > > >> will fit on screen, depending how the Grid/ListView is 
> > > > > > >> measured/laid
> > > > > > >> out.
>
> > > > > > >> 2009/4/28 yarik...@gmail.com :
>
> > > > > > >> > I have exactly same problem. Why do we have 102 values of 
> > > > > > >> > position
> > > > > > >> > when there is only 100 cells displayed on screen?
> > > > > > >> > "position is changed like: 0, 0, 1, 2, 3... 99, 0" - what is 
> > > > > > >> > the cause
> > > > > > >> > of that? Can someone from google team answer?
> > > > > > >> > That seems to be a bug, very annoying bug. Answer "It's not a 
> &g

[android-developers] Re: OutOfMemoryError from BitmapFactory

2009-04-30 Thread Streets Of Boston

In my app, i've been dillegently 'unloading' bitmaps when i need
memory.
I clear out as much as I can.

E.g. when a view becomes invisible (onPause) or just before you start
loading a big bitmap:
- do a setImageBitmap(null) (or similar methods, depending on which
class of View you're actually using) on these views
- clear any bitmap cache

I actually implemented a global 'bitmap memory notifier' to any
instance that may be interested in it. Instances can register with
this notifier as a listener. If some part of my code needs to create a
large bitmap, it calls this notifier which causes all listeners to get
notified and they can take action to clear out as much bitmap-memory
as possible (someBitmap.recycle(); someBitmap = null; clean caches;
etc.)

So far, this scheme has served me well. Before i got a lot of OOM-
errors. Now i get a lot less. And, if i still get one, i try to
handle it gracefully.

On Apr 30, 4:00 pm, Ward Willats  wrote:
> At 11:23 AM -0700 4/30/09, fadden wrote:
>
> >It's possible that it didn't actually jump back down.  The event log
> >shows results from all running processes, not just your app, so you
> >may be seeing output from other things mixed in.
>
> Ah, OK. Now I see a steady increase in my limit and allocs from 1.1
> up to about 10 MB when it crashes, and I've got another 3.5 in my
> regular heap -- still less than 16, but ok, -- so this makes sense,
> and I hope this thread is useful to others --> you can "leak" and
> look fine in ddms!
>
> But this means that the bitmaps for my startup animations, say, are
> never getting freed, as are the contents of previous screens. Now,
> none of this stuff is kept in static variables or anything (he said,
> though you can be sure he is going to check this yet again!)
>
> Is there a way to really really make these things get tossed? There
> ain't no recycle() on drawable (or animation I think)just
> bitmaps
>
> >(This is why the python script I posted yesterday shows the pid and 5-
> >char app id on each line.)
>
> I seem to have completely missed this post...
>
> Thanks
>
> -- Ward
--~--~-~--~~~---~--~~
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: OutOfMemoryError from BitmapFactory

2009-04-30 Thread Streets Of Boston

"I assume you mean any of my own bitmap caches..."
Yep, if you have any.

I don't have an issue when my app finishes. Memory seems to get
released quite OK. So far, repeatedly re-starting my app does not seem
to leak any (bitmap) memory.

By any chance, do you have Drawables cached (i.e. referenced through a
static variable, or in a map/collection that is referenced through a
static variable)? Drawables (BitmapDrawables in your case) hold on to
a reference of the activity in which they're used.

I've been bitten by leaking memory before. I try to avoid mutable
static variables in Android as the plague. And, if i really need one,
i make absolutely sure the static variable is either cleaned up
properly (set to null) and/or that it holds no (indirect) references
to activities.

On Apr 30, 4:39 pm, Ward Willats  wrote:
> Thanks for these tips.
>
> At 1:14 PM -0700 4/30/09, Streets Of Boston wrote:
>
> >In my app, i've been dillegently 'unloading' bitmaps when i need
> >memory.
> >- clear any bitmap cache
>
> I assume you mean any of my own bitmap caches...
>
> >So far, this scheme has served me well. Before i got a lot of OOM-
> >errors. Now i get a lot less. And, if i still get one, i try to
> >handle it gracefully.
>
> It still seems like Voodo to me. If I have to manually call
> setImageBitmap(null) it implies (to me) that the image view is not
> being released in the first place, which means the view hierarchy is
> not being released, even though I have called finish(). At the moment
> I am looking for static variables and leaked contexts
>
> -- Ward
--~--~-~--~~~---~--~~
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: Weird bug when saving picture to file system!?

2009-05-01 Thread Streets Of Boston

I had the same problem.

You can fix it yourself (for now), by running the MediaScanner over
the file you just saved.
Get the DATA column of your image-uri. The DATA ("_data") column holds
the physical file-path of your image. Use this file-path in the
MediaScanner (and MediaScannerConnection) to scan your image. When
this is done, you no longer get the exception.


On May 1, 9:48 am, "L'\\tty"  wrote:
> Okay, thank you so much. I am glad to hear that this is a bug which
> going to be fixed :-)
>
> On 1 Mai, 15:43, "admin.androidsl...@googlemail.com"
>
>
>
>  wrote:
> > A few people have come across this. It is a known bug and will be
> > fixed in Cupcake.
>
> > On May 1, 2:33 pm, "L'\\tty"  wrote:
>
> > > I was also wondering how the insertImage() mehtod works. Is there
> > > source code for this method available, so I can write my own method?
>
> > > Best regards- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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 avoid out of memery exception

2009-05-01 Thread Streets Of Boston

You can load full-size pics with restrictions.

I found out, i can load a full-sized pic (3MPixels) in RGB_565 mode.
But trying to load it in ARGB_ fails (OOM exception) and i need to
load it in a smaller size.

Still, in my app i dilligently try to clean up bitmap memory (call
recycle and set references to null) if i really don't need them when i
load a full-sized pic. I clean up any bitmap-caches i have; I call
setImageBitmap(null) (or similar calls) on Views that are not in use;
etc., etc.

And, avoid caching stuff in collections/maps that are referenced by
static variables, especially when caching bitmap in BitmapDrawables.
If you do, however, be sure to clean out these 'global' variables/
structures when you're done... if not, you may get OOM after re-
starting your app a few times.


On May 1, 9:46 am, "L'\\tty"  wrote:
> Hi all!
>
> As mentioned in an earlier post, I am working on a image processing
> application for android. I encountered an issue regarding the memory
> contingent of the VMware.
>
> In other posts I read that it is not possible to import pictures in
> full size, they are automatically scaled to the display dimensions,
> right?
>
> If I am applying filters to a picture and I repeat this procedure for
> more than one pictures the VMware runs out of memory. Is there a
> chance of avoiding this problem? Can I free some ressources manually
> or can I change something in architecture to avoid my application from
> crashing?
>
> Regards, Florian
--~--~-~--~~~---~--~~
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: Do I need a dev handset, or can I develop using a standard G1 from T-Mobile?

2009-05-03 Thread Streets Of Boston

Hi Robert,

I'm developing my apps on my retail G1. I don't have a dev-phone.

The advantage of having a dev-phone is that you can flash it with the
latest SDK (1.5/CupCake) and try your apps out on a real device. With
my retail G1, i cannot load 1.5 on it. But, for me, that's not a
biggie. I can wait a little while until T-mobile pushes SDK1.5 to my
phone. In the mean time, i'm still developing for 1.1.

In short, you can develop full blown apps and upload them to the
Android Market. The only thing you can not do (yet) is properly test
them on a real device for SDK1.5.

On May 1, 12:09 pm, roschler  wrote:
> Hello everyone,
>
> I found out about the developer's handset after I already bought a G1
> with a 2 year contract with T-Mobile (which I got about a week ago).
> Do I have to shell out another $399 for the developer's unlocked
> device which accepts unsigned code? Or can I get by with a locked G1
> which only accepts signed apps?
>
> I know I'll have to wait for the formal release of any SDK if I don't
> have a dev handset, and be unable to get the preview versions
> available to developers, but right now I'd like to avoid the expense
> if I could.  So can I go ahead and develop full blown apps and
> possibly even distribute them through the app store with my locked G1?
>
> Thanks,
> Robert
--~--~-~--~~~---~--~~
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: Handling key events in a paused Activity

2009-05-05 Thread Streets Of Boston

I really hope that this is *not* possible.
A background application that steals key-strokes is not a good idea.

I won't doubt that your application only has good itentions, but the
idea that i could be downloading a key-stroke sniffer is not very
appealing. I'd rather not have my passwords stolen.

Taisa,
Can you tell us *what* the functionality/task is that you try to
accomplish (not *how*)?
Maybe you can accomplish the same without the need to receive key-
stroke events.


On May 5, 12:53 pm, Taísa Cristina  wrote:
> I don't want to handle end call or home keys. I just want to handle another
> key, such as space bar, while my Activity is in background.
>
> Taísa Cristina Costa dos Santos
> Computer Engineer
> Brazil, SP
> 55 19 8152-7453
>
>
>
> On Tue, May 5, 2009 at 1:45 PM, Dianne Hackborn  wrote:
> > No, you can't do this.  The home and end call keys are trapped by the
> > system before being delivered to the application, and handled by itself.
>
> > On Tue, May 5, 2009 at 5:51 AM, Taísa Cristina 
> > wrote:
>
> >> My application behavior is similar to voice call, but I need also to
> >> handle key events. My application is still running in background and the
> >> activity is paused. Is there a way to receive key events in such situation?
> >> When the call screen is paused, it receives "end call" key event. Can I
> >> receive a specific key event in a similar situation? Is there a way to
> >> register my activity (or my application) for that?
>
> >> Taísa Cristina Costa dos Santos
> >> Computer Engineer
> >> Brazil, SP
> >> 55 19 8152-7453
>
> >> On Tue, May 5, 2009 at 8:02 AM, ellipsoidmob...@googlemail.com <
> >> ellipsoidmob...@googlemail.com> wrote:
>
> >>> If what you want is to have a notification that the user can swipe
> >>> down and click to go back to your application, then you don't really
> >>> need to be handling key events whilst your activity is paused. What
> >>> you could do is create a service which displays the notification, and
> >>> then use an intent to launch your activity when the notification is
> >>> clicked.
>
> >>> BUT - I'm not sure that this is good usability design. If the user has
> >>> navigated away from your activity and if you don't need to do any
> >>> continual background processing, then you probably shouldn't show
> >>> anything in the notification panel. The user can always get back to
> >>> your app from the homescreen or via a long press on the home button.
>
> > --
> > 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.- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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: Playing shoutcast mp3 stream in background crashes in 1.5

2009-05-05 Thread Streets Of Boston

I see you already tried to put it in a service.

How do you stop/start this service?
If your activity just binds to the service, the service will stop when
the activity goes away. To fix this, do a 'Context.startService' as
well. This will cause your service to stay running in the background,
even if your main activity goes away. Only with a 'stopService' you
can kill your service.
See more info here:
http://developer.android.com/reference/android/content/Context.html#startService(android.content.Intent)

If you are already calling startService, then i don't know what may be
wrong...

On May 4, 6:16 pm, "ogi.andr...@gmail.com" 
wrote:
> I've successfully played shoutcast mp3 streams while the application
> is hidden (no activity showing), simply by keeping a static pointer to
> the playing thread (http://developer.android.com/guide/appendix/faq/
> framework.html#3). After updating to 1.5 it crashes almost instantly
> after destroying the activity, and brings AudioTrack to unusable
> state. There's been a change in AudioTrack.cpp since 1.1, claiming to
> fix the "// FIXME: Wake up audioflinger" line in obtainBuffer(..).
> That made me put the play thread into a Service to try if it works,
> but it holds a little longer and crashes the same way. In 1.1 it
> worked nicely, for hours, under heavy loaded cpu, memory and network.
> Can anybody help figuring that 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
-~--~~~~--~~--~--~---



[android-developers] Re: onDraw() help

2009-05-06 Thread Streets Of Boston

Nope.

Try this.
-Create a mutable bitmap the size of the screen. Save this bitmap as a
variable of your instance.
-Create a Canvas from this bitmap  (i think you can 'cache' it, save
this canvas as a variable of your instance).
-Draw your touches into this canvas.

Then in the 'onDraw(Canvas screenCanvas)' draw the mutable bitmap into
the screenCanvas.



On May 5, 3:35 pm, Moons  wrote:
> When you call View.invalidate(), your View refresh itself, wich means
> that all your previous draws are erased.
>
> On May 5, 8:41 am, Sukitha Udugamasooriya  wrote:
>
>
>
> > Hi all,
>
> > I'm relatively new to Android. I want to draw strokes on my screen when the
> > user touches. Next stroke should be drawn from the end point of the previous
> > stroke.
> > This is my code. What happens here is just only the current stroke is drawn.
> > Previous strokes are vanished? What is wrong here? Please help..
>
> > package src.test;
>
> > import android.app.Activity;
> > import android.content.Context;
> > import android.graphics.Bitmap;
> > import android.graphics.Canvas;
> > import android.graphics.Color;
> > import android.graphics.Paint;
> > import android.os.Bundle;
> > import android.view.MotionEvent;
> > import android.view.View;
> > import android.view.View.OnTouchListener;
>
> > public class ActDraw extends Activity implements OnTouchListener {
>
> >     float x = 200;
> >     float y = 200;
> >     float x1 = 10;
> >     float y1 = 45;
> >     float prvx = 150;
> >     float prvy = 150;
> >     MyView m;
>
> >     @Override
> >     public void onCreate(Bundle savedInstanceState) {
> >         super.onCreate(savedInstanceState);
>
> >         m = new MyView(this);
> >         m.setOnTouchListener(this);
> >         setContentView(m);
>
> >     }
> >     public boolean onTouch(View v, MotionEvent event) {
> >         switch (event.getAction()) {
> >         case MotionEvent.ACTION_DOWN: {
> >             prvx = x;
> >             prvy = y;
> >             x = event.getX();
> >             y = event.getY();
> >              m.invalidate();
> >         }
> >         }
> >         return false;
> >     }
>
> >     class MyView extends View {
> >         Paint p = new Paint();
> >         Bitmap bm;
> >         int i;
>
> >         public MyView(Context context) {
> >             super(context);
>
> >         }
>
> >         @Override
> >         protected void onDraw(Canvas canvas) {
> >             super.onDraw(canvas);
> >             p.setColor(Color.GREEN);
> >             p.setStrokeWidth(4);
> >             canvas.drawLine(prvx, prvy, x, y, p);
> >         }
> >     }
>
> > }- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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: onDraw() help

2009-05-06 Thread Streets Of Boston

Nope.

Try this.
-Create a mutable bitmap the size of the screen. Save this bitmap as
a
variable of your instance.
-Create a Canvas from this bitmap  (i think you can 'cache' it, save
this canvas as a variable of your instance).
-Draw your touches into this canvas.


Then in the 'onDraw(Canvas screenCanvas)' draw the mutable bitmap
into
the screenCanvas.

On May 6, 6:24 am, Sukitha Udugamasooriya  wrote:
> Is there a way to save the canvas object?
--~--~-~--~~~---~--~~
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: Alternatives to Android Market

2009-05-06 Thread Streets Of Boston

Handango.com
MobiReach.com (mobihand.com)
slideme.com

and a bunch of others :)

On May 6, 10:51 pm, Jose de Paula Eufrasio Junior
 wrote:
> I know that this list's objective is not to talk about the Market, but if I
> need a developer's POV...
> I just now discovered I can't even signup on the Market being from Brazil,
> so what other alternative I have to distribute my software? It's free/GPL
> software so I don't even care about payment method, I just want my software
> to be used and seen. Aside from publishing it on my blog page and tweeting
> about it, of course.
>
> Thanks for any help.
>
> --
> José de Paula Eufrásio Júnior (coredump)
> MCSO, GRC Professionalhttp://core.eti.br
--~--~-~--~~~---~--~~
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: Weird bug when saving picture to file system!?

2009-05-06 Thread Streets Of Boston

You have to wait until the mediascanner posts a callback when you it
is done.
I wrote a wrapper around this behavior, which you can call by this
example:

  // msListener's 'ready(...)' method is called when the imgUri has
been scanned completely.
  MediaScannerNotifier.run(getApplicationContext(), new Handler(),
imgUri, msListener);

===
public class MediaScannerNotifier implements
MediaScannerConnectionClient {
private Context mContext;
private Handler mHandler;
private MediaScannerConnection mConnection;
private String mPath;
private String mMimeType;
private MediaScannerNotifierListener mCallback;

public interface MediaScannerNotifierListener {
public void ready(String path, Uri uri);
}

public static MediaScannerNotifier run(Context context, Handler
handler, Uri imgUri, MediaScannerNotifierListener callback) {
android.database.Cursor cur = null;
try {
cur  = context.getContentResolver().query(  imgUri, 
new String[]
{ MediaStore.Images.ImageColumns.DATA },

null, null, null);
String filePath = null;
if (cur != null && cur.moveToNext()) {
filePath = cur.getString(0);
}
if (filePath != null) {
return new MediaScannerNotifier(context, 
handler, filePath, "image/
jpeg", callback);
}
} catch (Exception e) {
// TODO show error message.
e.printStackTrace();
}
finally {
if (cur != null) {
cur.close();
}
}
return null;
}

private MediaScannerNotifier(Context context, Handler handler,
String path, String mimeType, MediaScannerNotifierListener callback)
{
mContext = context;
mPath = path;
mMimeType = mimeType;
mConnection = new MediaScannerConnection(mContext, this);
mConnection.connect();
mHandler = handler;
mCallback = callback;
}


public void onMediaScannerConnected() {
mConnection.scanFile(mPath, mMimeType);
}


public void onScanCompleted(final String path, final Uri uri) {
try {
if (mCallback != null) {
mHandler.post(new Runnable() {
public void run() {
mCallback.ready(path, uri);
}
});
}
}
finally {
mConnection.disconnect();
mContext = null;
}
}
}
===

On May 6, 6:11 pm, "L'\\tty"  wrote:
> Thanx for the hint! Could you possibly be so kind to post me the code
> for scanning a file manually. I tried it but anyhow, I get an
> exception because it seems that I am not connected to the Media
> Scanner service although I called the connect() method.
--~--~-~--~~~---~--~~
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: Urgent! can't update apps in market. No error message

2009-05-07 Thread Streets Of Boston

Developers need to backup their key-stores (and save their passwords
to it) to prevent the exact problems you have right now.

If one could change the signature of an app with a new key and the
Market would allow the app with this different signature to be
uploaded, people could hijack your app really easily.
I don't think it would too hard to figure out the package name of your
app, then create my own malicious app with the same package name, sign
it and upload it. This would really tick off your customers :)

But, right now, it sucks that you can't do it and will loose your
ratings/standings.

Hopefully, in the future, Google may offer a way to sign your app with
a different key. Maybe after a developer has verified him/herself to
be the actual owner/developer, this restriction could be lifted
briefly to give the developer a chance to upload the new version with
a different signature.


On May 7, 3:23 pm, android app  wrote:
> However, on the device, you can uninstall the previous app, and
> install the new updated app signed with a different private key (or
> keystore file).
>
> The problem is with the uploading update in the Android Market.  There
> must be a way to allow the developer to change the private key for
> published applications for many reasons.  The developer may lost the
> keystore file due to a reinstallation of the comptuter.  The private
> key may be revealed to the public and the developer should have a way
> to indicate the old key is invalid in the market.
>
> Still needs help URGENTLY!  Considering my customers !!!
>
> Thanks
>
> On May 7, 2:05 pm, Marco Nelissen  wrote:
>
>
>
> > On Thu, May 7, 2009 at 8:36 AM, android app  wrote:
>
> > > I uploaded the new updates to the application in the market.  There
> > > was no error message shown. It seemed that the uploading was
> > > successful.  However, the version name and the app itself were still
> > > the old version. Please help!!!
>
> > > FYI:  I lost the original private key or the keystore file.  I
> > > generated a new keystore file to sign the app.  I also met the minSDK
> > > problem and solved it by set the minSDKversion in the manifest file.
>
> > > There must be a way to update the app.   I don't want to upload the
> > > app as an new application since there is a large base of existing
> > > customers.
>
> > If you signed your app with a different key, then it's not possible to
> > upgrade previous versions to the new version.- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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: nullifying imageview src

2009-05-08 Thread Streets Of Boston

thrownCardsImgs[thrownCardIndex].setImageBitmap(null)
this will clear the image from your ImageView (card).

On May 8, 1:33 pm, Sheepz  wrote:
> can you elaborate on that?
>
> On Apr 7, 6:51 pm, Streets Of Boston  wrote:
>
>
>
> > Try to do setImageBitmap(null) instead.
>
> > On Apr 7, 6:10 pm, Sheepz  wrote:
>
> > > anyone? any ideas? please?!
>
> > > On Apr 4, 12:34 pm, Sheepz  wrote:
>
> > > > Hi all, i'm making a little card game in order to learn the more
> > > > interesting stuff of the UI and I have a question:
> > > > i want to show 5 cards on the table, for that i have made 5 imageviews
> > > > in the xml:
> > > >          > > >         android:id="@+id/cardsThrown"
> > > >         android:layout_height="wrap_content"
> > > >         android:layout_width="wrap_content"
>
> > > >         android:layout_toRightOf="@+id/deck">
>
> > > >                          > > >                                 android:layout_width="72px"
> > > >                                         android:layout_height="96px"
>
> > > >                                 android:id="@+id/card5"
> > > >                                 android:layout_x="0px"
> > > >                                 android:layout_y="0px"
> > > >                         />
> > > >                          > > >                                 android:layout_width="72px"
> > > >                                         android:layout_height="96px"
>
> > > >                                 android:id="@+id/card4"
> > > >                                 android:layout_x="12px"
> > > >                                 android:layout_y="0px"
> > > >                         />
> > > >                          > > >                                 android:layout_width="72px"
> > > >                                         android:layout_height="96px"
> > > >                                 android:id="@+id/card3"
> > > >                                 android:layout_x="24px"
> > > >                                 android:layout_y="0px"
> > > >                         />
> > > >                          > > >                                 android:layout_width="72px"
> > > >                                         android:layout_height="96px"
>
> > > >                                 android:id="@+id/card2"
> > > >                                 android:layout_x="36px"
> > > >                                 android:layout_y="0px"
> > > >                         />
> > > >                          > > >                                 android:layout_width="72px"
> > > >                                         android:layout_height="96px"
>
> > > >                                 android:id="@+id/card1"
> > > >                                 android:layout_x="48px"
> > > >                                 android:layout_y="0px"
> > > >                         />
>
> > > >         
> > > >         
>
> > > > as you might notice here, i'm doing them with an overlap since the uer
> > > > should be able to pick up the last card and should therefore see it,
> > > > but the other 4 are just so he'll know what was thrown lastly.
> > > > my problem is:
> > > > in the begining the imageviews have no src, but once i give them an
> > > > image source (using code:
> > > >                         thrownCardsImgs[thrownCardIndex].
> > > >                                 
> > > > setImageResource(cards[thrownCardIndex].getImageResourceId());
> > > > ) i dont know how i can undo it - i can't set the imageResourceId to
> > > > null since it is an int type so is there something like -1 or some
> > > > constant value that means null?
> > > > P.s., i know about visibility, i'd rather not use it here unless i
> > > > really have to, since it'll require a bunch or refactoring that i
> > > > prefer to avoid...
> > > > Thanks,
> > > > Sh- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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: OutOfMemoryError when changing screen orientation

2009-05-08 Thread Streets Of Boston

Your image is probably too big.
By setting a 2048x1536 pixels image, you will eat up about 6MByte of
memory right there.
The memory of the large bitmap may not be cleaned up quick enough when
chaning orientation.

To get around this issue, scale the bitmap yourself:
Read in the full-size bitmap by getting the inputstream from the
imageUri (getContentResolver()), use the inputstream and BitmapFactory
to get a Bitmap (be sure to set inSampleSize to something larger than
1 and the type to RGB_565 to conserve memory). Then from this Bitmap,
create a new bitmap that is scaled to the size of your imgUpload view.

On May 8, 11:43 am, "geopicmob...@googlemail.com"
 wrote:
> Hi,
>
> I get an OutOfMemoryError every time i change the screen orientation
> and I am having a hard time finding the mistake...
>
> The Activitie's view consists of an ImageView, two Buttons and a
> Spinner. I don't have static variables and can't imagine where i could
> leak a context.
>
> Most of the times, the exception is thrown at setContentView
> (R.layout.upload);
> sometimes it goes fine until imgUpload.setImageURI(imageURI);
>
> The images i am displaying are form the G1's camera, so about 500kb
> and 2048x1536pixels
>
> Here is some code:
> ---­--
>         private ImageView imgUpload;
>         private Spinner spnCollections;
>         private Button btnEditMetadata;
>         private Button btnUpload;
>         private Uri imageURI;
>
>         @Override
>         public void onCreate(Bundle savedInstanceState) {
>                 super.onCreate(savedInstanceState);
>                 setContentView(R.layout.upload);
>
>                 // Get View References
>                 imgUpload = (ImageView) findViewById(R.id.imgUpload);
>                 spnCollections = (Spinner)findViewById(R.id.spnCollections);
>                 btnEditMetadata = (Button) findViewById(R.id.btnEditMetadata);
>                 btnUpload = (Button)findViewById(R.id.btnUpload);
>
>                 // Get Image from ACTION_SEND Intent
>                 Intent intent = getIntent();
>                 if (intent.getAction() != null && intent.getAction().equals
> (Intent.ACTION_SEND)) {
>                         Bundle extras = intent.getExtras();
>                         imageURI = 
> (Uri)extras.getParcelable(Intent.EXTRA_STREAM);
>                         imgUpload.setImageURI(imageURI);
>                 }
> ...
> ---­--
--~--~-~--~~~---~--~~
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] Crash of emulator.exe on Windows Vista Ultimagte 64Bit

2009-05-08 Thread Streets Of Boston

Hi,

I'm developing under Eclipse 3.3, Windows Vista 64bit.

It took me quite a while, but finally i got my projects to build on
the new 1.5SDK.
I created two devices, one for target 1.1 and the other for 1.5.

When i run my projects in the emulator, it all works well for the 1.1.
device. However, for the device with the 1.5 target, my emulator
crashes hard  (windows is reporting a crash and reports it to
microsoft).

Is there an incompatibility with Windows Vista 64 bit?

--~--~-~--~~~---~--~~
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] Just installed SDK1.5: I cannot open DDMS perspective properly

2009-05-08 Thread Streets Of Boston

I'm running under Windows Vista 64bit and after installing SDK 1.5, i
no longer can use the DDMS perspective.
All views that are tried to get opened fail (LogCat, Heap, Threads,
etc.).
--~--~-~--~~~---~--~~
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] com.android.ide.eclipse.ddms.views.LogCatView problems

2009-05-08 Thread Streets Of Boston

I just installed the SDK1.5 and i get this message when i try to look
at my logcat:
Problems occurred restoring perspective.
  Could not find view: com.android.ide.eclipse.ddms.views.LogCatView

I use Eclipse 3.3 under Windows Vista 64bit.
Is this a known issue?

--~--~-~--~~~---~--~~
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: Crash of emulator.exe on Windows Vista Ultimagte 64Bit

2009-05-08 Thread Streets Of Boston

I got it working!!

It crashed after i started the emulator *from within Eclipse*. The
command-line window comes up really briefly and almost immediately it
crashes. I tried it again, and this time, an error message was shown
in Eclipse' Console, after Windows closed it forcefully

Then I started it using the command-line (emulator @avd_name) and all
worked well, even when i then started my app later from within Eclipse
('Run As --> Android Application').

Then i tried launching it from within Eclipse again, and now it works.
It seems that starting it with the command-line once fixed the
problem.
For your info, this was that error message:

[2009-05-08 23:13:46 - Emulator]
[2009-05-08 23:13:46 - Emulator] This application has requested the
Runtime to terminate it in an unusual way.
[2009-05-08 23:13:46 - Emulator] Please contact the application's
support team for more information.
[2009-05-08 23:13:49 - Emulator] qemu: fatal: Trying to execute code
outside RAM or ROM at 0x89d32be0
[2009-05-08 23:13:49 - Emulator]
[2009-05-08 23:13:49 - Emulator] R00=0001 R01=2d02ef8d
R02=03b6e20c R03=
[2009-05-08 23:13:49 - Emulator] R04=806567cb R05=196c3671
R06= R07=05a1
[2009-05-08 23:13:49 - Emulator] R08=0100 R09=
R10=1000 R11=6e6b06e7
[2009-05-08 23:13:49 - Emulator] R12=0100 R13=fed41b76
R14=00152dd8 R15=89d32be0
[2009-05-08 23:13:49 - Emulator] PSR=61d3 -ZC- A svc32



On May 8, 11:07 pm, Raphael  wrote:
> Please run the emulator manually with your avd with debugging
> information and post the result here:
>
>   emulator -debug all @your_avd_name
>
> Thanks,
> R/
>
> On Fri, May 8, 2009 at 6:35 PM, Streets Of Boston
>
>
>
>  wrote:
>
> > Hi,
>
> > I'm developing under Eclipse 3.3, Windows Vista 64bit.
>
> > It took me quite a while, but finally i got my projects to build on
> > the new 1.5SDK.
> > I created two devices, one for target 1.1 and the other for 1.5.
>
> > When i run my projects in the emulator, it all works well for the 1.1.
> > device. However, for the device with the 1.5 target, my emulator
> > crashes hard  (windows is reporting a crash and reports it to
> > microsoft).
>
> > Is there an incompatibility with Windows Vista 64 bit?- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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: The app got crashed on SDK 1.5 which is working fine on SDK 1.0

2009-05-11 Thread Streets Of Boston

I'm not absolutely sure, but i remember reading that sdk1.5 is much
much more conservative on the allowable depth and width of your
screen's layout.

If you go very deep (from parent-views to child-views) or very wide
(many 'sibling' views), sdk1.1 had a bit of a hard time, but could
handle it. However, sdk1.5 is much more finnicky and may crash if your
view-hierarchy is too deep or wide.

Based on your stack-trace, i count at least 13 'drawChild' calls. This
could be the problem. Try to lessen the number of views in your
layout.

On May 11, 9:04 am, manoj  wrote:
> Hi friends,
>
> I have developed an application which has tabActivity using SDK 1.0
> r2.
>
> 1st Tab contains List view. -> the list contains some images
>
> 2nd and 3rd contains some webviews.
>
> The app works fine on G1 mobile.
>
> Today I downloaded SDK 1.5 and ran the same app on SDK 1.5.
>
> The app got crashed when I scroll down/up the list items very fast
> (fling)
>
> I/dalvikvm( 1006): Stack overflow, expanding (0x41048200 to
> 0x41048000)
> I/dalvikvm( 1006): Shrank stack (to 0x41048200, curFrame is
> 0x41049cd8)
> D/AndroidRuntime( 1006): Shutting down VM
> W/dalvikvm( 1006): threadid=3: thread exiting with uncaught exception
> (group=0x4000fe70)
> E/AndroidRuntime( 1006): Uncaught handler: thread main exiting due to
> uncaught exception
> E/AndroidRuntime( 1006): java.lang.StackOverflowError
> E/AndroidRuntime( 1006):        at android.text.Styled.measureText
> (Styled.java:371)
> E/AndroidRuntime( 1006):        at android.text.Layout.measureText
> (Layout.java:1600)
> E/AndroidRuntime( 1006):        at android.text.Layout.getLineMax
> (Layout.java:654)
> E/AndroidRuntime( 1006):        at android.text.Layout.draw(Layout.java:310)
> E/AndroidRuntime( 1006):        at android.text.BoringLayout.draw
> (BoringLayout.java:356)
> E/AndroidRuntime( 1006):        at android.widget.TextView.onDraw
> (TextView.java:3921)
> E/AndroidRuntime( 1006):        at android.view.View.draw(View.java:5838)
> E/AndroidRuntime( 1006):        at android.view.ViewGroup.drawChild
> (ViewGroup.java:1486)
> E/AndroidRuntime( 1006):        at android.view.ViewGroup.dispatchDraw
> (ViewGroup.java:1228)
> E/AndroidRuntime( 1006):        at android.view.View.buildDrawingCache
> (View.java:5615)
> E/AndroidRuntime( 1006):        at android.view.View.getDrawingCache
> (View.java:5458)
> E/AndroidRuntime( 1006):        at android.view.ViewGroup.drawChild
> (ViewGroup.java:1422)
> E/AndroidRuntime( 1006):        at android.view.ViewGroup.dispatchDraw
> (ViewGroup.java:1228)
> E/AndroidRuntime( 1006):        at android.widget.AbsListView.dispatchDraw
> (AbsListView.java:1319)
> E/AndroidRuntime( 1006):        at android.widget.ListView.dispatchDraw
> (ListView.java:2820)
> E/AndroidRuntime( 1006):        at android.view.View.draw(View.java:5944)
> E/AndroidRuntime( 1006):        at android.widget.AbsListView.draw
> (AbsListView.java:2121)
> E/AndroidRuntime( 1006):        at android.view.ViewGroup.drawChild
> (ViewGroup.java:1486)
> E/AndroidRuntime( 1006):        at android.view.ViewGroup.dispatchDraw
> (ViewGroup.java:1228)
> E/AndroidRuntime( 1006):        at android.view.ViewGroup.drawChild
> (ViewGroup.java:1484)
> E/AndroidRuntime( 1006):        at android.view.ViewGroup.dispatchDraw
> (ViewGroup.java:1228)
> E/AndroidRuntime( 1006):        at android.view.View.draw(View.java:5944)
> E/AndroidRuntime( 1006):        at android.widget.FrameLayout.draw
> (FrameLayout.java:352)
> E/AndroidRuntime( 1006):        at android.view.ViewGroup.drawChild
> (ViewGroup.java:1486)
> E/AndroidRuntime( 1006):        at android.view.ViewGroup.dispatchDraw
> (ViewGroup.java:1228)
> E/AndroidRuntime( 1006):        at android.view.ViewGroup.drawChild
> (ViewGroup.java:1484)
> E/AndroidRuntime( 1006):        at android.view.ViewGroup.dispatchDraw
> (ViewGroup.java:1228)
> E/AndroidRuntime( 1006):        at android.view.View.draw(View.java:5841)
> E/AndroidRuntime( 1006):        at android.widget.FrameLayout.draw
> (FrameLayout.java:352)
> E/AndroidRuntime( 1006):        at android.view.ViewGroup.drawChild
> (ViewGroup.java:1486)
> E/AndroidRuntime( 1006):        at android.view.ViewGroup.dispatchDraw
> (ViewGroup.java:1228)
> E/AndroidRuntime( 1006):        at android.view.ViewGroup.drawChild
> (ViewGroup.java:1484)
> E/AndroidRuntime( 1006):        at android.view.ViewGroup.dispatchDraw
> (ViewGroup.java:1228)
> E/AndroidRuntime( 1006):        at android.view.ViewGroup.drawChild
> (ViewGroup.java:1484)
> E/AndroidRuntime( 1006):        at android.view.ViewGroup.dispatchDraw
> (ViewGroup.java:1228)
> E/AndroidRuntime( 1006):        at android.view.ViewGroup.drawChild
> (ViewGroup.java:1484)
> E/AndroidRuntime( 1006):        at android.view.ViewGroup.dispatchDraw
> (ViewGroup.java:1228)
> E/AndroidRuntime( 1006):        at android.view.ViewGroup.drawChild
> (ViewGroup.java:1484)
> E/AndroidRuntime( 1006):        at android.view.ViewGroup.dispatchDraw
> (ViewGroup.java:1228)
> E/And

[android-developers] Question: How to guestimate the available bitmap memory on a device

2009-05-13 Thread Streets Of Boston

Hi,

Part of my application allows the user to color-correct images. When i
open an image for editing, i'd like to know what, more or less, the
available bitmap memory is for the device that the app is running on.

For the G1, the limit is use is about 6MByte (about a full-size image
that can be taken by the phone (3MPixels) with 16 bit color ==>
6MByte). If i try to open anything larger, i often get an out-of-
memory exception. Limiting it to 6MByte reduces these OOM exceptions
by a great deal. However, i can see future devices having more memory
available because (as one of the reasons) they can take larger pics
(e.g. 5MPixel or something).

Right now, my app just uses a hard-coded limit of 6*1024*1024. Is
there a way to make this variable, to future-proof this by examing the
device my app is running on. If so, how?

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
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Question: How to guestimate the available bitmap memory on a device

2009-05-13 Thread Streets Of Boston

Hi Dianne,

Thanks for your response.

I know that there is no real thing like bitmap memory.
But i also know that when i open a 12MByte bitmap (3MPixel, ARGB_)
i *always* get a OOM error. Even if i have more than 12MByte left to
work with, according to the heap dump.

I'm asking if there is a way to 'guesstimate' the amount available
that is left for opening (creating) bitmaps.

On May 13, 2:07 pm, Dianne Hackborn  wrote:
> There is no such thing as "bitmap memory" really.  Bitmap allocations are
> accounted against your app's overall memory, which is limited to 16MB.
>
> On Wed, May 13, 2009 at 10:35 AM, Streets Of Boston 
>
>
>
>
> > wrote:
>
> > Hi,
>
> > Part of my application allows the user to color-correct images. When i
> > open an image for editing, i'd like to know what, more or less, the
> > available bitmap memory is for the device that the app is running on.
>
> > For the G1, the limit is use is about 6MByte (about a full-size image
> > that can be taken by the phone (3MPixels) with 16 bit color ==>
> > 6MByte). If i try to open anything larger, i often get an out-of-
> > memory exception. Limiting it to 6MByte reduces these OOM exceptions
> > by a great deal. However, i can see future devices having more memory
> > available because (as one of the reasons) they can take larger pics
> > (e.g. 5MPixel or something).
>
> > Right now, my app just uses a hard-coded limit of 6*1024*1024. Is
> > there a way to make this variable, to future-proof this by examing the
> > device my app is running on. If so, how?
>
> > Thanks!
>
> --
> 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.- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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: Question: How to guestimate the available bitmap memory on a device

2009-05-13 Thread Streets Of Boston

According to the heap 'browser' that comes with the ADT plugin in
Eclipse.
My app is using less than 4MByte (it's using about 2MByte) but it
won't allow me to create a bitmap of 12MByte.

About max heap usage: Is and will the heap limit be set to 16MByte on
all devices (i.e. on current devices such as G1, Magic and also on
possible future android devices)?

On May 13, 2:37 pm, Dianne Hackborn  wrote:
> According to what heap dump?  I am pretty sure that the code just checks to
> see if there is that amount of space left in the java heap, and if not fail
> (otherwise allocate it and tell the VM to account for that as part of its
> heap usage).
>
> On Wed, May 13, 2009 at 11:24 AM, Streets Of Boston 
>
>
>
>
> > wrote:
>
> > Hi Dianne,
>
> > Thanks for your response.
>
> > I know that there is no real thing like bitmap memory.
> > But i also know that when i open a 12MByte bitmap (3MPixel, ARGB_)
> > i *always* get a OOM error. Even if i have more than 12MByte left to
> > work with, according to the heap dump.
>
> > I'm asking if there is a way to 'guesstimate' the amount available
> > that is left for opening (creating) bitmaps.
>
> > On May 13, 2:07 pm, Dianne Hackborn  wrote:
> > > There is no such thing as "bitmap memory" really.  Bitmap allocations are
> > > accounted against your app's overall memory, which is limited to 16MB.
>
> > > On Wed, May 13, 2009 at 10:35 AM, Streets Of Boston <
> > flyingdutc...@gmail.com
>
> > > > wrote:
>
> > > > Hi,
>
> > > > Part of my application allows the user to color-correct images. When i
> > > > open an image for editing, i'd like to know what, more or less, the
> > > > available bitmap memory is for the device that the app is running on.
>
> > > > For the G1, the limit is use is about 6MByte (about a full-size image
> > > > that can be taken by the phone (3MPixels) with 16 bit color ==>
> > > > 6MByte). If i try to open anything larger, i often get an out-of-
> > > > memory exception. Limiting it to 6MByte reduces these OOM exceptions
> > > > by a great deal. However, i can see future devices having more memory
> > > > available because (as one of the reasons) they can take larger pics
> > > > (e.g. 5MPixel or something).
>
> > > > Right now, my app just uses a hard-coded limit of 6*1024*1024. Is
> > > > there a way to make this variable, to future-proof this by examing the
> > > > device my app is running on. If so, how?
>
> > > > Thanks!
>
> > > --
> > > 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.- Hide quoted text -
>
> > > - Show quoted text -
>
> --
> 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.- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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: Eclipse : Unknown error: SDK is not loaded yet. * upgrade failed *

2009-05-14 Thread Streets Of Boston

I had similar issues.

I have no idea exactly how i fixed it. At some point i noticed i
forgot to set the target for each project i have (target is 1.1 or
1.5) and after setting this, and after re-starting Eclipse, refreshing
and rebuilding, the issue was resolved. I don't know if this was *the*
fix, but at least part of it :-)


On May 13, 11:35 pm, chrispix  wrote:
> Not sure what is going on. Running Windows Vista x64.
> Not had really any problems with eclipse. I had to upgrade to 1.5 and
> when I did that I got all kinds of install errors. So I said 'f-it'. I
> decided to start over and downloaded the 1.5SDK, downloaded the
> Eclipse for Java, Not Eclipse classic (someone said that was an
> issue). So now I have Eclipse for Java (or something to that name).
> Each time I try to compile it says 'Unknown Error: SDK is not loaded
> yet'
>
> Can someone assist me please? 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
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: gravity vs. layout_gravity? I'm lost.

2009-05-14 Thread Streets Of Boston

As a side-note: I think the TextView's (and EditText) 'gravity' should
have been called 'alignment'. It's called that way in most UI's.  :=)


On May 14, 10:54 am, Romain Guy  wrote:
> Hi,
>
> Well, first of all RelativeLayout ignores layout_gravity. Then you
> need to know that gravity means "apply gravity to the content of this
> view" whereas layout_gravity means "apply gravity to this view within
> its parent." So on a TextView, gravity will align the text within the
> bounds of the TextView whereas layout_gravity will align the TextView
> within the bounds of its parent.
>
>
>
>
>
> On Thu, May 14, 2009 at 5:31 AM, Matthias  wrote:
>
> > Hi,
>
> > I think I've lost enough hair over this, so now I'll ask. What is the
> > difference between those attributes? According to the documentation of
> > R.attr, there isn't any difference (doc text is exactly the same, see
> >http://developer.android.com/reference/android/R.attr.html), but
> > apparently, that's simply not true. For example, the gravity attribute
> > can be used on EditText to set the text alignment (e.g. left, center,
> > right).
>
> > I often found that neither of them work to align a view at all. For
> > example, I need to float two text views in a relative layout, one
> > going to the left below a title bar, the other going to the right
> > below the title bar. So what I did was this:
>
> >  >    xmlns:android="http://schemas.android.com/apk/res/android";
> >    android:layout_width="fill_parent"
> >    android:layout_height="fill_parent">
>
> >    
> >     >    
>
> >     >        android:layout_below="@id/title_bar"
> >        android:layout_gravity="left"
> >        ...
> >        />
>
> >     >        android:layout_below="@id/title_bar"
> >        android:layout_gravity="right"
> >        ...
> >        />
>
> > 
>
> > That doesn't work, however. The left text is indeed aligned to the
> > left inside its parent (the relative layout), but the right text is
> > not aligned to the right; instead, it's placed directly to the right
> > of the left text.
>
> > Why's that?
>
> > Thanks,
> > Matthias
>
> --
> Romain Guy
> Android framework engineer
> romain...@android.com
>
> Note: please don't send private questions to me, as I don't have time
> to provide private support.  All such questions should be posted on
> public forums, where I and others can see and answer them- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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: Question: How to guestimate the available bitmap memory on a device

2009-05-14 Thread Streets Of Boston

That's what i do right now. My app does its best to have as much
memory as possible before starting to open a big image for editing (i
have written a notification-system that caches and other classes can
register with. They'll then get notified when bitmap memory is
necessary, asking them to free as much 'bitmap memory' as possible
(and other memory if necessary)).

But if an OOM error still happens, i catch it, clearing even more
memory and putting up a Toast to warn the user something has gone
wrong and that he/she may try again.

This scheme works quite well, but my app would like to know if it
could open a full-sized image in 32-bit color or a if it should
present the user with the option to select full-size image with 16bit
color or a half-sized image in 32bit color. For now, i'm using this
hard-coded 6MByte as a limit for maximum image size.


On May 14, 12:00 am, Dianne Hackborn  wrote:
> You can always catch the exception.
>
> On Wed, May 13, 2009 at 4:59 PM, Todd  wrote:
>
> > So, how does one programatically determine the amount of heap space
> > free including space used by bitmap memory? Is there such a way? I
> > would prefer to inform my users that there isn't enough memory to load
> > their image rather than getting an OOM and have the app exit.
>
> --
> 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: How to select open GL objects from motion event?

2009-05-14 Thread Streets Of Boston

You can map it onto the 3D world. You just have to do some math.

Get the x and y coordinates of your touch-event.
Then you have to do this for both z=0 (near plane) and z=1 (far
plane):

Translate the line (x,y,0) --> (x,y,1) in screen-coordinates into your
3D coordinates (hint: use gluUnProject()). Then you have line
(x1,y1,z1) --> (x2,y2,z2) in 3D coordinates. This is all relatively
simple using gluUnProject().

Now the hard part:
Calculate the nearest point where your line (x1,y1,z1) --> (x2,y2,z2)
is intersecting with one of your objects. This code you have to do all
by yourself.

Brush up on your geometry math :-).

On May 14, 1:03 pm, Gerald  wrote:
> Hi,
> I need to use GLSurfaceView to render some objects, and move or select
> the objects by finger touch.
> By overriding the onTouchEvent, I can receive incomming motion events.
> The motion event contains x and y position in the view, but can't map
> to open GL 3D world.
> Is there any way to know which object should be selected from received
> motion event?
> Thank you
>
> Gerald
--~--~-~--~~~---~--~~
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: loading apk resources into a WebView

2009-05-14 Thread Streets Of Boston

This works for me:
E.g. In one of my apps, I load an HTML page as follows:

webView.loadUrl("file:///android_asset/help/helpgube.html");


Below is a snippet from the helpgube.html:








And here a snippet from helpgubecss.css

body {
BACKGROUND-POSITION: 0px 0px;
BACKGROUND-IMAGE: url(../images/screen1_trans.png);
BACKGROUND-REPEAT: repeat-y;
BACKGROUND-COLOR: transparent
}


On May 14, 3:33 pm, Jason Proctor  wrote:
> thanks for the response. do you have 1.5 versions of those projects
> btw? i'd just update them, but in practice i've found that the
> updater always complains that the projects are too old, and the
> creator, which pre-1.5 used to just replace the bits of the project
> hierarchy that were missing with new ones (so you'd just remove
> build.xml and then get a new one, magic), now blows away important
> parts of the application. sigh.
>
> turns out i had the HTML in the res/raw folder rather than the
> assets/ folder. works OK now.
>
> i did run into some weird problems after moving around resources
> though. strange crashes etc. i found i had to rm -rf bin/* gen/*
> before building, more evidence that the build process doesn't manage
> its dependencies properly.
>
>
>
>
>
> >  > i'm using file:///android_asset/resourcename to access apk resources,
> >>  as various online resources and the WebKit doc page suggest, but i'm
> >>  getting no success.
>
> >Visit:
>
> >http://commonsware.com/AdvAndroid/
>
> >and download the source code. In there, you will find the WebKit folder
> >containing a pair of projects that successfully load HTML pages out of
> >assets/. I have tested this code on Android 1.5 and it works there too,
> >though the ZIP file contains Android 1.1 projects.
>
> >>  the docs say that apk asset access is "more restricted" post-1.0,
> >>  without being specific. do i need to declare a permission or
> >>  something?
>
> >I have usually requested the INTERNET permission whenever I use WebView,
> >though that may just be a knee-jerk reaction. The projects I cite above
> >have INTERNET and ACCESS_FINE_LOCATION (they demonstrate allowing location
> >information access from Javascript).
>
> >--
> >Mark Murphy (a Commons Guy)
> >http://commonsware.com
> >_The Busy Coder's Guide to Android Development_ Version 2.0 Available!
>
> --
> jason.software.particle- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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: UI problem

2009-05-15 Thread Streets Of Boston

You want a delay between changing the button's text and showing the
new content-view?

If that's the case,

private void markUser(int index) {


btnArray[index].setText(mark);
btnArray[index].setClickable(false);

postDelayed(new Runnable() {
  public void run() {
showGameOverMenu(); // calls the setContentView
();
  }
}, delay);
}


(postDelayed may have to be called using a View or Handler instance)

On May 14, 2:37 am, Sukitha Udugamasooriya  wrote:
> Hi geniuses,
>
> I have few buttons on the content. When I click on one button,
>
> 1-- I want to change the text of the button.
> 2-- Then I want to change the content view.
>
> this is my method which executes with the onClick event.
>
>         private void markUser(int index) {
>
>                 btnArray[index].setText(mark);
>                 btnArray[index].setClickable(false);
>
>                 showGameOverMenu();     // calls the setContentView();
>         }
>
> Here the problem is the text change of the button is not visible.
>
> How can I make it visible??? I'm not thorough with how the UI thread
> works in android
>
> Thanks in advance
>
> Sukitha
> (wannaB android master ;))
--~--~-~--~~~---~--~~
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 glColor4x

2009-05-18 Thread Streets Of Boston

I think the color values are values between 0 (rgb = 0) and 1 (rgb =
255).
And, if i'm reading your code correctly, the 'red', 'green' and 'blue'
values in your code-example have values between 0 and 255 (in fixed
format: 0.0, 1.0, 2.0 --> 255.0).
http://www.khronos.org/opengles/documentation/opengles1_0/html/glColor.html

Try this as your last statement:
surface.glColor4x(red/255, green/255, blue/255)



On May 18, 8:53 am, "Alistair." 
wrote:
> Anyone used glColor4x much?
>
> I am passing colours into a line draw rtn in the usual format '4
> bytes: alpha, red, green, blue.'
>
> my call to to set the colour attempts to modify the RRGGBB parts into
> fixed format values.
>
>         int red = (color&0x00FF);
>         int green = (color&0xFF00)<<8;
>         int blue = (color&0x00FF)<<16;
>
>         surface.glColor4x(red, green, blue, 0);
>
> I am getting screwy colours from this. I have searched but there
> aren't many examples of this call kicking around and used in this way.
> I am obviously doing something dumb. Do I have to format the rgb
> values as percentages somehow?
>
> 'surface' is defined as GL10 btw.
>
> Al.
--~--~-~--~~~---~--~~
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 know it's week when input random date?

2009-05-19 Thread Streets Of Boston

Note that this code may not compile (typo's), but i hope you'll get
the idea.

[code]
Date sampledate = ... ...;
...
Calendar cal = Calendar.getInstance();
cal.setTime(sampleDate);
int weekNumInYear = cal.get(Calendar.WEEK_OF_YEAR);
int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
...
etc.
etc.
[/code]

Difference calcs:
[code]
Calendar cal = Calendar.getInstance();
cal.clear();
cal.set(2009, 5, 19);
Date date1 = cal.getTime();

cal.clear();
cal.set(2009, 6, 20);
Date date2 = cal.getTime();

int diffInNumberOfHours = ((int)date2.getTime() - (int)date1.getTime
()) / (1000 * 60 * 60);
[/code]
If you want the number of days between date1 and date2, it becomes
tricky.
You have to deal with possible daylight saving time changes inbetween
date1 and date2: Number of hours in a day can be 23 or 25. That's why
you can't always divide diffInNumberOfHours by 24 to get the number of
days... but if you want to ignore daylight saving time changes, just
divide diffInNumberOfHours by 24 to get the number of days.



On May 18, 9:11 pm, daehoon  wrote:
> Hi~~ everyone.
> 1.
> how to get it's week when we know a date, not current date.
> if I input 5-22, return Friday.
>
> 2.
> If I input 2 dates, 5-19 & 6-20, how to know  how many days between
> 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: Wait for activity finishes

2009-05-20 Thread Streets Of Boston

As far as i know, you can't do this.

Maybe you want to implement a modal dialog.
Launch a (subclass of) android.app.Dialog instead.
However, even when using dialogs by calling yourDialog.show(), the show
() call returns immediately. It doesn't wait.

It looks like you have to re-write some of your code to handle the
onActivityResults instead of the returned value of myFunction.

On May 20, 5:30 am, "danielececil...@gmail.com"
 wrote:
> Hi,
>
> I have a problem with return value of a method witch launches an
> Activty.
> I would like a method witch launches an Activty and witch wait for
> this Activity being complete before returning a value.
> I note that , doing nothing special, the calling method achieves its
> own code before launches the Activity.
> How can i do to have a method witch waits for the activity finishes?
>
> My code is the following :
>
>  Begin Code
> 
> String result;    //class field
>
> public String myFunction (RootActivity rootAct,
>                  final String title,
>                  final ArrayList label,
>                  ArrayList max)
>   {
>    root = rootAct;  // The activity witch launches another activity
>
>    action = SecondActivity.class;
>
>    Intent i = new Intent(root, action );
>
>    root.startActivityForResult(i, 0);
>
>   //The root activity initializes 'result' with result of
> SecondActivity in onActivityResult method
>   // return s;
>   }
>
> ---End
> Code-
>
> Some help please :-)
>
> Cecilia
--~--~-~--~~~---~--~~
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: Cursor.moveToFirst() is taking up a lot of time

2009-05-20 Thread Streets Of Boston

really...? That's surprising.
I thought the moveToNext just fetches the rows lazily, fetches them
when necessary.

On May 20, 2:15 pm, Marco Nelissen  wrote:
> The first call to moveToNext() is still going to cause getCount() and
> thus fillWindow() to be called internally, so it won't be any faster.
>
> On Wed, May 20, 2009 at 10:58 AM, Streets Of Boston
>
>
>
>  wrote:
>
> > In your example, it seems you don't need the getCount() or moveToFirst
> > () at all.
>
> > The snippet below works well without using getCount or moveToFirst().
> > [code]
> > Cursor c = db.query(var1, var2, var3 .);
> > while (c.moveToNext()) {
> >   // do something with cursor c
> >   ...
> > }
> > [/code]
>
> > On May 18, 10:47 am, Sublimity Mobile Software
> >  wrote:
> >> Hi,
>
> >> Currently i'm working on a database system for some applications. I
> >> need to do a lot of queries to load data from the database into the
> >> application. After being amazed how much time it took to do these
> >> queries on the database i found out that much time was consumed by
> >> cursor.MoveToFirst(). This functions costs currently ~25% of all my
> >> database action.
>
> >> Does anyone know why this takes would take so long or does anyone know
> >> a better solution to get to the first position of the cursor?
>
> >> My code:
>
> >> Cursor c = db.query(var1, var2, var3 .);
> >> c.CustomMoveToFirst();
>
> >> int count = c.getCount();
> >> for(int i = 0; i >>         doSomethingWithCursor();
> >>         c.moveToNext();
>
> >> }
>
> >> The same problem occurs when i place everything in a while loop and
> >> use only the MoveToNext() function. So i think that the problem must
> >> be in positioning the cursor to the first position.
>
> >> My code:
> >> Cursor c = db.query(var1, var2, var3 .);
> >> c.CustomMoveToFirst();
>
> >> while(c.moveToNext()){
> >>          doSomethingWithCursor();
>
> >> }
>
> >> Thanks,
> >> Sublimity Mobile Software- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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: Cursor.moveToFirst() is taking up a lot of time

2009-05-20 Thread Streets Of Boston

In your example, it seems you don't need the getCount() or moveToFirst
() at all.

The snippet below works well without using getCount or moveToFirst().
[code]
Cursor c = db.query(var1, var2, var3 .);
while (c.moveToNext()) {
   // do something with cursor c
   ...
}
[/code]

On May 18, 10:47 am, Sublimity Mobile Software
 wrote:
> Hi,
>
> Currently i'm working on a database system for some applications. I
> need to do a lot of queries to load data from the database into the
> application. After being amazed how much time it took to do these
> queries on the database i found out that much time was consumed by
> cursor.MoveToFirst(). This functions costs currently ~25% of all my
> database action.
>
> Does anyone know why this takes would take so long or does anyone know
> a better solution to get to the first position of the cursor?
>
> My code:
>
> Cursor c = db.query(var1, var2, var3 .);
> c.CustomMoveToFirst();
>
> int count = c.getCount();
> for(int i = 0; i         doSomethingWithCursor();
>         c.moveToNext();
>
> }
>
> The same problem occurs when i place everything in a while loop and
> use only the MoveToNext() function. So i think that the problem must
> be in positioning the cursor to the first position.
>
> My code:
> Cursor c = db.query(var1, var2, var3 .);
> c.CustomMoveToFirst();
>
> while(c.moveToNext()){
>          doSomethingWithCursor();
>
> }
>
> Thanks,
> Sublimity Mobile Software
--~--~-~--~~~---~--~~
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: Very strange StackOverflow exception

2009-05-21 Thread Streets Of Boston

"But I'm confident I don't deal with so much levels."
I count about 30 draw() calls on either ViewGroup or FrameLayout in
the stack.
You are dealing with quite a number of levels... probably too many of
them.

On May 21, 4:44 am, Vince  wrote:
> Hi fadden,
>
> Here is the stack trace:
>
> 05-21 08:38:08.050: ERROR/AndroidRuntime(952): Uncaught handler:
> thread main exiting due to uncaught exception
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):
> java.lang.StackOverflowError
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.text.StaticLayout.(StaticLayout.java:97)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.text.StaticLayout.(StaticLayout.java:54)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.text.StaticLayout.(StaticLayout.java:45)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.widget.TextView.makeNewLayout(TextView.java:4769)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.widget.TextView.assumeLayout(TextView.java:4669)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.widget.TextView.onDraw(TextView.java:3753)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.View.draw(View.java:5838)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.ViewGroup.drawChild(ViewGroup.java:1486)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.ViewGroup.drawChild(ViewGroup.java:1484)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.ViewGroup.drawChild(ViewGroup.java:1484)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.ViewGroup.drawChild(ViewGroup.java:1484)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.View.draw(View.java:5944)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.widget.FrameLayout.draw(FrameLayout.java:352)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.View.buildDrawingCache(View.java:5617)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.View.getDrawingCache(View.java:5458)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.ViewGroup.drawChild(ViewGroup.java:1422)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.ViewGroup.drawChild(ViewGroup.java:1484)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.ViewGroup.drawChild(ViewGroup.java:1484)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.View.draw(View.java:5841)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.widget.FrameLayout.draw(FrameLayout.java:352)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.ViewGroup.drawChild(ViewGroup.java:1486)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.ViewGroup.drawChild(ViewGroup.java:1484)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.ViewGroup.drawChild(ViewGroup.java:1484)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.ViewGroup.drawChild(ViewGroup.java:1484)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.ViewGroup.drawChild(ViewGroup.java:1484)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.ViewGroup.dispatchDraw(ViewGroup.java:1228)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.View.draw(View.java:5841)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.widget.FrameLayout.draw(FrameLayout.java:352)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.ViewGroup.drawChild(ViewGroup.java:1486)
> 05-21 08:38:08.098: ERROR/AndroidRuntime(952):     at
> android.view.ViewG

[android-developers] Re: showDialog and dismissDialog behave strangely when changing orientation

2009-05-21 Thread Streets Of Boston

Where do you call the showDialog()? In the onCreate?

(Note that there is a known issue with the onPrepareDialog that is not
called properly when a configuration change has occurred in your app.)

On May 21, 4:53 am, idev  wrote:
> Hi
> I am using the showDialog and dismissDialog methods to show progress
> dialogs in my app. Moved from creating the dialog and calling show()
> on it to using this in order to save state when changing orientation.
> But when I change the orientation from portrait->landscape->portrait,
> the dismissDialog method call no longer dismisses the dialog. The
> dialog stay there all the time and I need to press the back button for
> it to disappear.
> To overcome this issue, I tried adding a removeDialog in onDestroy so
> that the dialog is not created/displayed twice and before orientation
> change, the dialog is removed. Tried adding log statements and this is
> what happens
> 05-21 12:35:14.064: DEBUG/MyClass(193): *callingShowDialog
> 05-21 12:35:14.064: DEBUG/MyClass(193): *onCreareDialog
>
> 05-21 12:35:15.385: DEBUG/MyClass(193):
> *onSaveInstanceState
> 05-21 12:35:15.415: DEBUG/MyClass(193): *onDestroy
>
> 05-21 12:35:15.585: DEBUG/MyClass(193): *callingShowDialog
> 05-21 12:35:15.585: DEBUG/MyClass(193): *onCreareDialog
> 05-21 12:35:15.715: DEBUG/MyClass(193): *onCreareDialog
> 05-21 12:35:17.214: DEBUG/MyClass(193):
> *onSaveInstanceState
> 05-21 12:35:17.214: DEBUG/MyClass(193): *onDestroy
>
> 05-21 12:35:17.275: ERROR/WindowManager(193):
> android.view.WindowLeaked: Activity com.android.MyClass has leaked
> window com.android.internal.policy.impl.phonewindow$decorv...@43362088
> that was originally added here
> Some error statements
> 05-21 12:35:17.395: DEBUG/MyClass(193): *callingShowDialog
> 05-21 12:35:17.395: DEBUG/MyClass(193): *onCreareDialog
> 05-21 12:35:17.475: DEBUG/MyClass(193): *onCreareDialog
>
> Initially when the activity is displayed, the onCreateDialog is called
> once and on changing the orientation, onSaveInstanceState and
> onDestroy are called.
> But after that, onCreateDialog is called twice (once by a call to
> showDialog which I make, but why the 2nd time?) and this happens every
> time I change the orientation hence forth.
> Any idea why that happens?
> 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
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Messaging between 2 threads

2009-05-21 Thread Streets Of Boston

Take a look at the OpenGL API Demo source examples. I think it's
called Kube or someting.
It provides a Game-thread that is set up to receive messages which
then can be executed synchronously on the game-thread (posting
Runnables on a queue that is managed by the Game-thread).


On May 21, 3:54 am, "latha...@gmail.com"  wrote:
> Hi All
>
> I am writing an application in which i need to handle messages between
> the main thread(the deafult UI related thread) and the user created
> Gamethread.
>
> The requirement is like this.
>
> An activity(say "Activity_X") is setting the view by "setContentView
> (some "View_Y")". In "Activity_X" i have implemeted
> "onCreateOptionsMenu()" and "onOptionsItemSelected()" fucntions for
> creating menus & a switch case for action to be taken on selecting
> those menus.Menu has items like "resume/pause/zoom/" .
>
> All action to be take on selecting these menus are implemented in
> "View_Y" in a separate Gamethread by extending "Thread" class.
>
> So whenever a menu is selected in "Activity_X" i need to send a
> message to "View_Y". And on receiving this ,a particular action/method
> should be called in View_Y(GameThread).
>
> How can i achieve this using Handlers?Is there any other way of doing
> this? Please do share with me some code snippets for these.
> Your advises are highly appreciable. Thank you for your time.
>
> -Latha
--~--~-~--~~~---~--~~
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: Redirecting to market search URL doesn't work

2009-05-21 Thread Streets Of Boston

Have you tried this?:
market://search/?q=pname:com.yourapppackage.something

On May 19, 4:38 pm, orangechicken  wrote:
> To pretty up the URL we have on our site a URL /get/g1. It redirects
> to our market.android.com/search URL, 
> eghttp://market.android.com/search?q=pname:ourappname.
>
> However, going to that link in the G1 browser results in a 404 instead
> of opening the Market to our app.
>
> Questions:
> 1. Is this a known issue?
> 2. Does the browser preprocess links on the page but not intercept
> them in a redirect?
>
> Thank you,
> Dave
--~--~-~--~~~---~--~~
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: TimerTask and Views

2009-05-21 Thread Streets Of Boston

If i'm not mistaken, TimerTasks run on a thread encapsulated in a
Timer object.
Since you can't reliably call most (if not all) UI/View related
methods from any other thread than the main gui-thread, you have to
post back (using a handler) back to the main gui-thread.

I've never tried this using TimerTask, but it may work :=) :
- Create your TimerTask subclass that has access to Handler or to your
View.
- In the 'public void run' method, call post on this handler or view
to do what you want.

@Override
protected void onCreate(Bundle b) {
  ...
  ...
  final Handler handler = new Handler();
  final Runnable doUpdateView = new Runnable() {
public void run() {
  ... do something with your view ...
}
  }

  TimerTask myTimerTask = new TimerTask() {
public void run() {
handler.post(doUpdateView);
}
  }

  ...
  mTimer.scheduleAtFixedRate(myTimerTask, 0, 1000);
  ...

}

On May 21, 10:38 am, Mooncat  wrote:
> Is it a no-no to try to update a View from a TimerTask? My initial
> experiments indicate it doesn't work. Is there a way to make it work?
--~--~-~--~~~---~--~~
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 can i put 15MB images in my App?

2009-05-21 Thread Streets Of Boston

There may be no restriction on any apk, but i wouldn't put them all in
one apk anyway.

Giving the fact that you can only install your app on phone-memory
(not on your SD-card), it's likely that users see the more than
15MByte size of your app and decide not to install/buy it.

Is downloading these images an option?

On May 21, 12:35 pm, Dianne Hackborn  wrote:
> You can put them in your .apk without restriction, just don't load them all
> at the same time.
>
> On Thu, May 21, 2009 at 7:59 AM, zeeshan  wrote:
>
> > Hi,
>
> > i am afraid if Max space for android App is 14MB , how can i put 15MB
> > images in my App.
> > my application includes more than 500 PNG images which are
> > confidentials and cann't be put on sd card. i need to put them in my
> > assets.
>
> > is it something that can not be achieved in android?
>
> --
> 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: Out of Memory Error in BitmapFactory.decodeFile

2009-05-22 Thread Streets Of Boston

I'm amazed yout get it working 2 times. :=)

You can not load so many (3 or more) big (over 3Mpixels) in one
process. You'll run out of memory. A full size pic of 3Mpixels in
RGB_565(16bit color) is 6MBytes of memory.

You have to decode the file with the Option's 'inSampleSize' set to
something larger than 1. 1 --> decode full size; 2 --> decode quarter
size; 4 --> decode 1/16th size. E.g. when set to 2, you'll get a
1024x786 sized pic, a quarter of the original size.

You should choose a inSampleSize that will produce a bitmap that is
closest to your view's size, so that you don't waste pixels that will
never be displayed anyway and that you don't 'waste' memory.

On May 22, 7:17 am, guruk  wrote:
> Hi,
> I was reading in some other posts that some developers have the same
> Problem, but till now, no solution.
> its about the gallery: I have a string array with photos, but when the
> gallery does show the 2nd Picture it
> crash with:
>
> ---
> D/votw    (18078):  --- DebugMark 1    E/dalvikvm-heap(18078):
> 6291456-byte external allocation too large for this process.
> E/        (18078): VM won't let us allocate 6291456 bytes /skia
> 
>
> bm= BitmapFactory.decodeFile("/sdcard/dcim/Camera/" + photoList[0]);
>
> -- It works fine 2 Times, starting with the 3rd Time it crash.
> - In other Threads they adviced to use another pic, but as you see I
> try now
>    with (photoList[0]) so its a FIXED same Picture.
>
> So I guess I have to release somehow the Memory, but how?
>
> Thanks
> Chris
--~--~-~--~~~---~--~~
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: Out of Memory Error in BitmapFactory.decodeFile

2009-05-22 Thread Streets Of Boston

... // determine the width/height or a gallery item's view
Rect rectOfGalleryItemView = ...;
...
... // Then determine the best sampleSize (1, 2, 4, 8)
int sampleSize = calculateSampleSize(rectOfGalleryItemView, 2048,
1536);

BitmapFactory.Options opts = new BitmapFactory.Options();
opts.inDither = true; // we're using RGB_565, dithering improves this
a bit.
opts.inPreferredConfig = Bitmap.Config.RGB_565;
opts.inSampleSize = sampleSize;
bm = BitmapFactory.decodeStream("/sdcard/dcim/Camera/" + photoList[i],
opts);

And yes, it takes a bit longer to decode here. In my app, i put
decoding the bitmap in a background thread (much like AsyncTask). But
you can cache the decoded bitmaps and be a bit smart about pre-loading
bitmaps before they become visible in the Gallery. If you use a cache,
you need to manage the cache. Clear it when memory may run low, etc.

On another note; i noticed that using an inSampleSize value of larger
than 1 produces better quality images than using createScaledBitmap.



On May 22, 9:12 am, guruk  wrote:
> :) I got it now already up to 15 :)
>
> bm = BitmapFactory.decodeFile("/sdcard/dcim/Camera/" + photoList[i]);
> bphotos.add(Bitmap.createScaledBitmap(bm, 480, 320, true));
> bm.recycle();
>
> when I always use bm.recycle()
>
> ok, but lets look on your insamplesize... i will also try.
> but how to use in samplzesiez with decodeFile?
> finaly i need 480x320...
>
> but i am not sure if that helps at all. because life decoding needs
> quit long time. so i have 2 options. a thread with background decoding
> or creating thumbs and loading them direct into a gallery
>
> but please tell me how to use insamplesize with .decodeFile or
> creatscalebitmap
>
> greets
> chris
--~--~-~--~~~---~--~~
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: Out of Memory Error in BitmapFactory.decodeFile

2009-05-22 Thread Streets Of Boston

I don't know the answer to all your questions in your previous post,
but this is a trick i used to get a 'circular' list-view (not a
gallery, but i think they are comparable).

I needed a list-view that is circular, i.e. after the last element the
first element appears again.

I attached a ListAdapter (BaseAdapter) to my list-view and overrode
the methods of BaseAdapter.
- No scrollbar
- I overrode getCount() to return a large value (e.g. 100)
- I override getItem(int pos) to return the correct element from my
array (use modulo operator, because pos can have a value of 99,
getCount()-1).
- Override any method in Adapter that takes a position as input. Use
the module operator to figure the actual index into your array of data
(bitmaps).


On May 22, 9:33 am, guruk  wrote:
> thanks for your help, i will give it a try.
>
> ... also when I have a bphotoList (an array of bitmaps)
> and I reload this Array with new Bitmaps, what do I have to do that
> they gallery
> use them. I thought it come automaticly, because I just change the
> content, but
> it looks the gallery cache the old content somewhere?
>
> And to make it round. lets say i have a gallery with 10pics, while at
> pic 10
> (simple version) i change the content of the PhotoArray.. how can i
> let
> jump the gallery to position 1? (and for sure show the new content and
> not something cached:)
>
> thanks chris
--~--~-~--~~~---~--~~
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: showDialog and dismissDialog behave strangely when changing orientation

2009-05-22 Thread Streets Of Boston

Do you call dialog.show() or activity.showDialog(dialogid)?

On May 22, 11:15 am, idev  wrote:
> Anyone know about this? I've seen many posts and blogs about this
> problem but no one seems to have a solution for it.
> Can someone please help!
>
> Thanks.
>
> On May 21, 8:12 pm, iDeveloper  wrote:
>
>
>
> > Not in the onCreate implementation. I am calling it on a button's  
> > click event. And the button is sort of a refresh button. So it might  
> > be pressed multiple times.
>
> > On 21-May-09, at 7:57 PM, Streets Of Boston wrote:
>
> > > Where do you call the showDialog()? In the onCreate?
>
> > > (Note that there is a known issue with the onPrepareDialog that is not
> > > called properly when a configuration change has occurred in your app.)
>
> > > On May 21, 4:53 am, idev  wrote:
> > >> Hi
> > >> I am using the showDialog anddismissDialogmethods to show progress
> > >> dialogs in my app. Moved from creating the dialog and calling show()
> > >> on it to using this in order to save state when changing orientation.
> > >> But when I change the orientation from portrait->landscape->portrait,
> > >> thedismissDialogmethod call no longer dismisses the dialog. The
> > >> dialog stay there all the time and I need to press the back button  
> > >> for
> > >> it to disappear.
> > >> To overcome this issue, I tried adding a removeDialog in onDestroy so
> > >> that the dialog is not created/displayed twice and before orientation
> > >> change, the dialog is removed. Tried adding log statements and this  
> > >> is
> > >> what happens
> > >> 05-21 12:35:14.064: DEBUG/MyClass(193):  
> > >> *callingShowDialog
> > >> 05-21 12:35:14.064: DEBUG/MyClass(193): *onCreareDialog
>
> > >> 05-21 12:35:15.385: DEBUG/MyClass(193):
> > >> *onSaveInstanceState
> > >> 05-21 12:35:15.415: DEBUG/MyClass(193): *onDestroy
>
> > >> 05-21 12:35:15.585: DEBUG/MyClass(193):  
> > >> *callingShowDialog
> > >> 05-21 12:35:15.585: DEBUG/MyClass(193): *onCreareDialog
> > >> 05-21 12:35:15.715: DEBUG/MyClass(193): *onCreareDialog
> > >> 05-21 12:35:17.214: DEBUG/MyClass(193):
> > >> *onSaveInstanceState
> > >> 05-21 12:35:17.214: DEBUG/MyClass(193): *onDestroy
>
> > >> 05-21 12:35:17.275: ERROR/WindowManager(193):
> > >> android.view.WindowLeaked: Activity com.android.MyClass has leaked
> > >> window com.android.internal.policy.impl.PhoneWindow
> > >> $decorv...@43362088
> > >> that was originally added here
> > >> Some error statements
> > >> 05-21 12:35:17.395: DEBUG/MyClass(193):  
> > >> *callingShowDialog
> > >> 05-21 12:35:17.395: DEBUG/MyClass(193): *onCreareDialog
> > >> 05-21 12:35:17.475: DEBUG/MyClass(193): *onCreareDialog
>
> > >> Initially when the activity is displayed, the onCreateDialog is  
> > >> called
> > >> once and on changing the orientation, onSaveInstanceState and
> > >> onDestroy are called.
> > >> But after that, onCreateDialog is called twice (once by a call to
> > >> showDialog which I make, but why the 2nd time?) and this happens  
> > >> every
> > >> time I change the orientation hence forth.
> > >> Any idea why that happens?
> > >> Thanks- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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: Create Bitmap from BitmapDrawable?

2009-05-26 Thread Streets Of Boston

Like Tom said:
Create a bitmap, like in your example.

- Create a mutable bitmap that is a copy of your original (Bitmap.copy
(...)).
- Wrap a canvas around this new mutable bitmap (new Canvas(bmCopy))
- Just draw on this canvas.
- After each draw on this canvas, your bmCopy will be updated.

If you don't have an original bitmap, but an original Drawable
instead, get the width and height of the drawable and create a mutable
(but empty) bitmap from that:
- Create a mutable bitmap that is the size of your drawable:
Bitmap.createBitmap(width, heigh, config);
- Wrap a canvas around this new mutable bitmap (canvas = new Canvas
(bitmap))
- Draw your original Drawable on this canvas (origDrawable.draw
(canvas)).
- Just draw other stuff on this canvas.
- After each draw on this canvas, your bitmap will be updated.

On May 26, 12:37 pm, guruk  wrote:
> Hi Tom, thanks for your help
>
> do you mean something like that: (till now i did not worked)
>
>         Bitmap ob = BitmapFactory.decodeResource
> (resources,R.drawable.mydaysminipic_td);
>                                                 Bitmap obm = 
> Bitmap.createScaledBitmap(ob, 18, 18,false);
>                                                 Canvas canvas = new 
> Canvas(obm);
>                                                 BitmapDrawable bmd = new 
> BitmapDrawable(canvas);
>                                                 
> bmd.setColorFilter(0xff00,Mode.SRC_ATOP);
>                                                 bmd.draw(canvas);
>                                                 Bitmap newbit;
>                                                 newbit=bmd.getBitmap();
>
> Really I came crazy with that. Finaly I just need the Solution for:
>
> I have a Drawable and I like that all set pixels in it get another
> Color and
> finaly to update my widget ... for that I have to options:
>
> updateViews.setImageViewBitmap(draws2[i + 10], newbit);  //thats what
> I try now with above code
>
> or i make it simple:  (but i miss a link)
> --
> Drawable dx = resources.getDrawable(R.drawable.mydaysminipic_ov);
> dx.setColorFilter(0xff00ff00, Mode.SRC_ATOP);
> updateViews.setImageViewResource(draws2[i + 10],
> R.drawable.mydaysminipic_pe);
> --
> but that does not work, because WHAT is the ID (int) of my created
> dx??
>
> Any Ideas to solve that. would be really great
>
> Thanks
> Chris
--~--~-~--~~~---~--~~
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: Create Bitmap from BitmapDrawable?

2009-05-26 Thread Streets Of Boston

Here is a recent thread on this group of  someone trying to do
something similar, i think:
http://groups.google.com/group/android-developers/browse_frm/thread/fff3234b0a1121ae#


On May 26, 1:10 pm, Streets Of Boston  wrote:
> Like Tom said:
> Create a bitmap, like in your example.
>
> - Create a mutable bitmap that is a copy of your original (Bitmap.copy
> (...)).
> - Wrap a canvas around this new mutable bitmap (new Canvas(bmCopy))
> - Just draw on this canvas.
> - After each draw on this canvas, your bmCopy will be updated.
>
> If you don't have an original bitmap, but an original Drawable
> instead, get the width and height of the drawable and create a mutable
> (but empty) bitmap from that:
> - Create a mutable bitmap that is the size of your drawable:
> Bitmap.createBitmap(width, heigh, config);
> - Wrap a canvas around this new mutable bitmap (canvas = new Canvas
> (bitmap))
> - Draw your original Drawable on this canvas (origDrawable.draw
> (canvas)).
> - Just draw other stuff on this canvas.
> - After each draw on this canvas, your bitmap will be updated.
>
> On May 26, 12:37 pm, guruk  wrote:
>
>
>
> > Hi Tom, thanks for your help
>
> > do you mean something like that: (till now i did not worked)
>
> >         Bitmap ob = BitmapFactory.decodeResource
> > (resources,R.drawable.mydaysminipic_td);
> >                                                 Bitmap obm = 
> > Bitmap.createScaledBitmap(ob, 18, 18,false);
> >                                                 Canvas canvas = new 
> > Canvas(obm);
> >                                                 BitmapDrawable bmd = new 
> > BitmapDrawable(canvas);
> >                                                 
> > bmd.setColorFilter(0xff00,Mode.SRC_ATOP);
> >                                                 bmd.draw(canvas);
> >                                                 Bitmap newbit;
> >                                                 newbit=bmd.getBitmap();
>
> > Really I came crazy with that. Finaly I just need the Solution for:
>
> > I have a Drawable and I like that all set pixels in it get another
> > Color and
> > finaly to update my widget ... for that I have to options:
>
> > updateViews.setImageViewBitmap(draws2[i + 10], newbit);  //thats what
> > I try now with above code
>
> > or i make it simple:  (but i miss a link)
> > --
> > Drawable dx = resources.getDrawable(R.drawable.mydaysminipic_ov);
> > dx.setColorFilter(0xff00ff00, Mode.SRC_ATOP);
> > updateViews.setImageViewResource(draws2[i + 10],
> > R.drawable.mydaysminipic_pe);
> > --
> > but that does not work, because WHAT is the ID (int) of my created
> > dx??
>
> > Any Ideas to solve that. would be really great
>
> > Thanks
> > Chris- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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: OpenGL - glLineWidthx, glLineWidth bug

2009-05-26 Thread Streets Of Boston

Looks like the iPhone has the same issue:
http://www.khronos.org/message_boards/viewtopic.php?f=4&t=1223

It seems that only a line-width of exactly 1 must be supported,
anything else is optional.
http://www.khronos.org/opengles/documentation/opengles1_0/html/glLineWidth.html

On May 26, 4:58 am, "Alistair." 
wrote:
> Can anyone confirm that the OpenGL methods glLineWidthx, glLineWidth
> do not work. That is, setting these to anything about 1 has no effect
> when running on the phone.
>
> They appear to work on the emulator okay but not the phone.
>
> Al.
--~--~-~--~~~---~--~~
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: implementation of onDestroy for a service containing a worker or backround thread

2009-05-27 Thread Streets Of Boston

Send a message to your background thread telling it to end.

Your background thread:
class MyBackgroundThread extends Thread {
...
...
  private boolean _isRunning = true;
  public void run() {
...
...
while (running()) {
  ... // fetch and handle messages. ...
}
  }

  ..
  private synchronized running() {
return _isRunning;
  }

  public synchronized stopThread() {
_isRunning = false;
  }
  ...
}

On May 27, 8:29 am, gautam_raychaudh...@hotmail.com wrote:
> Can I use the thread.join() mechanism?
> Basically, in the onDestroy() method of the service, I would send a
> message to the background thread and call join on the thread.
> The background thread would destroy it self after proper cleanup. But,
> what method should I use to exit the thread.
> Please note the background thread uses a looper to handle messages
> from the main thread.
>
> Or, pl. suggest some other method of implementing the above behavior.
>
> On May 27, 11:31 am, gautam_raychaudh...@hotmail.com wrote:
>
>
>
> > Android may kill the process and thus the service running in the
> > process, onceonDestroy() returns (after sending a message to the
> > worker thread).
> > But how will I make sure that the service has completed it's clean up
> > operations (ex. saving some data on to some storage, etc...), if any?
>
> > The main thread nevers gets blocked in any other scenario exceptonDestroy().
> > Do you have any other mechanism to achieve this behavior in the
> > platform?
>
> > On May 27, 2:23 am, Dianne Hackborn  wrote:
>
> > > Blocking inonDestroy() waiting for the background thread to complete
> > > basically defeats the purpose of doing work in a background thread.
>
> > > On Tue, May 26, 2009 at 7:09 AM, Gautam 
> > > wrote:
>
> > > > Hi,
>
> > > >     I'm implementing a service that contains a thread to handle all
> > > > time consuming operation. My core service logic is in a different
> > > > thread than the ui or main thread. According to the Android document,
> > > > when the OS plans to free some system resource, it will callonDestroy
> > > > () on the service and only whenonDestroy() returns it will kill the
> > > > process hosting the service, thus giving opportunity to the service to
> > > > cleanup.
>
> > > >     Now, whenonDestroy() is called, I want to send a message to my
> > > > service thread to do the necessary cleanup. Only when the service
> > > > thread acknowledges that the cleanup or shutdown is complete,onDestroy
> > > > () should return.
> > > > I could find a way to send asynchronous messages to threads and the
> > > > corresponding processing of the messages, but not able to figure out
> > > > how I need to implementonDestroy(), such that it would send a message
> > > > to the service thread and should wait for a result, before returning.
>
> > > >    Appreciate if someone can comment on my understanding ofonDestroy
> > > > () and provide some solution to the above problem.
>
> > > > Thanks and Regards,
> > > > Gautam.
>
> > > --
> > > 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.- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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: few querieson OpenGL-ES on Android...

2009-05-27 Thread Streets Of Boston

My app is using OpenGL ES: The Gube

On May 27, 12:30 pm, Shrinivas  wrote:
> Hi All,
>
> I have few queries:
>
> - Can anybody let me know is 2D & 3D graphics in Android are using
> OpenGL-ES? I have have read only 3D graphics is using OpenGL-ES.
>
> - what are all the application in android which are using OpenGL-ES.
> please give the list of applications.
>
> 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
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Cannot allocate any memory when using camera pic

2009-05-27 Thread Streets Of Boston

I'm not sure about the exact point of failure, which - indeed - seems
very precisely cut against the memory needed to load exactly one
camera pic.

However, you can avoid this. Don't load the full size pic. Load the
bitmap using the BitmapFactory and set the Config's inSampleSize
attribute to a value larger than 1 (2, 4, 8, 16) that would fit the
pixel-size of your PictureView. E.g. use 4 to get a 512 x 384 bitmap
that can snuggly fit (without being up-scaled) into a 480x320 size
PictureView. If your PictureView is smaller, set the 'inSampleSize' to
a larger value.

On May 27, 2:30 pm, Max Salley  wrote:
> I have an app that displays a camera picture as part of it, but if the
> picture is in memory I get an out of memory exception when an
> allocation of any size happens no matter what.  If the app uses a
> seekbar in addition to my PictureView the ~900 bytes it allocates are
> too much.  I even tried to load a 16x16 monochrome image on top of the
> camera pic, but the 256 bytes were too much.  I find it extremely
> unlikely that the object containing the image is precisely the size so
> that using it alone never causes a crash, but allocating even 256 more
> bytes exceeds the memory budget.  Does anybody know what the problem
> is?
--~--~-~--~~~---~--~~
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: What's the best way to handle an task w/progress dialog on orientation change?

2009-05-27 Thread Streets Of Boston

Take a look at the method onRetainNonConfigurationInstance() of the
Activity class. :-)

http://developer.android.com/reference/android/app/Activity.html#onRetainNonConfigurationInstance()

On May 27, 2:01 pm, Robert Green  wrote:
> I have an app that communicates with a server.  While it is
> communicating, it shows a progress dialog.  The way this actually
> works is that I have a class that I call my NetworkGateway.  Each
> method takes a Handler as a callback so that the gateway can send back
> the response as a bundle when it has finished.
>
> Right now when someone changes orientation while a network operation
> is occuring, the activity doesn't know that a thread is running the
> network code and then the callback might be invalid.
>
> What's the right way to do this?  I want to make it so that after the
> orientation switch, the activity can check something to see if a
> network operation is running and if so, display the progress dialog
> again and wait for the callback, or set itself as the callback handler
> now, invalidating the old one.
>
> My first guess is that this is exactly the kind of thing services were
> designed for, but I'd like specifics if anyone can supply them.
>
> 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
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Re: Network over cell (3G, EDGE etc.)

2009-05-27 Thread Streets Of Boston

"do I need to account for the fact that cell data network is very slow
with high latencies"
Yep.

Or ask your customers to run your app only with WiFi on or with 3G in
a good reception area.

On Apr 16, 11:57 am, Alienfluid  wrote:
> So my app works well in the emulator in various run configurations and
> on the device when the device is connected to WiFi. But when I switch
> off the WiFi on the device, the code that goes out to the network
> takes forever and then times out (i.e. doesn't return any data). Other
> people have reported this as well. I also notice that no data is going
> out or coming in when I look at the little up and down arrows on the
> 3G icon in the status bar on the G1.
>
> I am assuming that the Java code I am using should work for both types
> of connections, right? I mean, do I need to account for the fact that
> cell data network is very slow with high latencies i.e. pre-cache my
> data etc.?
>
> How can I debug this?
>
> -F
--~--~-~--~~~---~--~~
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: What's the best way to handle an task w/progress dialog on orientation change?

2009-05-27 Thread Streets Of Boston

I agree you should use a service.
But for optimization, i would use this method.

You should have a call to the service to query if the service is still
busy. If so, show a progress dialog and start listening to the service
to know when it no longer is busy (callback from the service into your
app)

On May 27, 4:07 pm, Robert Green  wrote:
> I just looked at it.
>
> 1)  They state that it is only an optimization and that you are not to
> rely on the method being called.
>
> 2)  My design is a little too complex to use that elegantly.  I do
> network calls from multiple activities and some dialogs on those
> activities, which need to chain to other actions upon completion.
>
> I'm learning about Services right now and I think that if I could have
> a network service that I can register a specific callback with, like a
> "User Updated" callback, it would work really well.  When the service
> finishes updating a user, it simply notifies the user updated
> callback.  It won't care if it was the original activity/dialog or a
> new one.
>
> Does that sound feasible?
>
> On May 27, 2:22 pm, Streets Of Boston  wrote:
>
>
>
> > Take a look at the method onRetainNonConfigurationInstance() of the
> > Activity class. :-)
>
> >http://developer.android.com/reference/android/app/Activity.html#onRe...()
>
> > On May 27, 2:01 pm, Robert Green  wrote:
>
> > > I have an app that communicates with a server.  While it is
> > > communicating, it shows a progress dialog.  The way this actually
> > > works is that I have a class that I call my NetworkGateway.  Each
> > > method takes a Handler as a callback so that the gateway can send back
> > > the response as a bundle when it has finished.
>
> > > Right now when someone changes orientation while a network operation
> > > is occuring, the activity doesn't know that a thread is running the
> > > network code and then the callback might be invalid.
>
> > > What's the right way to do this?  I want to make it so that after the
> > > orientation switch, the activity can check something to see if a
> > > network operation is running and if so, display the progress dialog
> > > again and wait for the callback, or set itself as the callback handler
> > > now, invalidating the old one.
>
> > > My first guess is that this is exactly the kind of thing services were
> > > designed for, but I'd like specifics if anyone can supply them.
>
> > > Thanks!- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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: What's the best way to handle an task w/progress dialog on orientation change?

2009-05-27 Thread Streets Of Boston

Your steps below are basically correct, but take a look at the API
Demoes source code.
There is one for demoeing how to write a Service, using AIDL.
It also shows how to write a callback method (service calling back
into activities bound to that service).

I use it for monitoring image-upload progress. The activity binds to
the service and registers itself as interested in upload progress.
When the service is uploading images, it calls back to any registered
activity. The activity then updates, on these callbacks, various
progress indicators.

On May 27, 4:33 pm, Robert Green  wrote:
> I'm searching all of the documentation I can find but I'm not seeing
> any mechanism to register for callbacks from a service or to callback
> to whatever handler is registered as the service.
>
> I see the AIDL binding stuff, and so far I think maybe this sort of
> thing might work?
>
> Activity
> -- Starts Service (this is to make the service keep going after this
> context is destroyed)
> -- Binds to Service, calls remote interface to check if the service is
> busy, it's not, so nothing happens.
> - User clicks on form submission
> -- Starts Service (this is to make the service keep going after this
> context is destroyed, it won't hurt to start again because it's
> already running)
> -- Binds to Service, calls remote interface to set self as callback
> handler
> -- Orientation change, destroyed
> New Activity
> -- Starts Service (this is to make the service keep going after this
> context is destroyed)
> -- Binds to Service, calls remote interface to check if the service is
> busy, if so, sets self as callback handler
> -- Service finishes working, calls back and ends itself.
>
> Does this sound correct?  So far as I understand from the APIs, this
> may be the only way to do it.  Please let me know of an easier way if
> one exists!
>
> Thanks!
>
> On May 27, 3:22 pm, Streets Of Boston  wrote:
>
>
>
> > I agree you should use aservice.
> > But for optimization, i would use this method.
>
> > You should have a call to theserviceto query if theserviceis still
> > busy. If so, show a progress dialog and start listening to theservice
> > to know when it no longer is busy (callbackfrom theserviceinto your
> > app)
>
> > On May 27, 4:07 pm, Robert Green  wrote:
>
> > > I just looked at it.
>
> > > 1)  They state that it is only an optimization and that you are not to
> > > rely on the method being called.
>
> > > 2)  My design is a little too complex to use that elegantly.  I do
> > > network calls from multiple activities and some dialogs on those
> > > activities, which need to chain to other actions upon completion.
>
> > > I'm learning about Services right now and I think that if I could have
> > > a networkservicethat I can register a specificcallbackwith, like a
> > > "User Updated"callback, it would work really well.  When theservice
> > > finishes updating a user, it simply notifies the user updated
> > >callback.  It won't care if it was the original activity/dialog or a
> > > new one.
>
> > > Does that sound feasible?
>
> > > On May 27, 2:22 pm, Streets Of Boston  wrote:
>
> > > > Take a look at the method onRetainNonConfigurationInstance() of the
> > > > Activity class. :-)
>
> > > >http://developer.android.com/reference/android/app/Activity.html#onRe...()
>
> > > > On May 27, 2:01 pm, Robert Green  wrote:
>
> > > > > I have an app that communicates with a server.  While it is
> > > > > communicating, it shows a progress dialog.  The way this actually
> > > > > works is that I have a class that I call my NetworkGateway.  Each
> > > > > method takes a Handler as acallbackso that the gateway can send back
> > > > > the response as a bundle when it has finished.
>
> > > > > Right now when someone changes orientation while a network operation
> > > > > is occuring, the activity doesn't know that a thread is running the
> > > > > network code and then thecallbackmight be invalid.
>
> > > > > What's the right way to do this?  I want to make it so that after the
> > > > > orientation switch, the activity can check something to see if a
> > > > > network operation is running and if so, display the progress dialog
> > > > > again and wait for thecallback, or set itself as thecallbackhandler
> > > > > now, invalidating the old one.
>
> > > > > My first guess is that this is exactly the kind of thing services were
> > > > > designed for, but I'd like specifics if anyone can supply them.
>
> > > > > Thanks!- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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: implementation of onDestroy for a service containing a worker or backround thread

2009-05-28 Thread Streets Of Boston

Then you should call join() in onDestroy after calling
myBackgroundThread.stopThread() causing onDestroy to wait until your
background thread to end.

Make sure that your background thread never blocks or takes too long
to shut-down. If onDestroy is waiting too long, your user's ain't
gonna be happy :-)

On May 28, 4:28 am, Gautam  wrote:
> I need to make sure, that onDestroy returns only after proper clean up
> by the background thread.
> Else (according to my understanding) OS may kill the process hosting
> the service before proper cleanup.
--~--~-~--~~~---~--~~
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: Control which items to redraw? (notifyDataSetChanged with a range)

2009-05-28 Thread Streets Of Boston

If it is just a refresh and not an entirely new list or additions/
removals of elements, use notifyDataSetInvalidated() instead. I think
it's a bit more efficient.

But, as far as i know, you can't specifiy a range of elements. But you
can optimize it yourself.
I do this at times using the list-item view's getTag() and setTag()
methods. If the getTag() returns an object that is different than you
would expect (with respect to the list-item's position), refresh the
view's contents. Otherwise, leave it alone.

On May 28, 9:51 am, twan  wrote:
> Goodmorning,
>
> A call to notifyDataSetChanged() on a ArrayAdapter causes all items in
> a listview to redraw. This is quite ineffecient.
>
> At swing you can control which items (or which range of items) redraw.
> Is this also possible with android?
>
> Kind regards,
> TWan
--~--~-~--~~~---~--~~
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: What's the best way to handle an task w/progress dialog on orientation change?

2009-05-28 Thread Streets Of Boston

Hi Mike,

Is it safe to cache a Handler (in a static variable)? Some objects,
such as Activities or Drawables, are not safe to cache statically and
share amongst multiple activity-instances due to possible memory leaks
(memory referencing to destroyed activities that doesn't get cleaned
up in a timely manner).


On May 28, 10:32 am, Mike Hearn  wrote:
> You don't need a Service, that's way too complicated for what you
> need. Especially if you use the RPC stuff (optional but the docs don't
> tell you that!)
>
> If you create the progress dialog using the onCreateDialog() method
> then it'll be automatically reconstructed after an orientation
> change.
>
> To receive callbacks as to progress, you can just send to a static
> Handler. Create the Handler in your onCreate if it's not already
> created, so it's shared between all instances of your activity. Your
> thread can then post updates to it.
>
> When your activity is stopped or paused, you can interrupt() that
> thread to tell it to shut down.
--~--~-~--~~~---~--~~
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: Movie.decodeStream(is) is returning NULL after updating to 1.5 SDK

2009-05-28 Thread Streets Of Boston

Judging from your resource name (gif_animation), it looks like you try
to open an image (gif image) as a movie... If it's not a movie/video,
i'm not entirely surprised that opening it as a movie fails.

(an animated gif is not a movie)

On May 22, 2:52 am, Freshman  wrote:
> I've updated to 1.5 SDK, together with the ADT.
> I followed all the instruction properly.
> Rest of the Projects are working fine.
> but in my current application Movie.decodeStream(inputstream) is
> returning null.
> It was working fine with Android 1.1 version.
>
> Has anyone faced this issue when using 1.5 version ?
> Any info/help on this would be appreciated.
>
> My code is as below.
>
> ---My Code:--
> InputStream is = context.getResources().openRawResource
> (R.drawable.gif_animation);
> Movie movie = Movie.decodeStream(is);
>
> Thanks in advance,
> freshman
--~--~-~--~~~---~--~~
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: Grayscaling

2009-05-28 Thread Streets Of Boston

- Create a mutable bitmap from immutable. But instead of a copy, just
create an empty one with the same width and height as the original
one.
- Create a canvas from this mutable bitmap (new Canvas(mutable));
- Create a ColorFilter object. Set its saturation to 0 (this is one
way of doing this).
  (ColorMatrixColorFilter with a ColorMatrix whose saturation is set
to 0).
- Create a new Paint object and set its color-filter to the
ColorMatrixColorFilter (bwPaint).
- Draw the original bitmap onto the new canvas:
  mutableCanvas.drawBitmap(immutable, 0, 0, bwPaint);
- After this drawBitmap call, the mutable bitmap contains a b&w
version of your original mutable bitmap.

On May 28, 12:00 pm, Gavin Aiken  wrote:
> Hi Marco,
>
> Would you mind giving a brief code snippet of how this might work? I've been
> trying to get a similar function to run faster but when I use the bitmap the
> values I thought were written by the canvas aren't there.
>
> Kind regards,
>
> Gav
>
> On Tue, Apr 21, 2009 at 12:21 AM, Marco Nelissen wrote:
>
>
>
> > You can do this more efficiently by using a Paint and a ColorFilter.
>
> > On Mon, Apr 20, 2009 at 3:59 PM, sm12  wrote:
>
> >> Solved. The problem was in the parameters of Color.rgb.- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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: Control which items to redraw? (notifyDataSetChanged with a range)

2009-05-28 Thread Streets Of Boston

Aha! I stand corrected.
That is not what i understood from the API documentation...

Romain,
could you describe the exact differences (and usage example) of the
two?

Thanks!

About calling 'invalidate()':
Does calling invalidate() on a list-item's View cause the 'getView()'
method of an Adpater to be called?
If i'm not mistaken, getView() does not get called on 'invalidate()'.
But i could be wrong. TWan may need the adapter's getView() to be
called for specific items to properly update the items' views.

On May 28, 12:17 pm, Romain Guy  wrote:
> No, notifyDataSetInvalidated() causes the entire content of ListView
> to disappear. It's even more inefficient than notifyDataSetChanged().
>
> If you want to refresh the content of a specific item, call
> invalidate() on its View. If you changed the content of the Adapter
> though, call notifyDataSetChanged().
>
> --
> Romain Guy
> Android framework engineer
> romain...@android.com
>
> Note: please don't send private questions to me, as I don't have time
> to provide private support.  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: Control which items to redraw? (notifyDataSetChanged with a range)

2009-05-28 Thread Streets Of Boston

Thanks!
The fact that it's used to 'tell the list view to stop using the
adapter' might actually explain an issue i have with a list of images
i show in my own app. :)

On May 28, 12:31 pm, Romain Guy  wrote:
> notifyDataSetInvalidated() is used when the adapter loses all of its
> content. It's there to tell ListView to stop using the adapter
> basically. This is usually invoked when you have a Cursor and you call
> close() on the Cursor.
>
> On Thu, May 28, 2009 at 9:27 AM, Streets Of Boston
>
>
>
>
>
>  wrote:
>
> > Aha! I stand corrected.
> > That is not what i understood from the API documentation...
>
> > Romain,
> > could you describe the exact differences (and usage example) of the
> > two?
>
> > Thanks!
>
> > About calling 'invalidate()':
> > Does calling invalidate() on a list-item's View cause the 'getView()'
> > method of an Adpater to be called?
> > If i'm not mistaken, getView() does not get called on 'invalidate()'.
> > But i could be wrong. TWan may need the adapter's getView() to be
> > called for specific items to properly update the items' views.
>
> > On May 28, 12:17 pm, Romain Guy  wrote:
> >> No, notifyDataSetInvalidated() causes the entire content of ListView
> >> to disappear. It's even more inefficient than notifyDataSetChanged().
>
> >> If you want to refresh the content of a specific item, call
> >> invalidate() on its View. If you changed the content of the Adapter
> >> though, call notifyDataSetChanged().
>
> >> --
> >> Romain Guy
> >> Android framework engineer
> >> romain...@android.com
>
> >> Note: please don't send private questions to me, as I don't have time
> >> to provide private support.  All such questions should be posted on
> >> public forums, where I and others can see and answer them
>
> --
> Romain Guy
> Android framework engineer
> romain...@android.com
>
> Note: please don't send private questions to me, as I don't have time
> to provide private support.  All such questions should be posted on
> public forums, where I and others can see and answer them- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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: Grayscaling

2009-05-28 Thread Streets Of Boston

Are you sure your canvas' clip-rect is not empty?
Most calls to Canvas.clip() *intersect* with the old clip-
rect... not replace the old clip-rect.
Call Canvas.getClipBounds() to make sure.

On May 28, 2:44 pm, Gavin Aiken  wrote:
> Thanks for the fast response. I can't seem to saw the changes made by the
> canvas in the original bitmap, my code is as follows;
>
>         int old = input.getPixel(0, 0);
>         Canvas c = new Canvas(input);
>         c.drawARGB(a, r, g, b);
>         int n = input.getPixel(0, 0);
>         if(old==n)
>             Log.e(TAG, "Values didn't change!"); // Fires
>         return input;
>
> 'input' is mutable but the returned bitmap retains it's old values. The
> 'clip' Rect is the size of the bitmap.
>
> Do you know why this is the case?
>
> I'm looking for a finalize or save on the canvas but they don't seem to do
> the job.
>
> Kind regards,
> Gav
>
> On Thu, May 28, 2009 at 5:19 PM, Streets Of Boston
> wrote:
>
>
>
>
>
> > - Create a mutable bitmap from immutable. But instead of a copy, just
> > create an empty one with the same width and height as the original
> > one.
> > - Create a canvas from this mutable bitmap (new Canvas(mutable));
> > - Create a ColorFilter object. Set its saturation to 0 (this is one
> > way of doing this).
> >  (ColorMatrixColorFilter with a ColorMatrix whose saturation is set
> > to 0).
> > - Create a new Paint object and set its color-filter to the
> > ColorMatrixColorFilter (bwPaint).
> > - Draw the original bitmap onto the new canvas:
> >  mutableCanvas.drawBitmap(immutable, 0, 0, bwPaint);
> > - After this drawBitmap call, the mutable bitmap contains a b&w
> > version of your original mutable bitmap.
>
> > On May 28, 12:00 pm, Gavin Aiken  wrote:
> > > Hi Marco,
>
> > > Would you mind giving a brief code snippet of how this might work? I've
> > been
> > > trying to get a similar function to run faster but when I use the bitmap
> > the
> > > values I thought were written by the canvas aren't there.
>
> > > Kind regards,
>
> > > Gav
>
> > > On Tue, Apr 21, 2009 at 12:21 AM, Marco Nelissen  > >wrote:
>
> > > > You can do this more efficiently by using a Paint and a ColorFilter.
>
> > > > On Mon, Apr 20, 2009 at 3:59 PM, sm12  wrote:
>
> > > >> Solved. The problem was in the parameters of Color.rgb.- Hide quoted
> > text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
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: Killi Process with files on SD card

2010-07-14 Thread Streets Of Boston
It works fine for me on my motorola droid, nexus one and G1.
Did you properly register your broadcast receiver, both in code and in
the Android Manifest XML?

On Jul 13, 7:21 pm, ls02  wrote:
> I tried this on Motorola DROID and it does not work. I do not receive
> any events in receiver onReceive.
>
> On Jul 10, 9:23 pm, Streets Of Boston  wrote:
>
>
>
> > Register your broadcast receiver like this:
>
> > IntentFilter intentFilter = new
> > IntentFilter(Intent.ACTION_MEDIA_EJECT);
> > intentFilter.addAction(Intent.ACTION_MEDIA_MOUNTED);
> > intentFilter.addDataScheme("file");
> > intentFilter.addDataAuthority("*", null);
> > intentFilter.addDataPath((mIsExternal
> >                            ?CursorUtils.EXTERNAL_STORAGE_ROOT
> >                            
> > :CursorUtils.PHONE_STORAGE_ROOT).getAbsolutePath(),
> > PatternMatcher.PATTERN_LITERAL);
> > context.registerReceiver(this, intentFilter);
>
> > Then close all your files when you get an ACTION_MEDIA_EJECT
> > and re-open them (if necessary) on ACTION_MEDIA_MOUNTED.
> > (in the 'public void onReceive(Context context, Intent intent)' method
> > of this broadcast receiver).
>
> > (EXTERNAL_STORAGE_ROOT is the standard value for external-storage
> > (usually "/sdcard") and PHONE_STORAGE_ROOT is "/emmc" (for HTC
> > Incredible and such phones)).
>
> > I'm not sure if this is the 'official' way of doing it, but it works
> > for me. :)
>
> > On Jul 10, 3:50 pm, ls02  wrote:
>
> > > I register for this broadcast. However the process is killed before I
> > > receive any broadcast event.
>
> > > On Jul 10, 2:59 pm, Dianne Hackborn  wrote:
>
> > > > There is a broadcast sent when the SD card is being unmounted (sorry I 
> > > > don't
> > > > remember the name off-hand).  You should close all your files at that 
> > > > point.
> > > >  If you don't, the platform needs to kill the process because Linux 
> > > > can't
> > > > unmount the file system while any files remain open on it.
>
> > > > On Sat, Jul 10, 2010 at 10:35 AM, ls02  wrote:
> > > > > I found that Android kills my app process that has files open on SD
> > > > > card when the card is mounted when the device connects to a computer.
> > > > > It is done without any notification, I see in the log something like
> > > > > KillProcessWithFilesOpenedOnCard message, my app receives no
> > > > > notification, has no chance to gracefully shutdown. Moreover Android
> > > > > restarts my app immediately after killing it with latest Activity not
> > > > > the default activity launched in default standard mode. It does it
> > > > > while the card is still mounted and device is still connected to a
> > > > > computer.
>
> > > > > Can someone explain this all to me, how it I supposed to work, and if
> > > > > there is any way to alter this weird rude behavior? Particularly, if
> > > > > there is way to get any notification before the process is killed by
> > > > > the OS and to prevent relaunching it while the card is still mounted?
>
> > > > > --
> > > > > 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.- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -

-- 
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: Best way to logout each time the application/task goes to background

2010-07-16 Thread Streets Of Boston
You have no control over the application and/or activity life cycle.
This will make is very hard to determine when the user 'exits' the
app.

I would do this:
1. Consider an explicit 'log-out' option for your users.
2. Add a time-out to your login-sessions. Refresh the session (time-
out) when the user interacts with your app/server. But when the user
hasn't interacted with your app/server for a given amount of time, the
user's session will have had a time-out and this then would require
the user to login again.

On Jul 16, 4:09 am, "Kim D."  wrote:
> Hello,
>
> I have an application which requires a login at the beginning (this is
> the first activity). When the user logs in, I keep his credentials in
> the application (I extended android.application to add a field called
> 'key'). I would like to clear this field from memory (from application
> instance) an go back to the login activity.
>
> I see the following possibilities:
> - Add a broadcast receiver to catch all possible event (call, click on
> menu, click on back, lock the phone ...) which clear the key field and
> launch the login activity
> - Use clearTaskOnLaunch for all activities except the login activity.
> But then until my application takes the focus again the key stays in
> the application object. (It seems it doesn't work with the go back
> button, maybe I need to use no history also)
> - Detect for each activity in all onPause or onStop events when
> application will leave the foreground
>  to clear the key field and launch the login activity
>
> The best would be to have a kind of OnPause method at application
> level but I think it doesn't exist
>
> I would appreciate any help on this problem.
>
> ps: I already posted it once but never saw it on the discussions list.
>
> Cheers,
> Kim

-- 
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


<    3   4   5   6   7   8   9   10   11   12   >