[android-developers] Re: How to make apk from .java, png files extracted from jar

2011-06-08 Thread Doug
On Jun 8, 10:33 pm, Rajender  wrote:
> How can i generate a build.xml ?

It's created for you when you create a new android project using the
latest tools.  Keep reading the docs.

Doug

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


[android-developers] How to know the SIM Operator information before LauncherProvider.java execute ( in Gingerbread)

2011-06-08 Thread Abhishek Kumar Gupta
How to know the SIM Operator information before the loadfavorities() method 
in LauncherProvider.java execute( /home/abhishek/gingerbread/
packages/apps/Launcher2/src/com/android/launcher2/LauncherProvider ) , so 
that I can use SIM Operator information.
Currently, I am using *Thread.sleep(5000)*  to get the SIM operator 
information in LauncherProvider.java, is there any alternative?
Please help me.

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

Re: [android-developers] Delete a variable

2011-06-08 Thread Simon Platten
Java may not garbage collect until resources are low and it knows that an
object is no longer in use.  Make sure that you assign your object to null
or ensure it goes out of scope then java wilĺ treat it as no longer
referenced.

Regards,Sy

On 9 Jun 2011 04:11, "TreKing"  wrote:

On Wed, Jun 8, 2011 at 9:05 PM, New Developer  wrote:
>
> Bitmap  pictBM = Bitma...
Don't hard code the SD card path - that's not portable.



>
> In c++ there is  .free()  or  .destroy()  call
> What do you use in android ?

Start here:
http://developer.android.com/reference/android/graphics/Bitmap.html#recycle()

-
TreKing  - Chicago
transit tracking app for Android-powered devices



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

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

2011-06-08 Thread Raghav Sood
Hi all,

I have waited for a while and have had no response from all of you. So I am
trying again. Could you all help in making this wiki? Anthing android
related is welcome on it.
http://wiki.androidappcheck.com/

Thanks

-- 
Raghav Sood
http://www.raghavsood.com/
http://www.androidappcheck.com/
http://www.telstop.tel/

-- 
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: webservice php

2011-06-08 Thread tamer hatoum
Actually I am new in such applications , I donot know how to extract
and bind the data to listview, and I don't know how to make on-click
event depending on the item Id, but I can prepare the php page which
returns the data...
if there is any sample code would be appreciated...
regards...

On Jun 9, 4:28 am, Kristopher Micinski  wrote:
> On Wed, Jun 8, 2011 at 4:41 PM, tamer hatoum wrote:
>
> > while extracting using httprequest  and binding to listview and  make
> > items clickable to open the PDF file 
> > regards...
>
> Typically what you will do is download the source, parse it, stuff it in a
> listview, and make the handler open up the pdf's when clicked.
>
> So the first part you'll have to deal with is parsing.  Are you downloading
> raw HTML?
>
> Kris

-- 
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 make apk from .java, png files extracted from jar

2011-06-08 Thread Rajender
Hello, Doug,

Thanks for your info.

It will be helpful if i can get a example.

How can i generate a build.xml ?

Regards,

Rajender

On Jun 9, 4:26 am, Doug  wrote:
> On Jun 7, 4:32 am, Rajender  wrote:
>
> > I want to do all these using batch file (command line)..
>
> Use ant.
>
> http://developer.android.com/guide/developing/building/index.html
>
> Doug

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


[android-developers] problem with ontouch of surfaceview

2011-06-08 Thread grace
Hi,

I have my layout like this


   
   









I have registered onTouch Listeners for all the views.The LinearLayout
is made invisible at first(default).
Now when i touch the surface view the LinearLayout should be made
visible.
but somehow its not visible after ontouch also.

When the LinearLayout is visible at first(default),then i can make it
invisible and visible from the ontouch events.

Can anybody help me on this.Am i missing something.

thanks in advance,
Grace.

-- 
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] Mp3 player Forward functionality

2011-06-08 Thread Abhishek Akhani
Hi,

I am trying to make an MP3 player in android. Can anyone please
suggest me how to forward a media file on forward button click??? i
mean is there any way to set progress of that running media file :(

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


Re: [android-developers] Delete a variable

2011-06-08 Thread TreKing
On Wed, Jun 8, 2011 at 9:05 PM, New Developer  wrote:

> Bitmap  pictBM = BitmapFactory.decodeFile("/sdcard/DCIM/"+CURRENT_IMAGE);
>

Don't hard code the SD card path - that's not portable.


> In c++ there is  .free()  or  .destroy()  call
> What do you use in android ?
>

Start here:
http://developer.android.com/reference/android/graphics/Bitmap.html#recycle()

-
TreKing  - Chicago
transit tracking app for Android-powered devices

-- 
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: 3G-324M protocol

2011-06-08 Thread Tsahi Levent-Levi
sivakumar  gmail.com> writes:

> 
> anybody know how android is facing difficulties with 3G-324M
> protocol..
> i need some articles that shows interfacing architecture of android
> with 3G-324M protocol..
> and also working principle of 3G-324M  architecture  with  android
> mobiles..
> if u have any idea ,kindly share with me...
> thank you in advance.
> 

Sivakumar,

3G-324M requires a tight integration between operating system, modem and 
application. As such, most operating systems simply don't supply it as a
built-in feature.
While Android has parts of a 3G-324M stack in its source code it is far from 
enough in order to build a solution. One of the companies that offer a 3G
video telephony application for Android is RADVISION (where I work).
We have successfully launched with customers several handsets to the market 
already.
You can read more about it here: 
http://www.radvision.com/Resources/Developers/White-Papers/android_integration.htm

Regards,
Tsahi Levent-Levi
CTO, TBU
RADVISION

-- 
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] Replicating the results of the deprecated Sensor.TYPE_ORIENTATION

2011-06-08 Thread Sheado
Hi All,

I've been using SensorManager with Sensor.TYPE_ORIENTATION for its
pitch/roll values. I want to update the code to support multiple
screen orientations (and while I'm at it get rid of some deprecated
code).

My current solution is below. The main problem with it, is that if I
set the phone down on the table, the roll does not go to 0. With some
phones, it stays were it last was before being set down. With others,
it fluctuates (noticeably) around some value.

I've tried looking for the deprecated source in the Android git
source, but could not find exactly where things were being stabilized.
Any help would be appreciated! Maybe somebody at Google could post the
deprecated code?
(please excuse the messy/unoptimized code below:)
public void onSensorChanged( SensorEvent event )
{
switch( event.sensor.getType() )
{
case Sensor.TYPE_ACCELEROMETER:
if( gravity == null )
gravity = event.values.clone();
// would it help to calculate alpha
every time?
final float alpha = 0.8f;
gravity[0] = alpha * gravity[0] + (1 - alpha) * 
event.values[0];
gravity[1] = alpha * gravity[1] + (1 - alpha) * 
event.values[1];
gravity[2] = alpha * gravity[2] + (1 - alpha) * 
event.values[2];
boolean b = SensorManager.getRotationMatrix( R, 
null, gravity,
geomagnetic );
if( b )
{
switch( rotation )
{
case Surface.ROTATION_0:
case Surface.ROTATION_180:

SensorManager.remapCoordinateSystem( R,
SensorManager.AXIS_MINUS_X, SensorManager.AXIS_Z, outR );
break;
case Surface.ROTATION_90:
case Surface.ROTATION_270:

SensorManager.remapCoordinateSystem( R, SensorManager.AXIS_Z,
SensorManager.AXIS_X, outR );
break;
}
SensorManager.getOrientation( outR,
values );
roll = (float) Math.toDegrees( 
values[2] );
}
break;
case Sensor.TYPE_MAGNETIC_FIELD:
geomagnetic = event.values.clone();
break;
}
}

Thanks!
-Sheado

-- 
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] Is there any way I can start activity running in different process using Instrumentation?

2011-06-08 Thread Amit Dixit
Hi,

My application uses multiple activities which runs in different process. Is
there any way I can test it using Instrumentation?

Best Regards,


Amit Dixit

-- 
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] Delete a variable

2011-06-08 Thread New Developer
I have an ImageView  that I keep changing the picture

Bitmap  pictBM = BitmapFactory.decodeFile("/sdcard/DCIM/"+CURRENT_IMAGE);
image.setImageBitmap(pictBM);
parent.addView(image);

After  4 or 5 pictures I get a OutOfMemory crash

In c++ there is  .free()  or  .destroy()  call
What do you use in android ?

What is the best way to clean up and free the variables once used ??
like pictBM and  image ?

Thanks 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

Re: [android-developers] Re: HTML ImageGetter not working, showing a square with text "obj"

2011-06-08 Thread Kostya Vasilyev
With one TextView per line, a compound drawable on the left side should work
very well.

--
Kostya Vasilyev
09.06.2011 3:20 пользователь "Doug"  написал:
> What is the data type of "directions" and what are you doing with it
> after you assign it?
>
> It looks like you're doing string concat with it, which means
> everything is getting converted to a String, including the output from
> Html.fromHtml, which probably means that the image is getting stripped
> out. Strings can't contain images. You need to retain the Spannable
> interface and work with that or assemble the whole thing differently.
>
> Doug
>
> On Jun 7, 1:02 pm, Agnes Despicable Me  wrote:
>> directions += Html.fromHtml("", imageGetter, null)
>> + " Turn to left\n";
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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

[android-developers] Re: Android LifeCycle and Singleton Instances

2011-06-08 Thread Chris
What you quoted is quintessential initialization on-demand holder.  And its 
supposed to be more like _eager_ init, not lazy init.

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

Re: [android-developers] Re: webservice php

2011-06-08 Thread Kristopher Micinski
On Wed, Jun 8, 2011 at 4:41 PM, tamer hatoum wrote:

> while extracting using httprequest  and binding to listview and  make
> items clickable to open the PDF file 
> regards...
>

Typically what you will do is download the source, parse it, stuff it in a
listview, and make the handler open up the pdf's when clicked.

So the first part you'll have to deal with is parsing.  Are you downloading
raw HTML?

Kris

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

Re: [android-developers] Re: Use of the Resource reference "?" when setting widget attributes.

2011-06-08 Thread Kostya Vasilyev
For dynamically changing the theme, you can call setTheme in your
activities' onCreate, before calling "super".

--
Kostya Vasilyev
09.06.2011 3:06 пользователь "Danny D"  написал:
> I think that may be where we're getting mixed up.
>
> I've created a style tree that follows the SDK recommendations like
> this. It follows inheritance, using the "." notation, just like the
> examples in the SDK
>
> MyCompanyStyle
> |
> MyCompanyStyle.Header
> | |
> | MyCompanyStyle.Header.Bold
> |
> MyCompanyStyle.Footer
> | |
> | MyCompanyStyle.Footer.Bold
> |
> MyCompanyStyle.etc
>
>
> Previously, at the individual View and ViewGroup level, I set the
> styles of the Views as shown previously with "style="@style/
> MyCompany.Footer.Bold"
>
> What I'd like to do is to change the individual attributes of the
> style, for instance the sizes, fonts, colors and whatnot within the
> "MyCompany" style tree at application startup time while still keeping
> the "style=" notation within the Views and ViewGroups in my
> layouts.
>
> How can I change the style elements within the "MyCompany" tree?
> Alternatively, how can I create two style trees "MyCompany_Style_A"
> and "MyCompany_Style_B", and have the Views and ViewGroups reference
> whichever one is currently selected? Should I just have multiple
> layouts and inflate them within onCreate()?
>
> It seems that the entire Theme / Style model relies on starting at one
> fixed point and branching out. Is there any way I can let the style
> referenced in the Views be a variable rather fixed?
>
> Thanks for the help, I really appreciate it.
>
> DD
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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

[android-developers] Re: Fonts on Android, how are they manage by the OS?

2011-06-08 Thread Chris
That's awful.  My HTC Magic which came out in 2009 supports ~40 
languages/varieties.

-- 
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: Fonts on Android, how are they manage by the OS?

2011-06-08 Thread Zsolt Vasvari
But even my Xoom only includes 3 languages so it's almost useless for
testing translations -

On Jun 9, 12:04 am, Dianne Hackborn  wrote:
> Nexus One has a smaller partition for the system image, so can't fit every
> possible thing.  New translations were added to the platform after the
> initial Nexus One release, but those new translations are not included on N1
> due to the limited space.
>
>
>
>
>
>
>
>
>
> On Wed, Jun 8, 2011 at 7:41 AM, Paolo  wrote:
> > yes those fonts are for the last platform, I guess Gingerbread that
> > provides an extended language support.
> > However I noticed something strange... On my Nexus S there are a lot
> > of languages supported selectable, on the other hand on my Nexus One
> > (always 2.3.4) there are only a subset of those.
>
> > I expected they were the same... I am a bit confused! :|
>
> > On 8 Giu, 12:23, James Ots  wrote:
> > > Here are the fonts in the android source.
>
> > >http://android.git.kernel.org/?p=platform/frameworks/base.git;a=tree;...
>
> > > These are listed in the makefile
>
> > > DroidSans.ttf
> > > DroidSans-Bold.ttf
> > > DroidSansArabic.ttf
> > > DroidSansHebrew.ttf
> > > DroidSansThai.ttf
> > > DroidSerif-Regular.ttf
> > > DroidSerif-Bold.ttf
> > > DroidSerif-Italic.ttf
> > > DroidSerif-BoldItalic.ttf
> > > DroidSansMono.ttf
> > > Clockopia.ttf
>
> > > Although I can't see any guarantee that these will be there, I think you
> > can probably assume that any Compatible Android device will have these fonts
> > available.
>
> > > James
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.

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


Re: [android-developers] Re: Want to capture screenshot of current screen from phone

2011-06-08 Thread Adam Ratana

Reporting back, as far as specifically capturing camera preview output to a 
bitmap and following the prior examples to draw, this is definitely 
possible.  There's some interesting things going on that may be helpful for 
others:

1. Camera preview size varies, some phones (such as the Samsung Galaxy S) 
support full-screen preview sizes.
2. Full screen preview sizes are not in the same aspect ratio as the camera 
image itself (on the galaxy s, it's 4:3, pretty standard for consumer 
digi-cams)
3. The full screen preview appears to be non-distorted, in that, it appears 
to be a slightly zoomed and cropped subset of the actual image buffer. 
 Taking a picture from the same preview reveals that more of the scene is 
captured.  This is important to note for those whom approximate knowledge of 
field of view is important.
4. Getting the main view which contains all views and simply drawing that to 
a bitmap does not work, because the camera surfaceview comes out blank.  So, 
we get a handle on the main containing view, which will indicate the final 
image size.  Get a handle on everything but the camera preview.  This might 
be a layout directly after the camera preview in a relativelayout which 
wraps everything else.  Create a bitmap from the camera view, downscale it 
(and possibly more as below), place it onto a bitmap the size of the 
containing view, then draw to that bitmap from the handle on everything but 
the camera preview.

Looks like there's 2 options as far as "screenshotting" a screen with a 
camera preview and other items on top (for example, an augmented reality 
scenario with simple non-openGL canvas drawing on top, some buttons etc)

a. Use Camera.takePicture() and Camera.PictureCallback.onPictureTaken(). 
 With the resulting image, scale it down, but to match the exact preview 
image, it must be zoomed and cropped accordingly, not sure if the crop 
position varies by device.  Copy the pixels into a bitmap the size of the 
containing view. 

b. Implement Camera.PreviewCallback and onPreviewFrame().  This seems the 
most raw method to use, and caution must be taken.  For 2.2+ (and 2.1 using 
reflection) it looks like there's some other ways to do this more 
efficiently - http://code.google.com/p/android/issues/detail?id=2794 

I may try option B and profile it to see if it's worth it.  Option A seems 
to work pretty well other than the scaling ickyness, and not knowing what's 
going to happen on other phones.

Don't know if this is any more helpful to anyone, it's basically integrating 
a few things from around, but this seems to work okay for Camera previews at 
least.


On Wednesday, June 8, 2011 2:11:19 PM UTC-4, Mark Murphy (a Commons Guy) 
wrote:
>
> On Wed, Jun 8, 2011 at 2:07 PM, Adam Ratana  wrote:
> > Mark Murphy, you said this is impossible, did you mean in the sense of 
> the
> > way DDMS grabs the full-monty screenshot?
>
> Um, for some definition of "full-monty", I presume, yes. :-)
>
> > I do hope that Android Handset/Tablet manufacturers catch on and 
> implement
> > hardware screen capturing options, a la iOS -- I don't believe 
> screenshots
> > are programmatically possible there either, for the same reasons, but the
> > user can capture one at any time with a combination of hardware buttons. 
>  It
> > will prevent us from having to come up with adhoc solutions like this, 
> and
> > allow the screenshot process to be user driven, and thus alleviating
> > security concerns.  I believe I read that either Samsung or Motorola may 
> do
> > this in future handsets?
>
> I haven't heard anything about that.
>
> -- 
> Mark Murphy (a Commons Guy)
> http://commonsware.com | http://github.com/commonsguy
> http://commonsware.com/blog | http://twitter.com/commonsguy
>
> Android 3.0 Programming Books: http://commonsware.com/books
>
>

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

Re: [android-developers] two questions from a newbie

2011-06-08 Thread Mark Murphy
On Wed, Jun 8, 2011 at 8:30 PM, Knutsford Software
 wrote:
> Sorry - what do you mean by stuff the form contents into the Bundle

http://developer.android.com/guide/topics/fundamentals/activities.html#SavingActivityState

> For part two I meant if you have been browsng and then it loses focus then
> you resume it you  I presume can't pick up the url you had browsed to - you
> have to start from scratch?

"You" were not browsing -- the user was. "You" do not have a way to
know where the user went in a browser, for obvious privacy reasons. If
you need that level of control, embed a WebView into an activity.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android 3.0 Programming Books: http://commonsware.com/books

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


Re: [android-developers] two questions from a newbie

2011-06-08 Thread Knutsford Software


- Original Message - 
From: "Mark Murphy" 

To: 
Sent: Wednesday, June 08, 2011 11:24 PM
Subject: Re: [android-developers] two questions from a newbie



On Wed, Jun 8, 2011 at 6:14 PM, Knutsford Software
 wrote:

1) If you have a form in in app what do you do if the app goes into the
background while you are in the middle of completing the form? Do you 
need
to do something in OnResume or will it resume in the state that you left 
it

in before it went into the background?


At minimum, when onSaveInstanceState() is called, stuff the form
contents into the Bundle, at least for widgets where that is not
handled automatically.

You may also consider whether you should persist the form contents to
a temporary file or something, in case your activity is destroyed
before the user comes back to it.


2) If you have something like



Intent i =

new
Intent(Intent.ACTION_VIEW);

i.setData(Uri.parse(uri));

startActivity(i);



in OnCreate what do you do about OnResume so that the browser is pointing 
to

where it was when it was left or do you have to start it again


I'm sorry, but I don't follow this part at all. If you call
startActivity() on a URL, the default browser will display that URL.
Period.







Sorry - what do you mean by stuff the form contents into the Bundle






For part two I meant if you have been browsng and then it loses focus then 
you resume it you  I presume can't pick up the url you had browsed to - you 
have to start from scratch?



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


Re: [android-developers] Re: noob Q :-/ regarding global variable - declared the application class but...

2011-06-08 Thread Mark Murphy
On Wed, Jun 8, 2011 at 8:23 PM, Streets Of Boston
 wrote:
> If this is what you currently do:
> In your Activity, you call a method that winds up parsing some XML. Then you
> have implement an xml-handler (content-handler), that has no idea of how to
> get at the 'current activity'... And you need that activity (or at least the
> application-context associated with that activity) to get some data
> (strings, integers and such) from the resources (/res directory). Is this
> correct?

If it is, just pass the Activity into the constructor of the
ContentHandler, and get rid of the static data member/custom
Application class.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android 3.0 Programming Books: http://commonsware.com/books

-- 
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: noob Q :-/ regarding global variable - declared the application class but...

2011-06-08 Thread Streets Of Boston
If this is what you currently do:

In your Activity, you call a method that winds up parsing some XML. Then you 
have implement an xml-handler (content-handler), that has no idea of how to 
get at the 'current activity'... And you need that activity (or at least the 
application-context associated with that activity) to get some data 
(strings, integers and such) from the resources (/res directory). Is this 
correct?

One way of doing this is to create a class that just holds global vars:
public abstract class GlobalVars {
public Activity currentActivity = null;
}


Just before you start parsing your XML in your Activity' code:
   *GlobalVars.currentActivity* = this; // where 'this' is your activity.
   ...
   parseSomeXmlFile(xmlFile);
   ...

And, an example, in your XML-handler called while your xmlFile is being 
parsed:
   *GlobalVars.currentActivity*.getString(R.string.some_string_id);

If you need to make it thread-safe, I suggest you using ThreadLocal instead 
to store the 'currentActivity' or some other 'Context' variable. 


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

Re: [android-developers] Re: noob Q :-/ regarding global variable - declared the application class but...

2011-06-08 Thread Mark Murphy
On Wed, Jun 8, 2011 at 7:55 PM, Duskox  wrote:
> Ok, I have an idea. Since I have a myXMLHandler object I will create a
> public function in it that will fill a temporary ArrayList and return
> it to me through this function. Then I will just put it in my
> Application object. Only thing is that this way I can not use the
> object I defined in myApp class...unless I pass my Application object
> to myXMLHandler first :)
>
> Ok that solves it I guess but if there is a better way to do this data
> passing please do write.

Well, it's impossible to tell you "if there is a better way to do this
data passing". Most likely, there is. However, it is completely
unclear what you are "passing" data between.

I was merely pointing out that an Application object is not a
significant improvement over static data members, at the cost of being
more difficult to access. You still have all the standard memory leak
issues, whether the data is held in an Application or in static data
members, for example.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android 3.0 Programming Books: http://commonsware.com/books

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


[android-developers] Re: EditText stops displaying characters as I'm typing?

2011-06-08 Thread Eric Carman
I've submitted a bug report. I don't know what to do about going further 
with this. 

I setup an inherited class so that I could throw some logging into the 
EditText in hopes of finding a pattern or blip. No joy.

Bug: 17508

Please feel free to elaborate or correct anything I might have said.

Thank you.

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

[android-developers] Re: noob Q :-/ regarding global variable - declared the application class but...

2011-06-08 Thread Duskox
Ok, I have an idea. Since I have a myXMLHandler object I will create a
public function in it that will fill a temporary ArrayList and return
it to me through this function. Then I will just put it in my
Application object. Only thing is that this way I can not use the
object I defined in myApp class...unless I pass my Application object
to myXMLHandler first :)

Ok that solves it I guess but if there is a better way to do this data
passing please do write.

On Jun 9, 1:47 am, Duskox  wrote:
> Well I used Application because I thought it would be easily
> accessible...but it's not.
>
> If I declare for example a static variable in my Activity class, I
> will still have trouble accessing it since the handler for XML is not
> being called by me, in that case I would just pass the variable, but I
> provide myXMLHandler class as a handler to XMLReader object. Then when
> this XMLReader object is going to parse the XML it uses myXMLHandler
> and in myXMLHandler I have no access to variables in Activity class,
> static or not. Am I making sense? :D

-- 
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: noob Q :-/ regarding global variable - declared the application class but...

2011-06-08 Thread Duskox
Well I used Application because I thought it would be easily
accessible...but it's not.

If I declare for example a static variable in my Activity class, I
will still have trouble accessing it since the handler for XML is not
being called by me, in that case I would just pass the variable, but I
provide myXMLHandler class as a handler to XMLReader object. Then when
this XMLReader object is going to parse the XML it uses myXMLHandler
and in myXMLHandler I have no access to variables in Activity class,
static or not. Am I making sense? :D

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


Re: [android-developers] noob Q :-/ regarding global variable - declared the application class but...

2011-06-08 Thread Mark Murphy
On Wed, Jun 8, 2011 at 7:34 PM, Duskox  wrote:
> so here I am again with a problem. I have declared a class that
> extends Application class and in there I have some variables that I
> want to access from wherever I am. But, the problem is that I have
> several classes that I use but are not extending the Activity class so
> I can not do this.getApplication() as there is no such function. I
> tried to simply implement Application class in those classes but that
> seemed to easy and did not work, but I had to try it out.

Why use Application, instead of static data members?

> From my main View class I call a function for parsing an XML file.
> This function is in myXMLHandler class that extends DefaultHandler
> class. In there, I want to add everything I read to an array that is
> in my Application class, but I don't know a way to get to it??

Why use Application, instead of static data members?

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android 3.0 Programming Books: http://commonsware.com/books

-- 
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] noob Q :-/ regarding global variable - declared the application class but...

2011-06-08 Thread Duskox
Hi all,

so here I am again with a problem. I have declared a class that
extends Application class and in there I have some variables that I
want to access from wherever I am. But, the problem is that I have
several classes that I use but are not extending the Activity class so
I can not do this.getApplication() as there is no such function. I
tried to simply implement Application class in those classes but that
seemed to easy and did not work, but I had to try it out.

This is the situation I have.

>From my main View class I call a function for parsing an XML file.
This function is in myXMLHandler class that extends DefaultHandler
class. In there, I want to add everything I read to an array that is
in my Application class, but I don't know a way to get to it??

Any ideas? I could just create lots of variables here and there and
get it passed around but that seems messy and memory consuming.

Thanks for the help!

D.

-- 
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 make apk from .java, png files extracted from jar

2011-06-08 Thread Doug
On Jun 7, 4:32 am, Rajender  wrote:
> I want to do all these using batch file (command line)..

Use ant.

http://developer.android.com/guide/developing/building/index.html

Doug

-- 
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 the "Share" options in android Gallery app are sorted

2011-06-08 Thread Doug
On Jun 7, 4:56 am, Zulfiqar  wrote:
> what i need is my application should be among top positions in that
> share menu 
> is it possible, ??? well i think so its possible but dont know wat to
> be done, be coz it isnt in the order of installation of
> application...
> Plz urgent help required

I don't think you can change the order without changing Android or
Gallery source code.

Doug

-- 
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: HTML ImageGetter not working, showing a square with text "obj"

2011-06-08 Thread Doug
What is the data type of "directions" and what are you doing with it
after you assign it?

It looks like you're doing string concat with it, which means
everything is getting converted to a String, including the output from
Html.fromHtml, which probably means that the image is getting stripped
out.  Strings can't contain images.  You need to retain the Spannable
interface and work with that or assemble the whole thing differently.

Doug

On Jun 7, 1:02 pm, Agnes Despicable Me  wrote:
> directions += Html.fromHtml("", imageGetter, null)
> + " Turn to left\n";

-- 
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: Error with XML parsing??

2011-06-08 Thread Duskox
Oh yes, not only slapping my hand on my forehead but slapping myself
with a large trout :D

-- 
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 LifeCycle and Singleton Instances

2011-06-08 Thread gjs
Hi,

Agreed, that is why I said the 'book'.

Regards

On Jun 8, 9:07 pm, Mark Murphy  wrote:
> On Tue, Jun 7, 2011 at 9:05 PM, gjs  wrote:
> > I saw an interesting variation 
> > inhttp://www.deelin.com/downloads/books/java_concurrency_in_practice.pdf
> > on Page 213 -
>
> :: snip ::
>
> > The book is well worth reading btw.
>
> It's even better when you buy it, rather than download a pirated copy.
> This book is available from bookstores (online and physical), or via
> Safari.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android 3.0 Programming Books:http://commonsware.com/books

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


Re: [android-developers] Re: ADT 11.0.0

2011-06-08 Thread Xavier Ducrohet
I'm a bit surprised this used to work. I'll double check.

On Wed, Jun 8, 2011 at 2:50 PM, Abhishek Akhani
 wrote:
> Thanks for replying Xavier...
>
> You are right i am trying to add the reference from the property
> sheet... in previous versions i was able to choose ids from this sheet
> through dialog but now
> i have to write it through XML code I did it through manually
> writing but it takes more time :( .
>
>
>
>
> On Jun 9, 2:38 am, Xavier Ducrohet  wrote:
>> I'm guessing you're trying to add the reference from the property
>> sheet through the dialog that pops-up when you click the "..." button?
>>
>> If this is the case then this "reference chooser" dialog does not in
>> fact show any id. This does not prevent you from setting them though,
>> just manually type @id/foo
>> If you're doing something else, then please give us more info.
>>
>> thanks
>> Xav
>>
>> On Wed, Jun 8, 2011 at 10:16 AM, abhishek akhani
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>  wrote:
>> > Hi
>>
>> > Today i downloaded ADT 11.0.0 and now when i am adding any view to
>> > Relative layout i am having problem adding it. Like i can not find any
>> > id to reference as a "align bottom" or "Layout Right of" property..
>> > when i try to set these properties it shows me
>> > Drawables,Arrays,Strings,Layout - ids but i am not able to get view-
>> > ids anywhere which i need... is this a bug or what? Is there any
>> > one to explain???
>>
>> > --
>> > 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
>>
>> --
>> Xavier Ducrohet
>> Android SDK Tech Lead
>> Google Inc.http://developer.android.com|http://tools.android.com
>>
>> Please do not send me questions directly. 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
>



-- 
Xavier Ducrohet
Android SDK Tech Lead
Google Inc.
http://developer.android.com | http://tools.android.com

Please do not send me questions directly. 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: Use of the Resource reference "?" when setting widget attributes.

2011-06-08 Thread Danny D
I think that may be where we're getting mixed up.

I've created a style tree that follows the SDK recommendations like
this.  It follows inheritance, using the "." notation, just like the
examples in the SDK

MyCompanyStyle
  |
  MyCompanyStyle.Header
  |  |
  |  MyCompanyStyle.Header.Bold
  |
  MyCompanyStyle.Footer
  |  |
  |  MyCompanyStyle.Footer.Bold
  |
  MyCompanyStyle.etc


Previously, at the individual View and ViewGroup level, I set the
styles of the Views as shown previously with "style="@style/
MyCompany.Footer.Bold"

What I'd like to do is to change the individual attributes of the
style, for instance the sizes, fonts, colors and whatnot within the
"MyCompany" style tree at application startup time while still keeping
the "style=" notation within the Views and ViewGroups in my
layouts.

How can I change the style elements within the "MyCompany" tree?
Alternatively, how can I create two style trees "MyCompany_Style_A"
and "MyCompany_Style_B", and have the Views and ViewGroups reference
whichever one is currently selected?  Should I just have multiple
layouts and inflate them within onCreate()?

It seems that the entire Theme / Style model relies on starting at one
fixed point and branching out.  Is there any way I can let the style
referenced in the Views be a variable rather fixed?

Thanks for the help, I really appreciate it.

DD

-- 
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: In Android, how to get the keyevent of 'home Key' ?

2011-06-08 Thread Kevin TeslaCoil Software
> I don't remember anyone asking
> how to prevent the user from pressing the power key to unlock the phone :)

That's be because the power key doesn't unlock the phone :P, it wakes
it up, then you slide to unlock.

I do actually get user requests to disable the power key from waking
the device, but I just say sorry, not going to happen.

-Kevin



>
> -- Kostya
>
> 2011/6/8 Robert Green 
>
>
>
>
>
>
>
> > Think of home like alt-tab in windows.  You never need to capture it.
> > You just need to handle onPause()/onStop() in a way that makes sense
> > for the user temporarily leaving your app.  You'll get onFinish() when
> > your app is to be actually destroyed.  If you have a need to actually
> > kill off the whole thing when home is pressed, call finish() in
> > onPause()/onStop() and you shall receive the touch of the droid
> > reaper, making for a clean start next time the user tries to enter the
> > activity.
>
> > On Jun 8, 10:31 am, Indicator Veritatis  wrote:
> > > Your blog post IS the best explanation I have seen to date of what the
> > > Home key really means. I thought it was particularly interesting that
> > > it emphasized something I have been dimly aware of but keep
> > > forgetting: unlike the Back key, pressing Home does NOT cause finish()
> > > to be called. I assume from your description that it triggers only one
> > > lifecycle callback, onPause(). It doesn't even itself trigger
> > > onStop(), which may or may not follow.
>
> > > But shouldn't it trigger onStop() too? After all, the application is
> > > no longer visible. And what about the Activity Stack? Doesn't pressing
> > > Home put the least recently used Activity on that stack?
>
> > > In fact, when I put Log.d statements in my main Activity for both
> > > onPause() and onStop(), I see both get called when I press the Home
> > > key.
>
> > > On Jun 8, 5:13 am, Mark Murphy  wrote:
>
> > > > On Wed, Jun 8, 2011 at 7:20 AM, Mark Murphy 
> > wrote:
> > > > > On Wed, Jun 8, 2011 at 2:31 AM, Droid  wrote:
> > > > >> I need to know when the home button is pressed too (otherwise my app
> > > > >> returns to visibility again and again for ever).
>
> > > > > Then fix your bug.
>
> > > > >> (Please don't tell me I need to design my app
> > > > >> 'properly', I have been Android dev for over a year now)
>
> > > > > Tough. Design your app properly.
>
> > > > I just wrote up a blog post about why you should not care about the
> > > > HOME button and how better to solve this "problem":
>
> > > >http://commonsware.com/blog/2011/06/08/please-ignore-home-button.html
>
> > > > --
> > > > Mark Murphy (a Commons Guy)http://commonsware.com|
> >http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> > > > Android 3.0 Programming Books:http://commonsware.com/books
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

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


[android-developers] Re: how would you parse this

2011-06-08 Thread Doug
I think you just need to read up on web services and JSON.  Android
comes with a JSON parser.

On Jun 6, 11:25 pm, mike  wrote:
> I need to create a news feed that takes the string from the following
> link and displays each on separate links, like the google news and
> weather feed.  Im not sure how to change that and get the information
> out of it smoothly without using substring.  Any help would be great.
>
> http://empty-water-46.heroku.com/api/news?password=xyzxyz
>
> {"news":[{"title":"Obama
> Facebook","date":"4.20.11","description":"This was a great
> achievement!"},{"title":"Oil Spill
> Again","date":"4.17.11","description":"There was another oil spill in
> the gulf."},{"title":"Middle East
> Peace","date":"4.2.11","description":"There is finally peace in the
> middle east."}]}

-- 
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] Slide view up and down- choppy

2011-06-08 Thread Stefan Alder
I'm trying to slide a view on and off the bottom of the screen.  The
view is a relative layout with a couple of child views- one a header
bar, and the other a listview, positioned below it with a margin in
all sides.

I'm using the translate animation code below.  The performance is
terrible --  it is choppy and leaves traces until the animation is
completed.  In addition, on sliding down, the header bar gets squeezed
in width to the width of the list view, and aligns with the top of it.

Is there a better way to do this?  My hope is that the transition be
smooth and all child views remain fixed relative to the parent (and
themselves).


animation = new TranslateAnimation(
Animation.RELATIVE_TO_PARENT, 0.0f, Animation.RELATIVE_TO_PARENT,
0.0f, Animation.RELATIVE_TO_PARENT, 1.0f,
Animation.RELATIVE_TO_PARENT, 0.0f);
animation.setDuration(1000);
animation.setFillEnabled(true);
animation.setFillBefore(true);
animation.setAnimationListener(new AnimationListener() {

set.addAnimation(animation);

LayoutAnimationController controller = new
LayoutAnimationController(set, 0.25f);
panel.setLayoutAnimation(controller);

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


Re: [android-developers] Re: Loading Bitmaps in native heap

2011-06-08 Thread Dianne Hackborn
On Wed, Jun 8, 2011 at 3:17 PM, webmonkey  wrote:

> > No, as I said, your app will eventually be silently killed.
> OK, but not if you are a foreground app, wouldn't be very silent ;-)
>

It is silent as far as you are concerned -- no warning, no way to recover,
just *poof*.


> I am talking sane for a mobile environment, and I already mmap
> everything I can. Let's say an absolute max of 2 full 8mp images, so
> about 64MB of extra space in native, is that reasonable for a
> foreground app? Keeping in mind that it is the user's choice to do
> this (just like he would play a high performance game)
>

On some devices that is going to be way over budget.  The amount of RAM in
Android devices (at least high-end ones) has been growing quickly, but there
is a wide variety across them.  The numbers defined in the platform have
been fairly conservative to ensure good working behavior and performance
across all devices.

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

Re: [android-developers] two questions from a newbie

2011-06-08 Thread Mark Murphy
On Wed, Jun 8, 2011 at 6:14 PM, Knutsford Software
 wrote:
> 1) If you have a form in in app what do you do if the app goes into the
> background while you are in the middle of completing the form? Do you need
> to do something in OnResume or will it resume in the state that you left it
> in before it went into the background?

At minimum, when onSaveInstanceState() is called, stuff the form
contents into the Bundle, at least for widgets where that is not
handled automatically.

You may also consider whether you should persist the form contents to
a temporary file or something, in case your activity is destroyed
before the user comes back to it.

> 2) If you have something like
>
>
>
> Intent i =
>
> new
> Intent(Intent.ACTION_VIEW);
>
> i.setData(Uri.parse(uri));
>
> startActivity(i);
>
>
>
> in OnCreate what do you do about OnResume so that the browser is pointing to
> where it was when it was left or do you have to start it again

I'm sorry, but I don't follow this part at all. If you call
startActivity() on a URL, the default browser will display that URL.
Period.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android 3.0 Programming Books: http://commonsware.com/books

-- 
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 Bitmaps in native heap

2011-06-08 Thread webmonkey
> No, as I said, your app will eventually be silently killed.

OK, but not if you are a foreground app, wouldn't be very silent ;-)

> Pretty universally people coming from a desktop environment have a very
> different definition of "reasonable amount of memory" than is actually sane
> for a mobile environment.

I am talking sane for a mobile environment, and I already mmap
everything I can. Let's say an absolute max of 2 full 8mp images, so
about 64MB of extra space in native, is that reasonable for a
foreground app? Keeping in mind that it is the user's choice to do
this (just like he would play a high performance game)



On Jun 8, 11:56 pm, Dianne Hackborn  wrote:
> On Wed, Jun 8, 2011 at 1:15 PM, webmonkey  wrote:
> > How does the native heap actually tell you, will malloc return NULL if
> > it cannot reserve enough space?
>
> No, as I said, your app will eventually be silently killed.
>
> > And if you are a foreground app, you won't get in trouble will you
> > (unless you use insane amounts of it) I can understand that a
> > background app should not use more native memory than the limit.
>
> Pretty universally people coming from a desktop environment have a very
> different definition of "reasonable amount of memory" than is actually sane
> for a mobile environment.
>
> --
> 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] two questions from a newbie

2011-06-08 Thread Knutsford Software
I have a couple of questions


1) If you have a form in in app what do you do if the app goes into the 
background while you are in the middle of completing the form? Do you need to 
do something in OnResume or will it resume in the state that you left it in 
before it went into the background?



2) If you have something like


Intent i = new Intent(Intent.ACTION_VIEW);

i.setData(Uri.parse(uri));

startActivity(i);



in OnCreate what do you do about OnResume so that the browser is pointing to 
where it was when it was left or do you have to start it again





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

Re: [android-developers] AlertDialog.Builder question

2011-06-08 Thread Kostya Vasilyev
It does (but not on all devices, IIRC).

There are tricks you can play with subclassing AlertDialog, getting the
button references after calling super.onCreate and setting your own click
listeners. It works for me, but I don't know if this is really kosher. On
the other hand, I remember seeing code like that in the Settings
application.

--
Kostya Vasilyev
09.06.2011 1:56 пользователь "dashman"  написал:
> building a dialog with own layout.
>
> when i click on any of the positive/neutral/negative buttons,
> it closes the dialog...any way to stop that...i'm intercepting
> the onclicklistener but no sure what to set.
>
> also, is there any way to change the labels of any of the
> buttons from within the onclick listener.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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

Re: [android-developers] Great Problem

2011-06-08 Thread Kostya Vasilyev
What for? The logcat should have a nice readable stack trace with source
file names and line numbers.

--
Kostya Vasilyev
08.06.2011 21:46 пользователь "Simon Platten" 
написал:
> Add try and catch clauses to your methods that should help you locate the
> problem.
>
> Regards,Sy
>
> On 8 Jun 2011 15:49, "Diogo Salaberri"  wrote:
>
> hi guys, I need a help please.
>
> I got this error on my app:
>
> 06-08 14:42:33.584: ERROR/AndroidRuntime(269): java.lang.RuntimeException:
> Unable to start activity ComponentInfo{br.com.vivo/br.com.vivo.A_Home}:
> java.lang.NullPointerException
>
>
> Anyone can help me ?
>
> Thanks
>
> --
> Atenciosamente;
> Diogo Bonoto Salaberri
> Bacharel em Ciência da Computação - UFPel
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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

Re: [android-developers] Re: Use of the Resource reference "?" when setting widget attributes.

2011-06-08 Thread Kostya Vasilyev
?MyCompanyStyle should ultimately resolve to @style/something, via the
theme.



You can check the Android sources, under
\platforms\android-X\data\res\values. Look for themes.xml,
styles.xml, attrs.xml. These files have a lot of style references.



For example:




@android:style/Widget.AbsListView
@android:style/Widget.AutoCompleteTextView

@android:style/Widget.CompoundButton.CheckBox
@android:style/Widget.ListView.DropDown
@android:style/Widget.EditText
@android:style/Widget.ExpandableListView
@android:style/Widget.ExpandableListView.White

and so on for all the standard widget (view) classes.



-- Kostya
2011/6/9 Danny D 

> Thanks Kostya,
>
> I think I'm doing pretty much what you said (I'll check again), I'm
> trying to use the "?foo" reference to dynamically set the style of an
> individual view or view-group.
>
> 1) I've created my own fixed styles, there are three of these.  I want
> to select one of the three by setting the theme.
>
> 2) Put the selection of the overall theme into the 
> element within the manifest.  This is pretty much by the book too.
>
> 3) The views seem to be happy, but there seems to be some type of
> difference between these two types of assignments
>
> the View's style by reference (contains multiple attributes).
> android:id="@android:id/button1"
>android:text="@string/button_cancel"
>android:layout_weight="1"/>
>
>
> and the example in Android SDK
>
>android:layout_width="fill_parent"
>android:layout_height="wrap_content"
> android:textColor="?android:textColorSecondary" <
> One property being set by reference.
> android:text="@string/hello_world" />
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

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

Re: [android-developers] Re: Use of the Resource reference "?" when setting widget attributes.

2011-06-08 Thread Kostya Vasilyev
?MyCompanyStyle should ultimately resolve to @style/something, via the
theme.

You can check the Android sources, under
\platforms\android-X\data\res\values. Look for themes.xml,
styles.xml, attrs.xml. These files have a lot of style references.

For example:


@android:style/Widget.AbsListView
@android:style/Widget.AutoCompleteTextView

@android:style/Widget.CompoundButton.CheckBox
@android:style/Widget.ListView.DropDown
@android:style/Widget.EditText
@android:style/Widget.ExpandableListView
@android:style/Widget.ExpandableListView.White
and so on for all the standard widget (view) classes.

-- Kostya

2011/6/9 Danny D 

> Thanks Kostya,
>
> I think I'm doing pretty much what you said (I'll check again), I'm
> trying to use the "?foo" reference to dynamically set the style of an
> individual view or view-group.
>
> 1) I've created my own fixed styles, there are three of these.  I want
> to select one of the three by setting the theme.
>
> 2) Put the selection of the overall theme into the 
> element within the manifest.  This is pretty much by the book too.
>
> 3) The views seem to be happy, but there seems to be some type of
> difference between these two types of assignments
>
> the View's style by reference (contains multiple attributes).
> android:id="@android:id/button1"
>android:text="@string/button_cancel"
>android:layout_weight="1"/>
>
>
> and the example in Android SDK
>
>android:layout_width="fill_parent"
>android:layout_height="wrap_content"
> android:textColor="?android:textColorSecondary" <
> One property being set by reference.
> android:text="@string/hello_world" />
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

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

Re: [android-developers] Re: Loading Bitmaps in native heap

2011-06-08 Thread Dianne Hackborn
On Wed, Jun 8, 2011 at 1:15 PM, webmonkey  wrote:

> How does the native heap actually tell you, will malloc return NULL if
> it cannot reserve enough space?
>

No, as I said, your app will eventually be silently killed.


> And if you are a foreground app, you won't get in trouble will you
> (unless you use insane amounts of it) I can understand that a
> background app should not use more native memory than the limit.
>

Pretty universally people coming from a desktop environment have a very
different definition of "reasonable amount of memory" than is actually sane
for a mobile environment.

-- 
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] AlertDialog.Builder question

2011-06-08 Thread dashman
building a dialog with own layout.

when i click on any of the positive/neutral/negative buttons,
it closes the dialog...any way to stop that...i'm intercepting
the onclicklistener but no sure what to set.

also, is there any way to change the labels of any of the
buttons from within the onclick listener.

-- 
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: Use of the Resource reference "?" when setting widget attributes.

2011-06-08 Thread Danny D
Thanks Kostya,

I think I'm doing pretty much what you said (I'll check again), I'm
trying to use the "?foo" reference to dynamically set the style of an
individual view or view-group.

1) I've created my own fixed styles, there are three of these.  I want
to select one of the three by setting the theme.

2) Put the selection of the overall theme into the 
element within the manifest.  This is pretty much by the book too.

3) The views seem to be happy, but there seems to be some type of
difference between these two types of assignments




and the example in Android SDK



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


[android-developers] Re: ADT 11.0.0

2011-06-08 Thread Abhishek Akhani
Thanks for replying Xavier...

You are right i am trying to add the reference from the property
sheet... in previous versions i was able to choose ids from this sheet
through dialog but now
i have to write it through XML code I did it through manually
writing but it takes more time :( .




On Jun 9, 2:38 am, Xavier Ducrohet  wrote:
> I'm guessing you're trying to add the reference from the property
> sheet through the dialog that pops-up when you click the "..." button?
>
> If this is the case then this "reference chooser" dialog does not in
> fact show any id. This does not prevent you from setting them though,
> just manually type @id/foo
> If you're doing something else, then please give us more info.
>
> thanks
> Xav
>
> On Wed, Jun 8, 2011 at 10:16 AM, abhishek akhani
>
>
>
>
>
>
>
>
>
>  wrote:
> > Hi
>
> > Today i downloaded ADT 11.0.0 and now when i am adding any view to
> > Relative layout i am having problem adding it. Like i can not find any
> > id to reference as a "align bottom" or "Layout Right of" property..
> > when i try to set these properties it shows me
> > Drawables,Arrays,Strings,Layout - ids but i am not able to get view-
> > ids anywhere which i need... is this a bug or what? Is there any
> > one to explain???
>
> > --
> > 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
>
> --
> Xavier Ducrohet
> Android SDK Tech Lead
> Google Inc.http://developer.android.com|http://tools.android.com
>
> Please do not send me questions directly. 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


Re: [android-developers] ADT 11.0.0

2011-06-08 Thread Xavier Ducrohet
I'm guessing you're trying to add the reference from the property
sheet through the dialog that pops-up when you click the "..." button?

If this is the case then this "reference chooser" dialog does not in
fact show any id. This does not prevent you from setting them though,
just manually type @id/foo
If you're doing something else, then please give us more info.

thanks
Xav

On Wed, Jun 8, 2011 at 10:16 AM, abhishek akhani
 wrote:
> Hi
>
> Today i downloaded ADT 11.0.0 and now when i am adding any view to
> Relative layout i am having problem adding it. Like i can not find any
> id to reference as a "align bottom" or "Layout Right of" property..
> when i try to set these properties it shows me
> Drawables,Arrays,Strings,Layout - ids but i am not able to get view-
> ids anywhere which i need... is this a bug or what? Is there any
> one to explain???
>
> --
> 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
>



-- 
Xavier Ducrohet
Android SDK Tech Lead
Google Inc.
http://developer.android.com | http://tools.android.com

Please do not send me questions directly. 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


Re: [android-developers] Re: In Android, how to get the keyevent of 'home Key' ?

2011-06-08 Thread TreKing
On Wed, Jun 8, 2011 at 4:14 PM, Indicator Veritatis wrote:

> But you are wrong to deny the causal link between pressing Home and the
> lifecycle in turn causing onPause() and onStop() to be called. It is not
> only perfectly correct, but even important to understand the lifecycle as
> a more mediate sort of cause, the press of Home the more proximate, e.g.,
> the one as formal, the other as efficient cause.
>

True - indeed, in this case, it is precisely the press of the Home key that
triggers the lifecycle flow. I should have said "neither of those actions is
*uniquely triggered* due to HOME being pressed - *it would happen with any
other app coming to the foreground*"


> but coverage of these is where Bob M.'s post is particularly good, so I
> have nothing to add to that.
>

Who is Bob M.? I'm assuming you don't mean Bob
Marley
.

-
TreKing  - Chicago
transit tracking app for Android-powered devices

-- 
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: In Android, how to get the keyevent of 'home Key' ?

2011-06-08 Thread Indicator Veritatis
You guessed correctly. Where I wrote 'least', I should have written
'last'. But since you agree that both onPause() and onStop() will be
called, Bob M. really has to change the wording in his blog. As it
stood when I wrote that, it really did imply that ONLY onPause() is
called, not onStop(). As such, where it attempts to lift the fog and
dispel confusion, it only replaces one confusion with another.

And yes, you are right that this "the normal lifecycle". But you are
wrong to deny the causal link between pressing Home and the lifecycle
in turn causing onPause() and onStop() to be called. It is not only
perfectly correct, but even important to understand the lifecycle as a
more mediate sort of cause, the press of Home the more proximate,
e.g., the one as formal, the other as efficient cause. But the cause
most relevant to the developer (the OP) is that pressing Home causes
onPause() and then onStop() to be called, since his Activity has not
only lost 'focus', but also become invisible. The only danger of this
POV is that it might lead the developer to forget that there are other
external exents the lifecycle communicates to him via these callbacks;
but coverage of these is where Bob M.'s post is particularly good, so
I have nothing to add to that.

I even think we can still hold out hope for him: once he understands
the lifecycle this well, he may find that he really does not need to
intercept the Home key, he can think of a better way to meet the
customer requirement -- unless he is really unlucky with his choice of
customer:(

On Jun 8, 10:49 am, TreKing  wrote:
> On Wed, Jun 8, 2011 at 12:31 PM, Indicator Veritatis wrote:
>
> > But shouldn't it trigger onStop() too? After all, the application is
> > no longer visible. And what about the Activity Stack? Doesn't pressing
> > Home put the least recently used Activity on that stack?
>
> Yes and yes (assuming you meant "last" recently used) but the point is
> neither of those actions is due to HOME being pressed - this is the
> lifecycle. If you were to use a quick-launching app that allowed you to
> launch a new app "B" while you were still on app "A", app "A" would pause
> then stop and be placed on the history stack - it has nothing to do with the
> fact that the activity coming up happens to be the Home app. In fact,
> playing with my N1 with 2.3.4 shows that the *current* activity is place on
> the history stack as soon as it's brought up, not when you go away from it.
>
> -
> TreKing  - Chicago
> transit tracking app for Android-powered devices

-- 
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 Bitmaps in native heap

2011-06-08 Thread Streets Of Boston
Yeah, but it'll do. :-) 
The quality of the cameras on phones and tablets is not that great anyway.

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

Re: [android-developers] Dynamically adding a group of views

2011-06-08 Thread TreKing
On Wed, Jun 8, 2011 at 3:40 PM, darrinps  wrote:

> How can I add multiple segments (my upper LinearView is called a segment)
> to the ScrollView?
>

Add multiple "segments" to one parent LinearLayout then shove that in the
ScrollView.

-
TreKing  - Chicago
transit tracking app for Android-powered devices

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

Re: [android-developers] Re: Broadcasting custom intent actions to background activities from foreground activity.

2011-06-08 Thread Mark Murphy
On Wed, Jun 8, 2011 at 4:16 PM, Diego Tori
 wrote:
> That's the thing, if I set a shared preference flag or cached flag via
> cache object, and they did try to check for that value in onResume,
> wouldn't the first activity from the back stack to get the foreground
> check its state, then set it back to false after checking for it being
> true before having to do work?

Delete the flag. You don't need the flag. Update the UI of the
activity in onResume(). Period.

> Even if I didn't reset the flag, every
> time it would hit that function, it would still get caught in that
> flag, so that isn't really useful.

Hence, get rid of the flag. Update the UI of the activity in onResume(). Period.

> So there is no way that I can just
> broadcast one intent that my listening activities can listen to after
> the intent is sent as soon as they get the foreground again?

What makes you think that your activity even exists? Your
non-foreground activities may not even be in memory, because Android
may have destroyed them to save RAM.

If you simply update your UI in onResume(), it handles both the
activity-in-RAM and the activity-out-of-RAM scenario.

Your proposed model is akin to: every time Google indexes a new page,
it proactively updates every browser on the face of the planet, even
those that do not use Google, do not care about the newly indexed
page, or are not even running.

> Keep in mind that this is not a one-time event.

All the more reason to not push updates out to activities that do not
yet need the information.

> Rather it is an event
> that the user generates, all I want those other activities to know is
> whether or not the event was generated by the user while in the
> background.

So, update the UI of the activity from your persistent store or
in-memory cache in onResume(). Period.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android 3.0 Programming Books: http://commonsware.com/books

-- 
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 Bitmaps in native heap

2011-06-08 Thread webmonkey
That works but I don't consider 16-bit to be "full-resolution", color
fidelity is just as important.

On Jun 8, 10:25 pm, Streets Of Boston  wrote:
> I guess it's playing nice to other background apps. Even a foreground app
> can't gobble up all the memory and starve the background apps.
>
> I figured out a way to edit 9MPixel images 16-bit (i.e. 18MByte of data). It
> makes you program quite carefully when using the left over 6Mbyte of memory,
> but it's possible. On tablets, i think that the limit has been raised to a
> 48MByte heap.
>
> Since the 1st gen android phones never had cameras with more than 5MPixel
> and 2nd gen android phones never had cameras with more than 8MPixel, it
> worked out for my app.
>
> But if images are side-loaded (e.g. from a sd-card or downloaded from the
> web), which could be larger than 5 or 9 MPixel, then my app would fail to
> handle these.

-- 
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: webservice php

2011-06-08 Thread tamer hatoum
while extracting using httprequest  and binding to listview and  make
items clickable to open the PDF file 
regards...

On Jun 8, 5:33 pm, James Ots  wrote:
> Which part in particular are you having difficulty with?
>
> James

-- 
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] Dynamically adding a group of views

2011-06-08 Thread darrinps
I have a layout that contains a ScrollView

Inside of that ScrollView, I would like to dynamically add a group of
views as a "package". I know I can do this as single lines, but I have
a complex row made up of several views that I need to add as a group.

What I want is a CheckBox on the left side, three lines of text in the
center, and an image on the right. Let's call that a segment, and I
want multiple segments to be added dynamically to my ScrollView.

I have the "segment" laid out like this:



<

















How can I add multiple segments (my upper LinearView is called a
segment) to the ScrollView?

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: Broadcasting custom intent actions to background activities from foreground activity.

2011-06-08 Thread Diego Tori
Keep in mind that this is not a one-time event. Rather it is an event
that the user generates, all I want those other activities to know is
whether or not the event was generated by the user while in the
background.

On Jun 8, 4:16 pm, Diego Tori  wrote:
> That's the thing, if I set a shared preference flag or cached flag via
> cache object, and they did try to check for that value in onResume,
> wouldn't the first activity from the back stack to get the foreground
> check its state, then set it back to false after checking for it being
> true before having to do work? Even if I didn't reset the flag, every
> time it would hit that function, it would still get caught in that
> flag, so that isn't really useful. So there is no way that I can just
> broadcast one intent that my listening activities can listen to after
> the intent is sent as soon as they get the foreground again?
>
> On Jun 8, 3:16 pm, Mark Murphy  wrote:
>
>
>
>
>
>
>
> > On Wed, Jun 8, 2011 at 3:00 PM, Diego Tori
>
> >  wrote:
> > > So I want to achieve the following: suppose I have one Activity in my
> > > app that generates an event that I want other Activities in my app's
> > > back stack to know about so they can react to it accordingly (i.e.
> > > update UI, refresh data via separate Thread, etc...). What strategies
> > > would I have to pursue in order to accomplish this?
>
> > Have them find out about the new information in onResume(). They do
> > not need the information before then, since they are not in the
> > foreground.
>
> > > Would I have to set up BroadcastReceivers and if so, how would I set
> > > up the receivers?
>
> > No.
>
> > > Also, for this case, would it make sense to register
> > > and un-register the receiver(s) in onCreate and onDestroy
> > > respectively, since using onResume and onPause would prevent it from
> > > listening in when receiving Activity is in the background?
>
> > No.
>
> > --
> > Mark Murphy (a Commons 
> > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> > Android 3.0 Programming Books:http://commonsware.com/books

-- 
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 Bitmaps in native heap

2011-06-08 Thread Streets Of Boston
I guess it's playing nice to other background apps. Even a foreground app 
can't gobble up all the memory and starve the background apps.

I figured out a way to edit 9MPixel images 16-bit (i.e. 18MByte of data). It 
makes you program quite carefully when using the left over 6Mbyte of memory, 
but it's possible. On tablets, i think that the limit has been raised to a 
48MByte heap. 

Since the 1st gen android phones never had cameras with more than 5MPixel 
and 2nd gen android phones never had cameras with more than 8MPixel, it 
worked out for my app.

But if images are side-loaded (e.g. from a sd-card or downloaded from the 
web), which could be larger than 5 or 9 MPixel, then my app would fail to 
handle these.

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

Re: [android-developers] Re: In Android, how to get the keyevent of 'home Key' ?

2011-06-08 Thread Kostya Vasilyev
Confusion easily comes from thinking about the home screen and the home key
as being more special than they are.

The home screen, to a large degree, is just another application. When it
comes to the foreground, the usual rules with onPause / onStop apply to the
current application.

As for not being able to override the Home key - there are all sorts of
intents that only the system can broadcast. I don't remember anyone asking
how to prevent the user from pressing the power key to unlock the phone :)

-- Kostya

2011/6/8 Robert Green 

> Think of home like alt-tab in windows.  You never need to capture it.
> You just need to handle onPause()/onStop() in a way that makes sense
> for the user temporarily leaving your app.  You'll get onFinish() when
> your app is to be actually destroyed.  If you have a need to actually
> kill off the whole thing when home is pressed, call finish() in
> onPause()/onStop() and you shall receive the touch of the droid
> reaper, making for a clean start next time the user tries to enter the
> activity.
>
> On Jun 8, 10:31 am, Indicator Veritatis  wrote:
> > Your blog post IS the best explanation I have seen to date of what the
> > Home key really means. I thought it was particularly interesting that
> > it emphasized something I have been dimly aware of but keep
> > forgetting: unlike the Back key, pressing Home does NOT cause finish()
> > to be called. I assume from your description that it triggers only one
> > lifecycle callback, onPause(). It doesn't even itself trigger
> > onStop(), which may or may not follow.
> >
> > But shouldn't it trigger onStop() too? After all, the application is
> > no longer visible. And what about the Activity Stack? Doesn't pressing
> > Home put the least recently used Activity on that stack?
> >
> > In fact, when I put Log.d statements in my main Activity for both
> > onPause() and onStop(), I see both get called when I press the Home
> > key.
> >
> > On Jun 8, 5:13 am, Mark Murphy  wrote:
> >
> >
> >
> >
> >
> >
> >
> > > On Wed, Jun 8, 2011 at 7:20 AM, Mark Murphy 
> wrote:
> > > > On Wed, Jun 8, 2011 at 2:31 AM, Droid  wrote:
> > > >> I need to know when the home button is pressed too (otherwise my app
> > > >> returns to visibility again and again for ever).
> >
> > > > Then fix your bug.
> >
> > > >> (Please don't tell me I need to design my app
> > > >> 'properly', I have been Android dev for over a year now)
> >
> > > > Tough. Design your app properly.
> >
> > > I just wrote up a blog post about why you should not care about the
> > > HOME button and how better to solve this "problem":
> >
> > >http://commonsware.com/blog/2011/06/08/please-ignore-home-button.html
> >
> > > --
> > > Mark Murphy (a Commons Guy)http://commonsware.com|
> http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
> >
> > > Android 3.0 Programming Books:http://commonsware.com/books
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

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

[android-developers] Re: Broadcasting custom intent actions to background activities from foreground activity.

2011-06-08 Thread Diego Tori
That's the thing, if I set a shared preference flag or cached flag via
cache object, and they did try to check for that value in onResume,
wouldn't the first activity from the back stack to get the foreground
check its state, then set it back to false after checking for it being
true before having to do work? Even if I didn't reset the flag, every
time it would hit that function, it would still get caught in that
flag, so that isn't really useful. So there is no way that I can just
broadcast one intent that my listening activities can listen to after
the intent is sent as soon as they get the foreground again?

On Jun 8, 3:16 pm, Mark Murphy  wrote:
> On Wed, Jun 8, 2011 at 3:00 PM, Diego Tori
>
>  wrote:
> > So I want to achieve the following: suppose I have one Activity in my
> > app that generates an event that I want other Activities in my app's
> > back stack to know about so they can react to it accordingly (i.e.
> > update UI, refresh data via separate Thread, etc...). What strategies
> > would I have to pursue in order to accomplish this?
>
> Have them find out about the new information in onResume(). They do
> not need the information before then, since they are not in the
> foreground.
>
> > Would I have to set up BroadcastReceivers and if so, how would I set
> > up the receivers?
>
> No.
>
> > Also, for this case, would it make sense to register
> > and un-register the receiver(s) in onCreate and onDestroy
> > respectively, since using onResume and onPause would prevent it from
> > listening in when receiving Activity is in the background?
>
> No.
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android 3.0 Programming Books:http://commonsware.com/books

-- 
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 Bitmaps in native heap

2011-06-08 Thread webmonkey
How does the native heap actually tell you, will malloc return NULL if
it cannot reserve enough space?

And if you are a foreground app, you won't get in trouble will you
(unless you use insane amounts of it) I can understand that a
background app should not use more native memory than the limit.

On Jun 8, 9:35 pm, Dianne Hackborn  wrote:
> Note that just because heap limits aren't imposed on the native heap like
> they are on the Java heap doesn't mean that there aren't limits.  The
> failure cases are just more difficult -- not allowing stuff to work in the
> background when it should to your application just silently being killed.
>
> You *can* push the limit somewhat from the native heap, but there aren't
> many good ways to tell how much on any particular device.  A general safe
> rule of thumb is to keep your native allocations below the java heap limit
> as well independent of what is allocated in Java.
>
> Also keep in mind that as of 3.0 there is an API to extend the Java heap to
> a larger safe limit for specific large apps that need it, and find out what
> that limit 
> is:http://developer.android.com/reference/android/app/ActivityManager.ht...()
>
>
>
>
>
> On Wed, Jun 8, 2011 at 10:17 AM, Erik R  wrote:
> > I'm working on a simple image manipulation app that requires opening
> > bitmaps at full resolution, which of course results in OutOfMemory
> > issues. I know that the short answer is to simply use less memory via
> > BitmapFactory's inSampleSize Option to downsample the bitmap, but for
> > this app I really would like to retain the full resolution for
> > editing. One solution I have been investigating is loading the bitmap
> > entirely on the native heap, after learning that the memory limitation
> > is only imposed within the Dalvik VM heap. A look into the Android
> > source code revealed that this is already the case... BitmapFactory
> > uses native methods to load a bitmap on the native heap, while
> > maintaining a reference to it on the VM heap. The issue then is that
> > it appears the native memory used by the bitmap is actually counted
> > against the available VM memory, when it really isn't there. A look
> > into the stock Camera and Gallery apps' source revealed that they get
> > around this by using an additional BitmapFactory Option,
> > inNativeAlloc. I was able to find this field in the Java code for
> > BitmapFactory:
>
> >  196          * Normally bitmap allocations count against the dalvik
> > heap, which
> >  197          * means they help trigger GCs when a lot have been
> > allocated. However,
> >  198          * in rare cases, the caller may want to allocate the
> > bitmap outside of
> >  199          * that heap. To request that, set inNativeAlloc to true.
> > In these
> >  200          * rare instances, it is solely up to the caller to
> > ensure that OOM is
> >  201          * managed explicitly by calling bitmap.recycle() as soon
> > as such a
> >  202          * bitmap is no longer needed.
> >  203          *
> >  204          * @hide pending API council approval
> >  205          */
> >  206         public boolean inNativeAlloc;
>
> > Are there any plans to "unhide" this field anytime soon?
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.

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


Re: [android-developers] Use of the Resource reference "?" when setting widget attributes.

2011-06-08 Thread Kostya Vasilyev
The "?foo" syntax is a reference to a theme attribute.

To complete this, you need to first create a theme that has these
attributes:


value


and then specify this theme for your activity:



Then the widgets (I hope you mean views by that) will be able to resolve
"?foo" to "value".

And by the way, using hard-coded screen resolution qualifiers (e.g. 320x480)
is usually a bad idea.

-- Kostya

2011/6/9 Danny D 

> Hi,
>
> I'm trying to set a widget's "style" attribute with a reference to a
> custom attribute that's been loaded with a real-concrete style.
>
> The Android SDK docs show an explicit example for just setting the
> textColor attribute based on a style reference:
>
> android:layout_width="fill_parent"
>android:layout_height="wrap_content"
>android:textColor="?android:textColorSecondary"
>android:text="@string/hello_world" />
>
>
> I'm trying to do this for the entire widget's style, like this
>
>android:id="@android:id/button1"
>android:text="@string/button_cancel"
>android:layout_weight="1""/>
>
>
>
> When doing this, I get a runtime crash indicating that I have not set
> the required elements, but these are set within the style referenced
> by "?FoobarButtonStyle"
>
> Is this possible?  Anyone tried anything like this?  Any help on the
> use of the "?" operator and setup of attributes?
>
>
> BACKGROUND INFO
>
> Here's more info on the strategy that I've ended up taking:
>
> First, I setup a set of attributes which map to all of the styles that
> I'm using in the widgets, note that I've set the type of attribute to
> "reference," because I think that I'm referencing another resource and
> not just string / integer type:
>
>
>
> format="reference"/>
> format="reference"/
> >
> format="reference"/>
> format="reference"/>
> format="reference"/>
>...
>
>
> Then, I created an actual style which maps actual style elements to
> the attributes:
>
>
>@style/
> FoobarSetupWizard_320x480
>@style/
> FoobarSetupWizard_320x480.Heading
>@style/
> FoobarSetupWizard_320x480.Heading.Black
>@style/
> FoobarSetupWizard_320x480.Heading.Orange
>@style/
> FoobarSetupWizard_320x480.Body
>@style/
> FoobarSetupWizard_320x480.Body.Black
>@style/
> FoobarSetupWizard_320x480.Body.White
>@style/
> FoobarSetupWizard_320x480.Body.Orange
>@style/
> FoobarSetupWizard_320x480.Fineprint
>
> 
>
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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

[android-developers] Re: Loading Bitmaps in native heap

2011-06-08 Thread webmonkey
It is kind of ridiculous that you cannot just load a bitmap in full
quality the size of the phone's camera capability, let alone edit it.
Then you have to explain to users that you can't because you can only
use 16/24/32 MB when their phones have 512MB.

As open and powerful as Android is, I never understood why this is so
limited.

On Jun 8, 9:35 pm, Dianne Hackborn  wrote:
> Note that just because heap limits aren't imposed on the native heap like
> they are on the Java heap doesn't mean that there aren't limits.  The
> failure cases are just more difficult -- not allowing stuff to work in the
> background when it should to your application just silently being killed.
>
> You *can* push the limit somewhat from the native heap, but there aren't
> many good ways to tell how much on any particular device.  A general safe
> rule of thumb is to keep your native allocations below the java heap limit
> as well independent of what is allocated in Java.
>
> Also keep in mind that as of 3.0 there is an API to extend the Java heap to
> a larger safe limit for specific large apps that need it, and find out what
> that limit 
> is:http://developer.android.com/reference/android/app/ActivityManager.ht...()
>
>
>
>
>
> On Wed, Jun 8, 2011 at 10:17 AM, Erik R  wrote:
> > I'm working on a simple image manipulation app that requires opening
> > bitmaps at full resolution, which of course results in OutOfMemory
> > issues. I know that the short answer is to simply use less memory via
> > BitmapFactory's inSampleSize Option to downsample the bitmap, but for
> > this app I really would like to retain the full resolution for
> > editing. One solution I have been investigating is loading the bitmap
> > entirely on the native heap, after learning that the memory limitation
> > is only imposed within the Dalvik VM heap. A look into the Android
> > source code revealed that this is already the case... BitmapFactory
> > uses native methods to load a bitmap on the native heap, while
> > maintaining a reference to it on the VM heap. The issue then is that
> > it appears the native memory used by the bitmap is actually counted
> > against the available VM memory, when it really isn't there. A look
> > into the stock Camera and Gallery apps' source revealed that they get
> > around this by using an additional BitmapFactory Option,
> > inNativeAlloc. I was able to find this field in the Java code for
> > BitmapFactory:
>
> >  196          * Normally bitmap allocations count against the dalvik
> > heap, which
> >  197          * means they help trigger GCs when a lot have been
> > allocated. However,
> >  198          * in rare cases, the caller may want to allocate the
> > bitmap outside of
> >  199          * that heap. To request that, set inNativeAlloc to true.
> > In these
> >  200          * rare instances, it is solely up to the caller to
> > ensure that OOM is
> >  201          * managed explicitly by calling bitmap.recycle() as soon
> > as such a
> >  202          * bitmap is no longer needed.
> >  203          *
> >  204          * @hide pending API council approval
> >  205          */
> >  206         public boolean inNativeAlloc;
>
> > Are there any plans to "unhide" this field anytime soon?
>
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.

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


[android-developers] Use of the Resource reference "?" when setting widget attributes.

2011-06-08 Thread Danny D
Hi,

I'm trying to set a widget's "style" attribute with a reference to a
custom attribute that's been loaded with a real-concrete style.

The Android SDK docs show an explicit example for just setting the
textColor attribute based on a style reference:




I'm trying to do this for the entire widget's style, like this





When doing this, I get a runtime crash indicating that I have not set
the required elements, but these are set within the style referenced
by "?FoobarButtonStyle"

Is this possible?  Anyone tried anything like this?  Any help on the
use of the "?" operator and setup of attributes?


BACKGROUND INFO

Here's more info on the strategy that I've ended up taking:

First, I setup a set of attributes which map to all of the styles that
I'm using in the widgets, note that I've set the type of attribute to
"reference," because I think that I'm referencing another resource and
not just string / integer type:








...


Then, I created an actual style which maps actual style elements to
the attributes:


@style/
FoobarSetupWizard_320x480
@style/
FoobarSetupWizard_320x480.Heading
@style/
FoobarSetupWizard_320x480.Heading.Black
@style/
FoobarSetupWizard_320x480.Heading.Orange
@style/
FoobarSetupWizard_320x480.Body
@style/
FoobarSetupWizard_320x480.Body.Black
@style/
FoobarSetupWizard_320x480.Body.White
@style/
FoobarSetupWizard_320x480.Body.Orange
@style/
FoobarSetupWizard_320x480.Fineprint

 




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


Re: [android-developers] Re: fragment Support with Tabhost

2011-06-08 Thread Brill Pappin
Hi Joachim,

Thanks for the tip.

Eventually we decided that since the new ActionBar stuff kind of makes tabs 
mute (or rather has its own similar thing) that we only needed tabs for legacy 
apps. In that case, we simply use the activity as tab content with the 
fragments embedded it.

It a real pain to make it all work correctly (as it get complicated quickly) 
but i suppose that the price you pay for keeping the individual APIs clean.

- Brill Pappin
  Sixgreen Labs Inc.




On 2011-06-08, at 2:54 PM, Joachim wrote:

> Brill,
> 
> I'm not sure if this is what you're trying to do but I'm using
> fragments when switching between tabs.
> 
> Essentially I have each added tab use a generic content_fragment as
> the content.  then the changeTab looks at which tab is selected and
> does all the fun Fragment transactions.  An odd behavior that may just
> be due to my implementation is that on createview you have to set the
> current tab to 1 and then back to 0 otherwise it would load the first
> fragment.
> 
> 
> Let me know if this sounds like what you're trying to do and need
> examples.
> 
> Cheers,
> 
> Joachim
> 
> 
> 
> 
> 
> 
> On May 4, 9:02 am, Brill Pappin  wrote:
>> I have a situation where I have a perfect job for Tabs, but want the tab
>> container to actually control the view of v4 fragments instead...
>> However the TabHost build-out requires the container inside the same layout.
>> 
>> Has anyone built a component that works like tabs but can handle fragments?
>> 
>> - Brill
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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


Re: [android-developers] Unable to use the surface object from application side in the native side.

2011-06-08 Thread Dianne Hackborn
Gah I meant to say "sp<> and Surface are *internal implementation* details."

On Wed, Jun 8, 2011 at 12:37 PM, Dianne Hackborn wrote:

> sp<> and Surface are native APIs.  This code will break on various devices.
>
> The only supported way to do this is with the new extended native APIs in
> 2.3.
>
>
> On Tue, Jun 7, 2011 at 7:06 AM, Sandeep Patil  > wrote:
>
>> Dear frndz,
>>
>> I am facing a problem of being not able to use the surface object
>> obtained from an activity class in the native side. Here is what i am
>> doing,
>>
>> * Getting a SurfaceView object with the help of findviewbyId()
>> function.
>> * Then obtaining its SurfaceHolder by calling getHolder() function of
>> the surfaceView class.
>> * Then adding a callback to the holder, so as to know when the surface
>> is being created and destroyed.
>> * Once i get the callback of onSurfaceCreated(), i am getting the
>> surface object by getSurface() of the SurfaceHolder class and setting
>> it to a (Surface mSUrface = null ) field in the Activity class.
>> * From onSurfaceCreated() itself, I am calling a native function that
>> tries to access the mSurface object and casts it to sp.
>>
>> Here is my native function,
>>
>> JNIEXPORT void JNICALL setSurface(JNIEnv* env,jobject thiz)
>> {
>>jfieldIDsurfacefieldID;
>>jfieldIDsurface_native;
>>Surface* p;
>>jclass clazz;
>>
>>clazz = env->FindClass("com/example/SMFMediaPlayer/
>> SecondActivity");
>>if (clazz == NULL) {
>>LOGE("Can't find com/example/SMFMediaPlayer/SecondActivity
>> \n");
>>}
>>
>>surfacefieldID = env->GetFieldID(clazz, "mSurface", "Landroid/view/
>> Surface;");
>>if (surfacefieldID == NULL) {
>>LOGE("Can't find MediaPlayer.mSurface\n");
>>}
>>
>>jclass surface = env->FindClass("android/view/Surface");
>>if (surface == NULL) {
>>LOGE("Can't find android/view/Surface\n");
>>}
>>
>>surface_native = env->GetFieldID(surface, "mSurface", "I");
>>
>>if (surface_native == NULL) {
>>LOGE("Can't find Surface fields\n");
>>}
>>
>>jobject surfaceobj = env->GetObjectField(thiz,surfacefieldID);
>>if (surfaceobj != NULL)
>>{
>>  p = (Surface*) env->GetIntField(surfaceobj, surface_native);
>>
>> if(p->isValid())
>> {
>>const sp& native_Surface = sp(p);
>> }
>>}
>>   .
>>  //There some more code down here
>>
>>
>>
>> }
>>
>>
>>
>>
>> The problem here is that the execution is stopping at the
>> statement,"const sp& native_Surface = sp(p);".
>>
>> I am not getting what is the mistake.
>>
>> Actually i am using this code create my own media player. So i request
>> to let me know my mistake or an alternative way to access the surface
>> object. And also i need the SurfaceComposerClient object corresponding
>> the surface object.
>>
>> SOmebody help me out.
>>
>> Thanks You
>> Sandeep Patil
>>
>> --
>> 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.
>
>


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

Re: [android-developers] Unable to use the surface object from application side in the native side.

2011-06-08 Thread Dianne Hackborn
sp<> and Surface are native APIs.  This code will break on various devices.

The only supported way to do this is with the new extended native APIs in
2.3.

On Tue, Jun 7, 2011 at 7:06 AM, Sandeep Patil
wrote:

> Dear frndz,
>
> I am facing a problem of being not able to use the surface object
> obtained from an activity class in the native side. Here is what i am
> doing,
>
> * Getting a SurfaceView object with the help of findviewbyId()
> function.
> * Then obtaining its SurfaceHolder by calling getHolder() function of
> the surfaceView class.
> * Then adding a callback to the holder, so as to know when the surface
> is being created and destroyed.
> * Once i get the callback of onSurfaceCreated(), i am getting the
> surface object by getSurface() of the SurfaceHolder class and setting
> it to a (Surface mSUrface = null ) field in the Activity class.
> * From onSurfaceCreated() itself, I am calling a native function that
> tries to access the mSurface object and casts it to sp.
>
> Here is my native function,
>
> JNIEXPORT void JNICALL setSurface(JNIEnv* env,jobject thiz)
> {
>jfieldIDsurfacefieldID;
>jfieldIDsurface_native;
>Surface* p;
>jclass clazz;
>
>clazz = env->FindClass("com/example/SMFMediaPlayer/
> SecondActivity");
>if (clazz == NULL) {
>LOGE("Can't find com/example/SMFMediaPlayer/SecondActivity
> \n");
>}
>
>surfacefieldID = env->GetFieldID(clazz, "mSurface", "Landroid/view/
> Surface;");
>if (surfacefieldID == NULL) {
>LOGE("Can't find MediaPlayer.mSurface\n");
>}
>
>jclass surface = env->FindClass("android/view/Surface");
>if (surface == NULL) {
>LOGE("Can't find android/view/Surface\n");
>}
>
>surface_native = env->GetFieldID(surface, "mSurface", "I");
>
>if (surface_native == NULL) {
>LOGE("Can't find Surface fields\n");
>}
>
>jobject surfaceobj = env->GetObjectField(thiz,surfacefieldID);
>if (surfaceobj != NULL)
>{
>  p = (Surface*) env->GetIntField(surfaceobj, surface_native);
>
> if(p->isValid())
> {
>const sp& native_Surface = sp(p);
> }
>}
>   .
>  //There some more code down here
>
>
>
> }
>
>
>
>
> The problem here is that the execution is stopping at the
> statement,"const sp& native_Surface = sp(p);".
>
> I am not getting what is the mistake.
>
> Actually i am using this code create my own media player. So i request
> to let me know my mistake or an alternative way to access the surface
> object. And also i need the SurfaceComposerClient object corresponding
> the surface object.
>
> SOmebody help me out.
>
> Thanks You
> Sandeep Patil
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

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

Re: [android-developers] Loading Bitmaps in native heap

2011-06-08 Thread Dianne Hackborn
Note that just because heap limits aren't imposed on the native heap like
they are on the Java heap doesn't mean that there aren't limits.  The
failure cases are just more difficult -- not allowing stuff to work in the
background when it should to your application just silently being killed.

You *can* push the limit somewhat from the native heap, but there aren't
many good ways to tell how much on any particular device.  A general safe
rule of thumb is to keep your native allocations below the java heap limit
as well independent of what is allocated in Java.

Also keep in mind that as of 3.0 there is an API to extend the Java heap to
a larger safe limit for specific large apps that need it, and find out what
that limit is:
http://developer.android.com/reference/android/app/ActivityManager.html#getLargeMemoryClass()

On Wed, Jun 8, 2011 at 10:17 AM, Erik R  wrote:

> I'm working on a simple image manipulation app that requires opening
> bitmaps at full resolution, which of course results in OutOfMemory
> issues. I know that the short answer is to simply use less memory via
> BitmapFactory's inSampleSize Option to downsample the bitmap, but for
> this app I really would like to retain the full resolution for
> editing. One solution I have been investigating is loading the bitmap
> entirely on the native heap, after learning that the memory limitation
> is only imposed within the Dalvik VM heap. A look into the Android
> source code revealed that this is already the case... BitmapFactory
> uses native methods to load a bitmap on the native heap, while
> maintaining a reference to it on the VM heap. The issue then is that
> it appears the native memory used by the bitmap is actually counted
> against the available VM memory, when it really isn't there. A look
> into the stock Camera and Gallery apps' source revealed that they get
> around this by using an additional BitmapFactory Option,
> inNativeAlloc. I was able to find this field in the Java code for
> BitmapFactory:
>
>  196  * Normally bitmap allocations count against the dalvik
> heap, which
>  197  * means they help trigger GCs when a lot have been
> allocated. However,
>  198  * in rare cases, the caller may want to allocate the
> bitmap outside of
>  199  * that heap. To request that, set inNativeAlloc to true.
> In these
>  200  * rare instances, it is solely up to the caller to
> ensure that OOM is
>  201  * managed explicitly by calling bitmap.recycle() as soon
> as such a
>  202  * bitmap is no longer needed.
>  203  *
>  204  * @hide pending API council approval
>  205  */
>  206 public boolean inNativeAlloc;
>
> Are there any plans to "unhide" this field anytime soon?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

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

Re: [android-developers] Broadcasting custom intent actions to background activities from foreground activity.

2011-06-08 Thread Mark Murphy
On Wed, Jun 8, 2011 at 3:00 PM, Diego Tori
 wrote:
> So I want to achieve the following: suppose I have one Activity in my
> app that generates an event that I want other Activities in my app's
> back stack to know about so they can react to it accordingly (i.e.
> update UI, refresh data via separate Thread, etc...). What strategies
> would I have to pursue in order to accomplish this?

Have them find out about the new information in onResume(). They do
not need the information before then, since they are not in the
foreground.

> Would I have to set up BroadcastReceivers and if so, how would I set
> up the receivers?

No.

> Also, for this case, would it make sense to register
> and un-register the receiver(s) in onCreate and onDestroy
> respectively, since using onResume and onPause would prevent it from
> listening in when receiving Activity is in the background?

No.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android 3.0 Programming Books: http://commonsware.com/books

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


Re: [android-developers] 2.2 Froyo Widgets wrong behavior (power-controls widget is showing on update or when the widget brokes)

2011-06-08 Thread emaildevbr . stress


VSent from my Verizon Wireless Phone

-Original message-
From: Marcos Lima 
To: Android Developers 
Sent: Tue, Jun 7, 2011 22:06:06 GMT-03:00
Subject: [android-developers] 2.2 Froyo Widgets wrong behavior  
(power-controls widget is showing on update or when the widget brokes)


Hello,

Good afternoon.

I'm developing an widget for an android 2.2 tablet and I found an
incorrect "mis"behavior.

When the update method is called the layout of the widget change for a
short time showing a functional power-setting widget.

I tried force an error when debuggin' and the power control remains on
the home screen.

How can I fix that? There are workarounds for it?


Thanks a Lot,

Marcos Lima
Software Developer/Tech Lead

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

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

[android-developers] Re: fragment Support with Tabhost

2011-06-08 Thread Joachim
Brill,

I'm not sure if this is what you're trying to do but I'm using
fragments when switching between tabs.

Essentially I have each added tab use a generic content_fragment as
the content.  then the changeTab looks at which tab is selected and
does all the fun Fragment transactions.  An odd behavior that may just
be due to my implementation is that on createview you have to set the
current tab to 1 and then back to 0 otherwise it would load the first
fragment.


Let me know if this sounds like what you're trying to do and need
examples.

Cheers,

Joachim






On May 4, 9:02 am, Brill Pappin  wrote:
> I have a situation where I have a perfect job for Tabs, but want the tab
> container to actually control the view of v4 fragments instead...
> However the TabHost build-out requires the container inside the same layout.
>
> Has anyone built a component that works like tabs but can handle fragments?
>
> - Brill

-- 
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] Broadcasting custom intent actions to background activities from foreground activity.

2011-06-08 Thread Diego Tori
So I want to achieve the following: suppose I have one Activity in my
app that generates an event that I want other Activities in my app's
back stack to know about so they can react to it accordingly (i.e.
update UI, refresh data via separate Thread, etc...). What strategies
would I have to pursue in order to accomplish this?

Would I have to set up BroadcastReceivers and if so, how would I set
up the receivers? Also, for this case, would it make sense to register
and un-register the receiver(s) in onCreate and onDestroy
respectively, since using onResume and onPause would prevent it from
listening in when receiving Activity is in the background?

-- 
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-develozpers] Unable to use the surface object from application side in the native side.

2011-06-08 Thread emaildevbr . stress
ESent from my Verizon Wireless Phone-Original message-From: Sandeep Patil To: Android Developers Sent: Tue, Jun 7, 2011 22:07:23 GMT-03:00Subject: [android-developers] Unable to use the surface object from application side in the native side.Dear frndz,I am facing a problem of being not able to use the surface objectobtained from an activity class in the native side. Here is what i amdoing,* Getting a SurfaceView object with the help of findviewbyId()function.* Then obtaining its SurfaceHolder by calling getHolder() function ofthe surfaceView class.* Then adding a callback to the holder, so as to know when the surfaceis being created and destroyed.* Once i get the callback of onSurfaceCreated(), i am getting thesurface object by getSurface() of the SurfaceHolder class and settingit to a (Surface mSUrface = null ) field in the Activity class.* From onSurfaceCreated() itself, I am calling a native function thattries to access the mSurface object and casts it to sp.Here is my native function,JNIEXPORT void JNICALL setSurface(JNIEnv* env,jobject thiz){jfieldIDsurfacefieldID;jfieldIDsurface_native;Surface* p;jclass clazz;clazz = env->FindClass("com/example/SMFMediaPlayer/SecondActivity");if (clazz == NULL) {LOGE("Can't find com/example/SMFMediaPlayer/SecondActivity\n");}surfacefieldID = env->GetFieldID(clazz, "mSurface", "Landroid/view/Surface;");if (surfacefieldID == NULL) {LOGE("Can't find MediaPlayer.mSurface\n");}jclass surface = env->FindClass("android/view/Surface");if (surface == NULL) {LOGE("Can't find android/view/Surface\n");}surface_native = env->GetFieldID(surface, "mSurface", "I");if (surface_native == NULL) {LOGE("Can't find Surface fields\n");}jobject surfaceobj = env->GetObjectField(thiz,surfacefieldID);if (surfaceobj != NULL){	  p = (Surface*) env->GetIntField(surfaceobj, surface_native);	 if(p->isValid())	 {		const sp& native_Surface = sp(p);	 }}   . //There some more code down here}The problem here is that the execution is stopping at thestatement,"const sp& native_Surface = sp(p);".I am not getting what is the mistake.Actually i am using this code create my own media player. So i requestto let me know my mistake or an alternative way to access the surfaceobject. And also i need the SurfaceComposerClient object correspondingthe surface object.SOmebody help me out.Thanks YouSandeep Patil-- You received this message because you are subscribed to the GoogleGroups "Android Developers" group.To post to this group, send email to android-developers@googlegroups.comTo unsubscribe from this group, send email toandroid-developers+unsubscr...@googlegroups.comFor more options, visit this group athttp://groups.google.com/group/android-developers?hl=en



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

[android-developers] multiple opengl context and shared textures

2011-06-08 Thread Paolo
Hi there,

as the Object of this topic... is it possible to create two different
OpenGL Contexts in the same activity? I mean creating two different
glsurfaceviews, where every of them use a different EGLConfig and
Renderer.

And also... what about texture? Can I share texture through the two
OGL Context?

I need to use it either with 2.1, 2.2. 2.3 or 3.0 with tablets for a
dual indipendent 3D window.

Thanks in advance

Paolo

-- 
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 Bitmaps in native heap

2011-06-08 Thread Streets Of Boston
I wrote an image editor app that claims to deal with full-resolution of the 
images.
However, there is a limit due to the 'issues' you found (limit memory).

I got around it (at least, i haven't seen many stack-traces/error-logs sent 
my way) by doing this:

   - Limit the resolution. On 1st gen devices (16MB ram), up to 5MPixel 
   16-bit; on 2nd gen devices (24MB ram), up to 9MPixel 16-bit images. 
   Basically, allow the images take up all but 6MByte of the available ram (16 
   - 6 = 10MByte for pics; 24 - 6 = 18MByte for pics). The 6MByte buffer that 
   can be used by the rest of my app is just an example. Your app may be able 
   to use less...
   - Be diligent in 'recycle()' bitmaps *asap*.
   - Just before allocating a brand-new large image, call System.gc(), to 
   trigger the garbage collector.
   Because the raw bitmap data is loaded on the native heap and DalvikVM 
   can't 'see' it, the garbage collection may not have been properly triggered 
   in time. Calling System.gc() is just to make sure that it does the 
   collection if necessary.



-- 
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] Loading Bitmaps in native heap

2011-06-08 Thread Erik R
I'm working on a simple image manipulation app that requires opening
bitmaps at full resolution, which of course results in OutOfMemory
issues. I know that the short answer is to simply use less memory via
BitmapFactory's inSampleSize Option to downsample the bitmap, but for
this app I really would like to retain the full resolution for
editing. One solution I have been investigating is loading the bitmap
entirely on the native heap, after learning that the memory limitation
is only imposed within the Dalvik VM heap. A look into the Android
source code revealed that this is already the case... BitmapFactory
uses native methods to load a bitmap on the native heap, while
maintaining a reference to it on the VM heap. The issue then is that
it appears the native memory used by the bitmap is actually counted
against the available VM memory, when it really isn't there. A look
into the stock Camera and Gallery apps' source revealed that they get
around this by using an additional BitmapFactory Option,
inNativeAlloc. I was able to find this field in the Java code for
BitmapFactory:

 196  * Normally bitmap allocations count against the dalvik
heap, which
 197  * means they help trigger GCs when a lot have been
allocated. However,
 198  * in rare cases, the caller may want to allocate the
bitmap outside of
 199  * that heap. To request that, set inNativeAlloc to true.
In these
 200  * rare instances, it is solely up to the caller to
ensure that OOM is
 201  * managed explicitly by calling bitmap.recycle() as soon
as such a
 202  * bitmap is no longer needed.
 203  *
 204  * @hide pending API council approval
 205  */
 206 public boolean inNativeAlloc;

Are there any plans to "unhide" this field anytime soon?

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


Re: [android-developers] Re: Want to capture screenshot of current screen from phone

2011-06-08 Thread Mark Murphy
On Wed, Jun 8, 2011 at 2:07 PM, Adam Ratana  wrote:
> Mark Murphy, you said this is impossible, did you mean in the sense of the
> way DDMS grabs the full-monty screenshot?

Um, for some definition of "full-monty", I presume, yes. :-)

> I do hope that Android Handset/Tablet manufacturers catch on and implement
> hardware screen capturing options, a la iOS -- I don't believe screenshots
> are programmatically possible there either, for the same reasons, but the
> user can capture one at any time with a combination of hardware buttons.  It
> will prevent us from having to come up with adhoc solutions like this, and
> allow the screenshot process to be user driven, and thus alleviating
> security concerns.  I believe I read that either Samsung or Motorola may do
> this in future handsets?

I haven't heard anything about that.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android 3.0 Programming Books: http://commonsware.com/books

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


Re: [android-developers] text colorsv

2011-06-08 Thread emaildevbr . stress



Sent from my Verizon Wireless Phone

-Original message-
From: bob 
To: Android Developers 
Sent: Wed, Jun 8, 2011 13:46:17 GMT-03:00
Subject: [android-developers] text color

Can someone help me figure out how to set the text color in a dialog?

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

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

Re: [android-developers] Re: Want to capture screenshot of current screen from phone

2011-06-08 Thread Adam Ratana
I just checked this approach out as a user had emailed me asking about 
screenshot capability.  This definitely does the trick, but a another poster 
pointed out, any output from certain components (in my case the camera 
preview surfaceview) does not show up.
Perhaps the correct approach then is to capture the output of the surface 
views as bitmaps, and then draw on top of them, it's not quite an "instant" 
screenshot, but will probably serve the purpose?  I'll experiment with this 
and if I have good results will post back.

Mark Murphy, you said this is impossible, did you mean in the sense of the 
way DDMS grabs the full-monty screenshot?

I do hope that Android Handset/Tablet manufacturers catch on and implement 
hardware screen capturing options, a la iOS -- I don't believe screenshots 
are programmatically possible there either, for the same reasons, but the 
user can capture one at any time with a combination of hardware buttons.  It 
will prevent us from having to come up with adhoc solutions like this, and 
allow the screenshot process to be user driven, and thus alleviating 
security concerns.  I believe I read that either Samsung or Motorola may do 
this in future handsets?



On Friday, June 3, 2011 8:30:10 AM UTC-4, New Developer wrote:
>
> Well after much trial and error I managed to capture the entire  layout  or 
> activity
> using the following code
>
> View   myView = findViewById(R.id.form);
> Bitmap bmp= Bitmap.createBitmap( myView.getMeasuredWidth() , 
> myView.getMeasuredHeight() , Config.ARGB_);
> Canvas canvas = new Canvas(bmp);
> myView.draw(canvas);
> try {
>FileOutputStream out = new FileOutputStream( "/sdcard/screen.jpg"  );
>bmp.compress(Bitmap.CompressFormat.JPEG, 100, out);
>out.flush();
>out.close();
> } catch (Exception e) {
>e.printStackTrace();
> }
>
> Not sure if this will help or not ?  NOTE: that you can also save as a PNG 
> if you want .
>
>
>
>
>
> On Jun 3, 2011, at 8:11 AM, Bharathi raja wrote:
>
> Hi,
> Thanks for sharing code.
>
> Code u shared will capture the entire screen, even if it is not widget 
> component.
> [mean screen may have android or flash or web component]
> i wanted to capture all the three.
>
> Regards,
> Bharathiraja R
>
> On Fri, Jun 3, 2011 at 1:39 AM, New Developer  wrote:
>
>> Okay I output my bitmap to file  as PNG and it only shows the  visible
>> portion of the layout
>> What is currently seen on the screen  not the entire layout.
>> So would I change the  onClick Code to capture the entire layout ?
>>
>> thanks in advance
>>
>>
>> On Jun 2, 3:35 pm, New Developer  wrote:
>> > I'm trying to do something similar
>> >
>> > Inside my button's OnClick I have
>> >
>> > ViewmyView  = arg0.getRootView();
>> > myView.setDrawingCacheEnabled( true );
>> > mPDF.addImage( myView.getDrawingCache() );
>> >
>> > I'm hoping this will capture the screen to a bitmap
>> >
>> > my PDF.addImage   is as follows:
>> >
>> > public void addImage(Bitmap bmp) {
>> > ByteArrayOutputStream bos = new ByteArrayOutputStream();
>> > bmp.compress(CompressFormat.JPEG, 100 , bos);
>> >
>> > mImage += "5 0 obj \n" +
>> >  "<< /Type /XObject\n" +
>> >  "  /Subtype /Image\n" +
>> >  "  /Width  " + bmp.getWidth()  + " \n" 
>> +
>> >  "  /Height " + bmp.getHeight() + " \n" 
>> +
>> >  "  /ColorSpace  /DeviceRGB\n" +
>> >  "  /BitsPerComponent 8\n" +
>> >  "  /Length " + bos.size()  + "\n" +
>> >  "  /Filter  /ASCIIHexDecode\n" +
>> >  ">>\n\n" +
>> >  "stream\n";
>> >
>> > mImage += bos.toString() + "\n";
>> >
>> > mImage += "endstream\n" +
>> >  "endobj\n\n";
>> > }
>> >
>> > 1) Is the onClick the correct way to capture the screen to bitmap ?
>> > 2) Is the PDF code the correct way to store an image inside a PDF ?
>> >
>> > thanks in advance
>> >
>> > On Jun 2, 3:11 pm, Paul Turchenko  wrote:
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>> > > Your process will need permission to do that. ADB has it by default,
>> > > but regular apps don't. Unless you're rooted, you can't do that.
>> >
>> > > On Jun 2, 4:27 am, Bharathiraja R 
>> > > wrote:
>> >
>> > > > Hi All,
>> >
>> > > > Want sample code to capture screenshot of current screen from phone,
>> > > > same like ddms (screen capture).
>> > > > Please help me out.
>> >
>> > > > Regards,
>> > > > Bharathiraja 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-d...@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-develop...

Re: [android-developers] Honeycomb keyboard lreesponding to touch events on status bard

2011-06-08 Thread emaildevbr . stress

F2

Sent from my Verizon Wireless Phone

-Original message-
From: Marcin Orlowski 
To: android-developers@googlegroups.com
Sent: Tue, Jun 7, 2011 18:59:45 GMT-03:00
Subject: Re: [android-developers] Honeycomb keyboard responding to touch  
events on status bar


On Jun 7, 2011 11:44 PM, "James"  wrote:


With the standard keyboard on my Xoom, if I touch the status bar just

below the spacebar on the keyboard, the spacebar receives the touch event.

does not sound sane - quite likely you just hit the spacebar area or your
digitizer thinks so.

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

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

Re: [android-developers] text color

2011-06-08 Thread Fred Niggle
Hello,
You can do this dynamically as well.

At http://realfred.uphero.com/android/androidsnippets.html
is the following  snippet which works

button1.setBackgroundColor(Color.argb(125, 0, 0, 255));

Hope this helps,
Fred.

On 08/06/2011, bob  wrote:
> Can someone help me figure out how to set the text color in a dialog?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

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


[android-developers] Re: In Android, how to get the keyevent of 'home Key' ?

2011-06-08 Thread Robert Green
Think of home like alt-tab in windows.  You never need to capture it.
You just need to handle onPause()/onStop() in a way that makes sense
for the user temporarily leaving your app.  You'll get onFinish() when
your app is to be actually destroyed.  If you have a need to actually
kill off the whole thing when home is pressed, call finish() in
onPause()/onStop() and you shall receive the touch of the droid
reaper, making for a clean start next time the user tries to enter the
activity.

On Jun 8, 10:31 am, Indicator Veritatis  wrote:
> Your blog post IS the best explanation I have seen to date of what the
> Home key really means. I thought it was particularly interesting that
> it emphasized something I have been dimly aware of but keep
> forgetting: unlike the Back key, pressing Home does NOT cause finish()
> to be called. I assume from your description that it triggers only one
> lifecycle callback, onPause(). It doesn't even itself trigger
> onStop(), which may or may not follow.
>
> But shouldn't it trigger onStop() too? After all, the application is
> no longer visible. And what about the Activity Stack? Doesn't pressing
> Home put the least recently used Activity on that stack?
>
> In fact, when I put Log.d statements in my main Activity for both
> onPause() and onStop(), I see both get called when I press the Home
> key.
>
> On Jun 8, 5:13 am, Mark Murphy  wrote:
>
>
>
>
>
>
>
> > On Wed, Jun 8, 2011 at 7:20 AM, Mark Murphy  wrote:
> > > On Wed, Jun 8, 2011 at 2:31 AM, Droid  wrote:
> > >> I need to know when the home button is pressed too (otherwise my app
> > >> returns to visibility again and again for ever).
>
> > > Then fix your bug.
>
> > >> (Please don't tell me I need to design my app
> > >> 'properly', I have been Android dev for over a year now)
>
> > > Tough. Design your app properly.
>
> > I just wrote up a blog post about why you should not care about the
> > HOME button and how better to solve this "problem":
>
> >http://commonsware.com/blog/2011/06/08/please-ignore-home-button.html
>
> > --
> > Mark Murphy (a Commons 
> > Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> > Android 3.0 Programming Books:http://commonsware.com/books

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


Re: [android-developers] Honeycomb keyboard responding to touch events on status bar

2011-06-08 Thread emaildevbr . stress

J

Sent from my Verizon Wireless Phone

-Original message-
From: Marcin Orlowski 
To: android-developers@googlegroups.com
Sent: Tue, Jun 7, 2011 18:59:45 GMT-03:00
Subject: Re: [android-developers] Honeycomb keyboard responding to touch  
events on status bar


On Jun 7, 2011 11:44 PM, "James"  wrote:


With the standard keyboard on my Xoom, if I touch the status bar just

below the spacebar on the keyboard, the spacebar receives the touch event.

does not sound sane - quite likely you just hit the spacebar area or your
digitizer thinks so.

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

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

Re: [android-developers] Re: In Android, how to get the keyevent of 'home Key' ?

2011-06-08 Thread TreKing
On Wed, Jun 8, 2011 at 12:31 PM, Indicator Veritatis wrote:

> But shouldn't it trigger onStop() too? After all, the application is
> no longer visible. And what about the Activity Stack? Doesn't pressing
> Home put the least recently used Activity on that stack?
>

Yes and yes (assuming you meant "last" recently used) but the point is
neither of those actions is due to HOME being pressed - this is the
lifecycle. If you were to use a quick-launching app that allowed you to
launch a new app "B" while you were still on app "A", app "A" would pause
then stop and be placed on the history stack - it has nothing to do with the
fact that the activity coming up happens to be the Home app. In fact,
playing with my N1 with 2.3.4 shows that the *current* activity is place on
the history stack as soon as it's brought up, not when you go away from it.

-
TreKing  - Chicago
transit tracking app for Android-powered devices

-- 
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] Continuous listening to server

2011-06-08 Thread dilu
Hi,
I am working on an application which will continuously listen to
server i.e if there is any changes on server then server will push it
to the client and client should be able to receive it.I dont want to
poll the server.I want to use push technology.
I did a lot of google.People are suggesting to use some third part
library or Android's C2DM.But I am bit confused which way to go?I am
using a .net based server.
If any one has developed similar kind of thing then please help me or
guide me with some piece of code or link or tutorial.

Regards
Dileep

-- 
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] Mode selector pattern - Overlay views

2011-06-08 Thread Federico Paolinelli
Hi all, for my new app I'd like to use mode selector pattern as described 
here http://www.androidpatterns.com/uap_pattern/mode-selector

I was trying to figuring out how to implement it, and I was thinking about 
using a framelayout, having an hidden listview which overrides the "main" 
list view, and to show it only when the button is pressed. Do you have any 
suggestions / other ways to implement such pattern? It's the first time I 
need to have some ui element to be drawn over others. 

Any help would be more than appreciated, in the meanwhile I'll try to start 
this way :-)

Thanks in advance, 

Federico

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

Re: [android-developers] Great Problem

2011-06-08 Thread Simon Platten
Add try and catch clauses to your methods that should help you locate the
problem.

Regards,Sy

On 8 Jun 2011 15:49, "Diogo Salaberri"  wrote:

hi guys, I need a help please.

I got this error on my app:

06-08 14:42:33.584: ERROR/AndroidRuntime(269): java.lang.RuntimeException:
Unable to start activity ComponentInfo{br.com.vivo/br.com.vivo.A_Home}:
java.lang.NullPointerException


Anyone can help me ?

Thanks

-- 
Atenciosamente;
Diogo Bonoto Salaberri
Bacharel em Ciência da Computação - UFPel

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

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

Re: [android-developers] Great Problem

2011-06-08 Thread Diogo Salaberri
Guys, I solved that problem.
My problem was in a layout definition that was defined with caps lock, but
with the same name, and the Eclipse don't put erros in line, but the
emulator show me in logCat.

Thanks, bye.

On Wed, Jun 8, 2011 at 12:21 PM, TreKing  wrote:

> On Wed, Jun 8, 2011 at 10:01 AM, Diogo Salaberri wrote:
>
>> I guess that it not so simple.
>>
>
> Sure it is - step through your debugger and print out log statements. At
> some point something is null. Find out what that is.
>
>
>> I normally use that "x" TextView inside the onCreate() and after ( methods
>> ); But, i don't know how, this look like loosing the refference for my
>> declarations.
>>
>
> If you're getting NULL from findViewById then your layout is setup wrong so
> double check that.
> If not but your variable is NULL afterward at some point then, again, use
> your debugger and logcat to find out when and where it's getting set to
> null. Then don't do that.
>
>
> -
> TreKing  - Chicago
> transit tracking app for Android-powered devices
>
>  --
> 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
>



-- 
Atenciosamente;
Diogo Bonoto Salaberri
Bacharel em Ciência da Computação - UFPel

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

Re: [android-developers] Loading Bitmaps in native heap

2011-06-08 Thread Simon Platten
Java doesnt support pointers or direct access to memory which is why native
routines exist...why dont you open the files as streams and only render what
is require for the view orrescale the image?

Regards,Sy

On 8 Jun 2011 18:21, "Erik R"  wrote:

I'm working on a simple image manipulation app that requires opening
bitmaps at full resolution, which of course results in OutOfMemory
issues. I know that the short answer is to simply use less memory via
BitmapFactory's inSampleSize Option to downsample the bitmap, but for
this app I really would like to retain the full resolution for
editing. One solution I have been investigating is loading the bitmap
entirely on the native heap, after learning that the memory limitation
is only imposed within the Dalvik VM heap. A look into the Android
source code revealed that this is already the case... BitmapFactory
uses native methods to load a bitmap on the native heap, while
maintaining a reference to it on the VM heap. The issue then is that
it appears the native memory used by the bitmap is actually counted
against the available VM memory, when it really isn't there. A look
into the stock Camera and Gallery apps' source revealed that they get
around this by using an additional BitmapFactory Option,
inNativeAlloc. I was able to find this field in the Java code for
BitmapFactory:

 196  * Normally bitmap allocations count against the dalvik
heap, which
 197  * means they help trigger GCs when a lot have been
allocated. However,
 198  * in rare cases, the caller may want to allocate the
bitmap outside of
 199  * that heap. To request that, set inNativeAlloc to true.
In these
 200  * rare instances, it is solely up to the caller to
ensure that OOM is
 201  * managed explicitly by calling bitmap.recycle() as soon
as such a
 202  * bitmap is no longer needed.
 203  *
 204  * @hide pending API council approval
 205  */
 206 public boolean inNativeAlloc;

Are there any plans to "unhide" this field anytime soon?

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

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

Re: [android-developers] Loading Bitmaps in native heap

2011-06-08 Thread Romain Guy
There is no such plan at the moment.

On Wed, Jun 8, 2011 at 10:17 AM, Erik R  wrote:
> I'm working on a simple image manipulation app that requires opening
> bitmaps at full resolution, which of course results in OutOfMemory
> issues. I know that the short answer is to simply use less memory via
> BitmapFactory's inSampleSize Option to downsample the bitmap, but for
> this app I really would like to retain the full resolution for
> editing. One solution I have been investigating is loading the bitmap
> entirely on the native heap, after learning that the memory limitation
> is only imposed within the Dalvik VM heap. A look into the Android
> source code revealed that this is already the case... BitmapFactory
> uses native methods to load a bitmap on the native heap, while
> maintaining a reference to it on the VM heap. The issue then is that
> it appears the native memory used by the bitmap is actually counted
> against the available VM memory, when it really isn't there. A look
> into the stock Camera and Gallery apps' source revealed that they get
> around this by using an additional BitmapFactory Option,
> inNativeAlloc. I was able to find this field in the Java code for
> BitmapFactory:
>
>  196          * Normally bitmap allocations count against the dalvik
> heap, which
>  197          * means they help trigger GCs when a lot have been
> allocated. However,
>  198          * in rare cases, the caller may want to allocate the
> bitmap outside of
>  199          * that heap. To request that, set inNativeAlloc to true.
> In these
>  200          * rare instances, it is solely up to the caller to
> ensure that OOM is
>  201          * managed explicitly by calling bitmap.recycle() as soon
> as such a
>  202          * bitmap is no longer needed.
>  203          *
>  204          * @hide pending API council approval
>  205          */
>  206         public boolean inNativeAlloc;
>
> Are there any plans to "unhide" this field anytime soon?
>
> --
> 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

-- 
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: In Android, how to get the keyevent of 'home Key' ?

2011-06-08 Thread Indicator Veritatis
Your blog post IS the best explanation I have seen to date of what the
Home key really means. I thought it was particularly interesting that
it emphasized something I have been dimly aware of but keep
forgetting: unlike the Back key, pressing Home does NOT cause finish()
to be called. I assume from your description that it triggers only one
lifecycle callback, onPause(). It doesn't even itself trigger
onStop(), which may or may not follow.

But shouldn't it trigger onStop() too? After all, the application is
no longer visible. And what about the Activity Stack? Doesn't pressing
Home put the least recently used Activity on that stack?

In fact, when I put Log.d statements in my main Activity for both
onPause() and onStop(), I see both get called when I press the Home
key.

On Jun 8, 5:13 am, Mark Murphy  wrote:
> On Wed, Jun 8, 2011 at 7:20 AM, Mark Murphy  wrote:
> > On Wed, Jun 8, 2011 at 2:31 AM, Droid  wrote:
> >> I need to know when the home button is pressed too (otherwise my app
> >> returns to visibility again and again for ever).
>
> > Then fix your bug.
>
> >> (Please don't tell me I need to design my app
> >> 'properly', I have been Android dev for over a year now)
>
> > Tough. Design your app properly.
>
> I just wrote up a blog post about why you should not care about the
> HOME button and how better to solve this "problem":
>
> http://commonsware.com/blog/2011/06/08/please-ignore-home-button.html
>
> --
> Mark Murphy (a Commons 
> Guy)http://commonsware.com|http://github.com/commonsguyhttp://commonsware.com/blog|http://twitter.com/commonsguy
>
> Android 3.0 Programming Books:http://commonsware.com/books

-- 
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] ADT 11.0.0

2011-06-08 Thread abhishek akhani
Hi

Today i downloaded ADT 11.0.0 and now when i am adding any view to
Relative layout i am having problem adding it. Like i can not find any
id to reference as a "align bottom" or "Layout Right of" property..
when i try to set these properties it shows me
Drawables,Arrays,Strings,Layout - ids but i am not able to get view-
ids anywhere which i need... is this a bug or what? Is there any
one to explain???

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


Re: [android-developers] Display.getRotation() incompatible with accelerometer data

2011-06-08 Thread emaildevbr . stress


Sent from my Verizon Wireless Phone

-Original message-
From: Dianne Hackborn 
To: android-developers@googlegroups.com
Sent: Wed, Jun 8, 2011 00:11:51 GMT-03:00
Subject: Re: [android-developers] Display.getRotation() incompatible with 
accelerometer data

Which device is this?

On Tue, Jun 7, 2011 at 1:32 AM, Marcin Mikosik  wrote:

Hi,
I'm experimenting with newly bought android tablet and found out that android 
API it provides does not comply with android API documentation/specification.
Specifically Display.getRotation() and Accelerometer readings returns values 
that contradicts each other.
For example:running application that has android:screenOrientation="landscape" 
and quering Display.getRotation() returns Surface.ROTATION_0 which means this 
tablet is "landscape-default device" as described 
in http://android-developers.blogspot.com/2010/09/one-screen-turn-deserves-another.html 

Still, when running the same application and holding device in landscape 
orientation in front of me, I get accelerometer reading that says something 
around: X=10, Y=0 which is clearly wrong because accelerometer coordinate 
system should be aligned with device default orientation (landscape in this 
case). According to blogpost mentioned above - when I keep device in its 
default-orientation (which is landscape in this case) I should get 
accelerometer reading X=0, Y=10.

Can anybody suggest what's wrong here?Either my device is broken or its 
software has a bug or I misunderstood the API semantics (?)
thanksMarcin

-- 

You received this message because you are subscribed to the Google

Groups "Android Developers" group.

To post to this group, send email to android-developers@googlegroups.com

To unsubscribe from this group, send email to

android-developers+unsubscr...@googlegroups.com

For more options, visit this group at

http://groups.google.com/group/android-developers?hl=en

-- 
Dianne Hackborn
Android framework engineer

hack...@android.com

Note: please don't send private questions to me, as I don't have time to 
provide private support, and so won't reply to such e-mails.  All such 
questions should be posted on public forums, where I and others can see and 
answer them.

-- 

You received this message because you are subscribed to the Google

Groups "Android Developers" group.

To post to this group, send email to android-developers@googlegroups.com

To unsubscribe from this group, send email to

android-developers+unsubscr...@googlegroups.com

For more options, visit this group at

http://groups.google.com/group/android-developers?hl=en

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

Re: [android-developers] Re: text color

2011-06-08 Thread Simon Platten
Select the textview, then click on the properties tab, scroll down to text
coloryou have to create a colors.xml file in your resources and put all
your color definitions in it.

Regards,Sy

On 8 Jun 2011 18:07, "James Ots"  wrote:

What part of colour setting are you having difficulty with?

James



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

-- 
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: text color

2011-06-08 Thread James Ots
What part of colour setting are you having difficulty with?

James

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

  1   2   >