Re: [android-developers] FragmentStatePagerAdapter is not setting the UI elemtents when using Loader API

2012-09-09 Thread Dianne Hackborn
I don't think you have provided enough information to help.  The argument
you supplied to instantiate() is just made available to the fragment
through Fragment.getArguments().  Presumably the problem is then somewhere
in your DetailFragment and how it is managing those arguments, but you
haven't provided any information about this.

On Sun, Sep 9, 2012 at 1:50 PM, Jose Ayerdis joseayer...@gmail.com wrote:

 Hello everybody, so I have run now with this problem when trying to use
 FragmentStatePagerAdapter, I pick a specific element from a List and send
 an array of ids with the position picked like this

 intent.putExtra(ids, ids);

 intent.putExtra(position, position);

 Then the activity is called which load the fragment


  @Override

 public Fragment getItem(int i) {

  fragments[i] = DetailFragment.newInstance(tradersId[i]);

 return fragments[i];

 }

 The problem is that inside the DetailFragment the values are set with the
 Loader API and even when they reach  onLoadFinished and set the values it
 never gets to be set.

 Funny thing is that once I start switching views the values are set. Any
 idea? Also the DetailFragment has a ListView inside which also loads with
 the Loader API.


 Sincerly yours,

 [Jose Luis Ayerdis Espinoza]
 Necronet.info | 
 LinkedInhttp://www.linkedin.com/pub/jose-luis-ayerdis-espinoza/28/7b4/704| 
 Careers
 StackOverflow http://careers.stackoverflow.com/necronet

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] Screen Support in Android 3.2 (API level 13)

2012-09-09 Thread Dianne Hackborn
On Fri, Sep 7, 2012 at 8:13 AM, Javier Garcia Crespo jgarc...@gmail.comwrote:

 Yes new devices with android 3.2 upper. Hvga wvga no way to select
 diferent layout with new technique. Poor. I have to make a test mixing
 horenration and dps selector .h240-por or h320-land


What are you trying to say?  The new resource selector lets you cover the
features of the old size buckets, and also does lots lots more.

-- 
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] Messenger from Remote Service Causing Memory Leak

2012-08-30 Thread Dianne Hackborn
 Example]

 Does anyone know if there is a way to clear or disable the Messenger when
 the Operation is over so it doesn't create this memory leak?

 Is there perhaps a better way to implement the IPC to the Servicein the
 same fashion, so that multiple disparate objects can make a request and get
 a result asynchronously?  I'm not convinced that just switching to using a
 bound service implementation will solve this issue as I would will need the
 Messenger to process the callback.

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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: How do I append an Xml File?

2012-08-30 Thread Dianne Hackborn
Note that this is a very inefficient way to do this.  XML really doesn't
lend itself to append operations.  If you have some stored data that you
are going to be appending to, I would seriously consider some format
besides XML.

On Thu, Aug 30, 2012 at 1:39 PM, Guilherme Bernardi 
gui.bernard...@gmail.com wrote:

 Ok, I'll start... and post the results.

 Thank you.

 Em quinta-feira, 30 de agosto de 2012 16h42min36s UTC-3, Guilherme
 Bernardi escreveu:

 Hi.

 I'm trying to append an Xml Data File.

 The structure of Xml is:

 ?xml version='1.0' encoding='UTF-8' standalone='yes' ?
 clientes

 cliente4

 Empresa1/Empresa

 Codigo5/Codigo

 Nomegsdf/Nome

 Enderecoags/Endereco

 Bairrogasd/Bairro

 /cliente4

 /clientes

 I need to add another record. I got it, but the new record was inserted
 like this:

 ?xml version='1.0' encoding='UTF-8' standalone='yes' ?
 clientes

 cliente4

 Empresa1/Empresa

 Codigo5/Codigo

 Nomegsdf/Nome

 Enderecoags/Endereco

 Bairrogasd/Bairro

 /cliente4

 /clientes*cliente6TESTEtestando/TESTE/cliente6
 cliente6TESTEtestando/TESTE/cliente6cliente6
 TESTEtestando/TESTE/cliente6*
 *
 *
 How can I get the position of /cliente4 and append the new record or
 can I delete the EndTag /clientes and add the new record and set the
 EndTag again?

 To appending the file I'm using:

 OutputStream is = openFileOutput(cliente.xml, MODE_APPEND);

 XmlSerializer serializer = Xml.newSerializer();
 serializer.setOutput(is, UTF-8);
 serializer.startTag(null, cliente6);
 serializer.startTag(null, TESTE);
  serializer.text(testando);
  serializer.endTag(null, TESTE);
 serializer.endTag(null,**cliente6);
 serializer.endDocument();
 serializer.flush();
 is.close();

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] Using startActivity( intent ) multiple times, fails.

2012-08-24 Thread Dianne Hackborn
This is wrong in a number of ways:

getLaunchIntentForPackage( com.android.email );

First, com.android.email is not an API.  That is the internal identifier
for the current e-mail application that is part of AOSP; there is *no*
guarantee that such a thing will ever exist on the device.

Second, more specific to your issue here, getLaunchIntentForPackage()
returns a *launch* intent, for use in semantics like an app launcher.  What
you are asking for is not an app launcher; you want to run flow as part of
your own task, not launch something different.  In particular, what this
Intent will do is bring the current e-mail app to the foreground *in
whatever state it was last in*.  The user may have been in the middle of
composing a message, viewing something, etc.  It isn't saying to bring them
to the list of e-mail messages for them to import something.

One other thing, when you say startActivityForResult() is not working, this
is not because of an explicit vs. implicit Intent; this is because part of
what getLaunchIntentForPackage() does is set FLAG_ACTIVITY_NEW_TASK, which
says to launch the Intent as a separate task from yours (bringing an
existing task to the foreground etc), which is central to the semantics of
this being for app launchers not in-task UI flow.

On Thu, Aug 23, 2012 at 7:16 AM, Mark Jawdoszak evilja...@gmail.com wrote:

 I have an intent that starts the default Android mail client:

 Intent emailIntent = this.getPackageManager().getLaunchIntentForPackage(
 com.android.email );
 this.startActivity( emailIntent );

 Very simple stuff, and it fires off the Email client, from an Import from
 Email button in my app.

 My application is also registered with an intent-filter to open PDF
 files.
 So, if I use the above Intent to open up the Email client, find an email
 with a PDF attachment, download it, launch it, select my application from
 the chooser... then everything loads great.

 Now if I hit my Import from Email button again, the intent runs, but the
 Email client is never brought into the foreground.

 Am I missing something when using startActivity() to (re)launch the
 correct app?
 I have tried checking if the intent is OK by following this
 http://developer.android.com/training/basics/intents/sending.html#Verifybut 
 it always returns true (and that makes sense, as it can find the
 Application, but it's just not bringing it to the foreground).

 I have also tried using startActivityForResult(), but as explained in the
 Android docs, this fires off a cancel immediately, because the Activity
 is not Explicit, but Implicit (thought I'd try it, just in case).

 I feel like I'm missing something, a step, a call to something... or have
 I hit upon some strange loop that works in one case, but cannot keep
 looping?  Any help/pointers would be greatly appreciated!

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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: The effect of differnet vendor RIL implementations of URC's on Android

2012-08-23 Thread Dianne Hackborn
Are you holding a wake lock?  If not, you have no guarantees about how much
stuff will run to give you such reports.  The difference between these two
devices could simply be that one of the devices has more stuff running that
is holding wake locks to let you run more as a side-effect.  (That said,
this only applies if the device is running on battery.  While plugged in
Android holds a wake lock to keep the CPU from sleeping.)

On Thu, Aug 23, 2012 at 2:20 PM, sebouh00 sebou...@gmail.com wrote:

 It would be good if someone can back me up, but I think it doesn't matter
 if I register a listener or not. The RIL will send up the update and
 Android has to wake up and handle it. Then from what I see in the
 TelephoneRegistry class, it has to check for registered records and call
 their callback function.

 If so, my question would be: wouldn't this be killing the battery if there
 are constant signal or cell updates, say if the device is moving fast from
 one cell to the other? The device would never have the chance to sleep.


 On Wednesday, August 22, 2012 11:33:40 PM UTC+3, sebouh00 wrote:

 Hi. I'm wondering if anyone can explain to me the following.

 I have two devices, an HTC Desire and a Samsung Galaxy Nexus. I have the
 same app running on both. The app has a foreground service listening to
 Cell Location and Signal Strength updates by registering to the
 PhoneStateListener.

 Both work similarly when the phone is fully awake. When the phones go to
 sleep, the nexus keeps updating the signal strength (and sometimes the cell
 location) but the Desire stops. This I reckon is due to how each RIL is
 handling the SCREEN_OFF intent.

 What I would like to understand is, what is the effect of the cell/signal
 updates on the nexus when the phone is sleep. I have a logger in the
 listener and I keep getting update logs during sleep.

 1) Does this mean Android is waking up on each signal strength update?
 2) If I deregister from this listener on screen off, will Android still
 wake up because of the way the RIL is implemented?

 I don't hold any cpu locks inside the listener.

 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




-- 
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] background intent

2012-08-22 Thread Dianne Hackborn
Activities don't run in the background.  That is what services (and/or
broadcast receivers) are for.

On Tue, Aug 21, 2012 at 11:19 PM, Ehsan Sadeghi esade...@gmail.com wrote:

 How can I run an activity in background and minimized it until invoke that?

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] Getting started with Android. Love the overall system architecture and SDK except for one thing...

2012-08-22 Thread Dianne Hackborn
I'm curious about this:

On Sun, Aug 19, 2012 at 9:17 AM, rmz76 jeremy.de...@gmail.com wrote:

 I'll give an example of such a feature: Horizontal view swiping. From the
 official Android Play store to the CNN App, this is probably the most
 common navigation we're seeing for dealing with menus on Android. It's
 beautiful, it's also a pain in ass to implement. After much searching I
 found an article on this on the official site


 http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html


 I can open the source example and understand what's going on but my
 question is why does it take pages and pages of foundation code to
 implement something that should be core?


There is literally 15 lines of code in that article, with another 3 lines
of XML.  Is that really pages and pages of foundation code?  The code is
implementing a FragmentPagerAdapter subclass with two methods, one to
report how many pages there are, and the second to generate the pages.  I'm
not sure how this could be simpler...?

It is true that for each page you do need to implement a Fragment subclass
that contains your UI, so there is a little more code for that.  But it's
not huge.  And if you really don't want to use fragments, that document
also shows that you can actually pretty easily implement a custom
PagerAdapter that generates raw views for the pages.

There must be something I am missing here...?


 View transitions are another good example. Let's say I want my view to
 fade in or out or that I want it to rotate in 3D (just do a simple flip or
 slide in and out). I don't understand why the developer has to go so low
 level to accomplish these sort of task. I'm hoping perhaps I missed
 something and that there are wrappers for common transforms, etc...


Fwiw view transitions are a lot easier starting with 3.0's new animation
framework.

-- 
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] How to get battery usage from cpu usage in android

2012-08-22 Thread Dianne Hackborn
There isn't an API to retrieve this.  The computation done for the battery
stats UI is a complicated approximation (taking into account CPU stepping
etc to some degree) that is very much an approximation.  It is not accurate
enough that I would want it available through an API.

On Tue, Aug 21, 2012 at 8:53 PM, thejaswi s thejasw...@gmail.com wrote:

  A bove link suggested by  Asheesh arya  saying about present technology ,
 plugged, scale, health, voltage, level, temperature, status . but not
 about how much battery is consuming to process cpu cycles. So please tel me
 how cpu usage related with battery usage using a equation.


 On Tue, Aug 21, 2012 at 5:09 PM, Asheesh Arya asheesharya...@gmail.comwrote:

 just go through this link might be you get some idea
 http://www.krvarma.com/2010/07/getting-battery-information-in-android/

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


  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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: openRawResource: does compressed files in APK get uncompressed completely?

2012-08-22 Thread Dianne Hackborn
The 1MB limit was for reading any compressed file.  There is really no
distinction between assets and resources in this regard.  That said, you
can pre-compress your data and store it with say a .zip extension (so there
is no attempt to try to compress it again), and then de-compress the data
yourself when reading it.

On Tue, Aug 21, 2012 at 3:56 PM, Tamás Kovács
falcon.firebre...@gmail.comwrote:

 Thanks, Dianne.

 Was the 1MB limitation removed in case of *assets* as well, or only
 for *resources*?

 On Aug 22, 12:28 am, Dianne Hackborn hack...@android.com wrote:
  Prior to I think Gingerbread, it would entirely uncompress in memory
 with a
  limit on the amount of memory it would use (I think 1MB) above which the
  open would fail.  On current versions of the platform it uncompression is
  streamed as you read it with no limit on size.
 
  On Tue, Aug 21, 2012 at 1:25 PM, Tamás Kovács
  falcon.firebre...@gmail.comwrote:
 
 
 
 
 
 
 
 
 
   Hello,
 
   I have a custom file format in res/raw, which means it will get
   compressed in APK.
 
   Question:
 
   Assume my application is installed on the device. When I open a file
   via openRawResource(), does it completely uncompress the file in the
   memory?
 
   E.g. if it's a 3MB file, will it uncompress it in memory? If I only
   need 10KB data from a certain offset (and I reach it via
   BufferedInputStream.skip), will it still consume 3MB when
   openRawResource() is called?
 
   --
   You received this message because you are subscribed to the Google
   Groups Android Developers group.
   To post to this group, send email to
 android-developers@googlegroups.com
   To unsubscribe from this group, 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




-- 
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] Using dpi instead pixels in canvas.drawBitmap

2012-08-22 Thread Dianne Hackborn
What does look horrible mean?  Your bitmaps are being scaled?  Note that
you really really want to scale your bitmaps at load time, not draw time,
so you can turn on important things like bilinear interpolation when
scaling without impacting your draw performance.

On Tue, Aug 21, 2012 at 3:29 PM, Jhon perez...@gmail.com wrote:

 I have read the screen support API guide (
 http://developer.android.com/guide/practices/screens_support.html) and
 much more resources, but I cannot understand how the dpi works.

 I'm developing a game, and I'm not using any layouts (I'm going to draw
 all myself with functions like canvas.drawbitmap). But when I use the
 Canvas.Drawbitmap function I need to specify the pixels of the screen where
 I want to draw the image.

 So I'm working now with a fixed resolution (800x480) and I'm using the
 drawable-nodpi folder and adjusting the canvas later if the screen of the
 phone is wider or narrow. The problem with that is that the images look
 horrible when the resolution is not the native one (800x480).

 What can I do to solve this problem? I've read and read during 3 days, but
 all explanations and examples are related to Layouts, Nine Patches and so.

 Thank you very much.

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] openRawResource: does compressed files in APK get uncompressed completely?

2012-08-21 Thread Dianne Hackborn
Prior to I think Gingerbread, it would entirely uncompress in memory with a
limit on the amount of memory it would use (I think 1MB) above which the
open would fail.  On current versions of the platform it uncompression is
streamed as you read it with no limit on size.

On Tue, Aug 21, 2012 at 1:25 PM, Tamás Kovács
falcon.firebre...@gmail.comwrote:

 Hello,

 I have a custom file format in res/raw, which means it will get
 compressed in APK.

 Question:

 Assume my application is installed on the device. When I open a file
 via openRawResource(), does it completely uncompress the file in the
 memory?

 E.g. if it's a 3MB file, will it uncompress it in memory? If I only
 need 10KB data from a certain offset (and I reach it via
 BufferedInputStream.skip), will it still consume 3MB when
 openRawResource() is called?

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] How to remove black topbar on activity animation?

2012-08-14 Thread Dianne Hackborn
I assume you mean the part of your window that is normally behind the
status bar?

If so, there is no simple way to do this.  Aside from just making your app
fullscreen so there is no status bar (and thus your content draws all the
way to the top), you'd need to do an approach like playing games where you
make your window translucent, set it to not have a background, and make
sure that tap part of your window is transparent when it is drawn.

Note that in 3.1 the platform know does some tricks to prevent that top
part of the window from being drawn when it determines it is obscured by
the status bar prior to any transformation applied by an animation etc.

On Sat, Aug 11, 2012 at 2:20 PM, user123 ivanschu...@gmail.com wrote:

 I defined a scale animation from 0 to 1 for entering activity:

 overridePendingTransition(R.anim.scale, 0);

 In application tag in Manifest:

 android:theme=@android:style/Theme.NoTitleBar

 But I get a black topbar on the entering activity, while it scales...
 looks very ugly since the activity doesn't have this topbar. How do I hide
 it?

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




-- 
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] Arrow keys on custom keyboard

2012-08-14 Thread Dianne Hackborn
That sample code is interpreting these as Unicode characters which it
applies as edit operations on the text.  You will need to modify the code
to do the appropriate calls to move the cursor.

On Mon, Aug 13, 2012 at 5:59 AM, yakobom yako...@gmail.com wrote:

 Hi,
 I've been trying to add arrow keys to the SoftKeyboard example from the
 SDK, without success:
 Added this to the keyboard xml (qwerty.xml):
 Row android:rowEdgeFlags=bottom
 Key android:codes=21 android:keyLabel=lt;
 android:isRepeatable=true android:keyWidth=5%p
 android:keyEdgeFlags=left/
 Key android:codes=22 android:keyLabel=gt;
 android:isRepeatable=true android:keyWidth=5%p/
 Key android:codes=20 android:keyLabel=\\/
 android:isRepeatable=true android:keyWidth=5%p/
 Key android:codes=19 android:keyLabel=/\\
 android:isRepeatable=true android:keyWidth=5%p
 android:keyEdgeFlags=right/
 /Row

 I get the extra keys, but when I click them I get squares.
 Can anyone tell why?

 I googled for it but could not find any answer, this seem to be correct -
 but does not work.

 Thanks,
 yakobom

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] How to allow Landscape mode on Transparent / Translucent Activities?

2012-08-14 Thread Dianne Hackborn
Why are you making your activity translucent?  If this is to allow the
launcher to be seen through behind it, you shouldn't let the screen rotate
if the launcher doesn't want it to -- the launcher has locked the rotation
because it doesn't want to be rotated.

If you actually are drawing everything in your activity so the launcher
can't be seen, then why are you using the translucent theme?

On Tue, Aug 14, 2012 at 2:47 PM, I.E. inib...@gmail.com wrote:

 Suppose I have an Activity that uses the transparent theme:
 android:theme=@android:style/Theme.Translucent in the
 AndroidManifest.xml.

 When my Activity is launched from the Home Screen, most commercial
 phones will lock it to Portrait mode only. This is probably because
 the Home Screen only runs in Portrait mode, and applying the
 Translucent theme to my Activity makes it also lock to Portrait mode.

 But I would like to run my Activity in Landscape mode as well. Is this
 possible?

 For example, is there a way to dynamically remove the Translucent flag
 when a landscape orientation change is detected?

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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: Is Chrome in android simulator supported?

2012-08-14 Thread Dianne Hackborn
Okay I can't help you with that...  the emulator generally provides a full
Android ARM environment, which Android applications will run in.  Is Chrome
doing something to not run in that environment?  I don't know, that would
be a Chrome thing.

On Tue, Aug 14, 2012 at 10:19 AM, AaronL alabi...@google.com wrote:

 I apologize. I actually meant the emulator and not the simulator...Sorry
 for the personal email to you Dianne. Thanks


 On Wednesday, August 8, 2012 4:38:46 PM UTC-4, AaronL wrote:

 Is chrome in the android simulator supported? I've looked in other forums
 and no one seemed to have been successful in doing this.

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] Is Chrome in android simulator supported?

2012-08-12 Thread Dianne Hackborn
I am talking about the simulator, not the emulator. :)

On Sat, Aug 11, 2012 at 11:34 PM, Justin Anderson magouyaw...@gmail.comwrote:

 The simulator is pretty dead.  If something works in it, you are just
 lucky. :}  I very much doubt chrome will work in it.

 Just to clarify, are we talking about the emulator?

 Thanks,
 Justin Anderson
 MagouyaWare Developer
 http://sites.google.com/site/magouyaware



 On Sat, Aug 11, 2012 at 10:16 PM, Dianne Hackborn hack...@android.comwrote:

 The simulator is pretty dead.  If something works in it, you are just
 lucky. :}  I very much doubt chrome will work in it.


 On Wed, Aug 8, 2012 at 1:38 PM, Aaron Labiaga alabi...@google.comwrote:

 Is chrome in the android simulator supported? I've looked in other
 forums and no one seemed to have been successful in doing this.

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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




-- 
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] Non sticky service gets recreated (indefinetly?)

2012-08-11 Thread Dianne Hackborn
Sorry yes I meant if it *is* sticky.

On Fri, Aug 10, 2012 at 12:08 PM, Kostya Vasilyev kmans...@gmail.comwrote:


 2012/8/10 Dianne Hackborn hack...@android.com


 As long as the service is in the started state, the system will try to
 keep it created/started, and if the process is killed then it will be
 restarted if it is not sticky.


  Is that a typo?

 Was that supposed to be Restarted if it *is* sticky?

 -- K

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] Non sticky service gets recreated (indefinetly?)

2012-08-11 Thread Dianne Hackborn
Unless the service has something bound to it or it is started, it will not
be re-created.

You can look at the service state with adb shell dumpsys activity
services or adb shell dumpsys activity service package_name or
service_name.  If your service is listed there, it will show you what its
current state is -- what is bound to it, whether it is started, etc.

On Fri, Aug 10, 2012 at 2:26 PM, Johan Appelgren
johan.appelg...@gmail.comwrote:

 You're right that I'm not understanding something here, most likely it is
 something really obvious too. :(

 As I wrote, my understanding of what you describe is not the behavior I'm
 seeing with my test app on my Galaxy Nexus with Android 4.1.1 nor the 4.1.1
 emulator image. After I've unbound from the service, in my test I do this
 in the activity's onPause, when the app process is killed, it and the
 service is restarted. Then after that the process and service is killed and
 restarted every now and then, without starting the activity or any calls to
 startService or bindService made by any code in my test app. It starts
 quicker if I start a couple of different games to put some memory pressure
 on the system.

 Not even stopping the cached process in the Cached processes list stops
 it, it is restarted a little while after. Only going to the Downloaded list
 and pressing the Force stop button stops the stop/restart cycle.

 Perhaps someone could look at my dummy app code and point out what I'm
 doing wrong. If someone does, I'm sorry for most likely wasting your time.

 public class MainActivity extends Activity {

 @SuppressWarnings(unused)
 private int[] mDummyData = new int[3 * 1024 * 1024];
  private final String TAG = MainActivity;
  private boolean mBound;
  private boolean mCalledBind;
 private boolean mStarted;
 private final ServiceConnection mConnection = new ServiceConnection() {

 @Override
 public void onServiceConnected(ComponentName className, IBinder
 service) {
 Log.d(TAG, onServiceConnected);
 mBound = true;
 }

 @Override
 public void onServiceDisconnected(ComponentName arg0) {
 Log.d(TAG, onServiceDisconnected);
 }
 };

 public MainActivity(){
 Log.d(TAG, ctor);
 }

 @Override
 public void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);

 Intent intent = new Intent(this, MainService.class);

 Log.d(TAG, onCreate);

 if (!mStarted) {
 Log.d(TAG, startService);
 startService(intent);
 mStarted = true;
 }

 if (!mBound  !mCalledBind) {
 Log.d(TAG, bindService);
 bindService(intent, mConnection, BIND_AUTO_CREATE);
 mCalledBind = true;
 }
 }

 @Override
 protected void onPause() {
 Log.d(TAG, onPause);

 if (mBound) {
 Log.d(TAG, unbindService);
 unbindService(mConnection);
 mBound = false;
 mCalledBind = false;
 }

 super.onPause();
 }

 @Override
 protected void onDestroy() {
 Log.d(TAG, onDestroy);

 super.onDestroy();
 }
 }

 public class MainService extends Service {

 @SuppressWarnings(unused)
  private int[] mDummyData = new int[1024*1024];
  private static final String TAG = MainService;
  private final IBinder mBinder = new LocalBinder();
  public class LocalBinder extends Binder {
  MainService getService() {
 return MainService.this;
 }
 }
  @Override
 public IBinder onBind(Intent arg0) {
 Log.d(TAG, onBind);
  return mBinder;
 }

 @Override
 public int onStartCommand(Intent intent, int flags, int startId) {
  Log.d(TAG, onStartCommand);
 return START_NOT_STICKY;
 }
  @Override
 public void onCreate() {
 Log.d(TAG, onCreate);
  super.onCreate();
 }
 }

 On Friday, August 10, 2012 8:39:46 PM UTC+2, Dianne Hackborn wrote:

 On Fri, Aug 10, 2012 at 12:17 AM, Johan Appelgren 
 johan.a...@gmail.comwrote:

 Still occupies some amount of memory though, and the service's onCreate
 might not be cheap.


 I'm not sure what this means...?  If you are concerned about the service
 having too much overhead because you have bound to it and it doesn't need
 to run just while bound, don't use BIND_AUTO_CREATE.


 Anyways, I guess this is one of those little undocumented things you
 just have to learn. Do not rely on START_NOT_STICKY if you both start and
 bind to a service if you don't want the service to stay around forever as a
 cached process after you've unbound it.


 Honestly I think it is pretty fully documented.  But maybe we have a
 misunderstanding -- once you unbind from the service, the fact that you had
 previously bound to it has no further impact on how it is handled, and if
 its process is killed after that it will not be restarted.

 As long as you are bound to it with BIND_AUTO_CREATE, the system will try
 to keep

Re: [android-developers] Non sticky service gets recreated (indefinetly?)

2012-08-11 Thread Dianne Hackborn
Also, if the service is not showing up as a running service in manage apps,
then that should mean that it is not started, so it it is created that is
because something has bound to it.  You can see what is bound to it with
those shell commands.  If it is not started, the only reason it would be
recreated is because another process continue to be bound to it after its
process is killed.

On Sat, Aug 11, 2012 at 11:21 AM, Dianne Hackborn hack...@android.comwrote:

 Unless the service has something bound to it or it is started, it will not
 be re-created.

 You can look at the service state with adb shell dumpsys activity
 services or adb shell dumpsys activity service package_name or
 service_name.  If your service is listed there, it will show you what its
 current state is -- what is bound to it, whether it is started, etc.


 On Fri, Aug 10, 2012 at 2:26 PM, Johan Appelgren 
 johan.appelg...@gmail.com wrote:

 You're right that I'm not understanding something here, most likely it is
 something really obvious too. :(

 As I wrote, my understanding of what you describe is not the behavior I'm
 seeing with my test app on my Galaxy Nexus with Android 4.1.1 nor the 4.1.1
 emulator image. After I've unbound from the service, in my test I do this
 in the activity's onPause, when the app process is killed, it and the
 service is restarted. Then after that the process and service is killed and
 restarted every now and then, without starting the activity or any calls to
 startService or bindService made by any code in my test app. It starts
 quicker if I start a couple of different games to put some memory pressure
 on the system.

 Not even stopping the cached process in the Cached processes list stops
 it, it is restarted a little while after. Only going to the Downloaded list
 and pressing the Force stop button stops the stop/restart cycle.

 Perhaps someone could look at my dummy app code and point out what I'm
 doing wrong. If someone does, I'm sorry for most likely wasting your time.

 public class MainActivity extends Activity {

 @SuppressWarnings(unused)
 private int[] mDummyData = new int[3 * 1024 * 1024];
  private final String TAG = MainActivity;
  private boolean mBound;
  private boolean mCalledBind;
 private boolean mStarted;
  private final ServiceConnection mConnection = new
 ServiceConnection() {

 @Override
 public void onServiceConnected(ComponentName className, IBinder
 service) {
 Log.d(TAG, onServiceConnected);
 mBound = true;
 }

 @Override
 public void onServiceDisconnected(ComponentName arg0) {
 Log.d(TAG, onServiceDisconnected);
 }
 };

 public MainActivity(){
 Log.d(TAG, ctor);
 }

 @Override
 public void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);

 Intent intent = new Intent(this, MainService.class);

 Log.d(TAG, onCreate);

 if (!mStarted) {
 Log.d(TAG, startService);
  startService(intent);
 mStarted = true;
 }

 if (!mBound  !mCalledBind) {
 Log.d(TAG, bindService);
 bindService(intent, mConnection, BIND_AUTO_CREATE);
 mCalledBind = true;
 }
 }

 @Override
 protected void onPause() {
 Log.d(TAG, onPause);

 if (mBound) {
 Log.d(TAG, unbindService);
 unbindService(mConnection);
 mBound = false;
  mCalledBind = false;
 }

 super.onPause();
 }

 @Override
 protected void onDestroy() {
 Log.d(TAG, onDestroy);

 super.onDestroy();
 }
 }

 public class MainService extends Service {

 @SuppressWarnings(unused)
  private int[] mDummyData = new int[1024*1024];
  private static final String TAG = MainService;
  private final IBinder mBinder = new LocalBinder();
  public class LocalBinder extends Binder {
  MainService getService() {
 return MainService.this;
 }
 }
  @Override
 public IBinder onBind(Intent arg0) {
 Log.d(TAG, onBind);
  return mBinder;
 }

 @Override
 public int onStartCommand(Intent intent, int flags, int startId) {
  Log.d(TAG, onStartCommand);
 return START_NOT_STICKY;
 }
  @Override
 public void onCreate() {
 Log.d(TAG, onCreate);
  super.onCreate();
 }
 }

 On Friday, August 10, 2012 8:39:46 PM UTC+2, Dianne Hackborn wrote:

 On Fri, Aug 10, 2012 at 12:17 AM, Johan Appelgren 
 johan.a...@gmail.comwrote:

 Still occupies some amount of memory though, and the service's onCreate
 might not be cheap.


 I'm not sure what this means...?  If you are concerned about the service
 having too much overhead because you have bound to it and it doesn't need
 to run just while bound, don't use BIND_AUTO_CREATE.


 Anyways, I guess this is one of those little undocumented things you
 just have to learn. Do not rely on START_NOT_STICKY if you both start and
 bind

Re: [android-developers] Canvas or OpenGL

2012-08-11 Thread Dianne Hackborn
On Sat, Aug 11, 2012 at 2:50 PM, James Black planiturth...@gmail.comwrote:

 Do you need a fast refresh rate for example?  One music program I wrote
 had to turn notes on and off at the correct millisecond, under windows;
 that accuracy won't work on mobile devices.

You can do 60fps drawing with either OpenGL or Canvas.  That is the best
you are going to get for accuracy since that is the screen refresh rate.

-- 
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] Hardware keyboard events are not intercepted by InputMethodService

2012-08-11 Thread Dianne Hackborn
Is this only in Firefox, or also in the built-in browser app?  The app
always does get first crack at input events, so it is possible for a broken
application to do this kind of thing.  (This facility is intended for
things like capturing back to dismiss a pop-up instead of closing the IME.)

On Wed, Aug 8, 2012 at 3:07 PM, AK aleksandr.v.konstanti...@gmail.comwrote:

 Hello all,

 I'm trying to develop keyboard service which performs customized keys
 mapping for hardware keyboard.
 My working target is Asus Transformer TF101 with ICS 4.0.3 and hardware
 keyboard aka dock.
 I have implement onKeyDown and onKeyUp methods of InputMethodService which
 catch all keyboard
 events and it all works perfectly in ordinary text fields.
 But when text is being entered into web browser's text field handled by
 javascript (like google search field
 in Firefox for example) most keyboard events are not going through
 onKeyDown anymore. Actually it looks
 like only BACK and META are catched by InputMethodService.
 And it is not only my service which looses ability to map keys. Asus
 Keyboard service supplied as part of
 firmware also stops functioning effectively allowing to enter text in
 ASCII only. Which by the way is
 extremely annoying.

 Any ideas on what I am doing wrong? Or is it some bug in ICS?


 Regards,

 A.K.

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] Is Chrome in android simulator supported?

2012-08-11 Thread Dianne Hackborn
The simulator is pretty dead.  If something works in it, you are just
lucky. :}  I very much doubt chrome will work in it.

On Wed, Aug 8, 2012 at 1:38 PM, Aaron Labiaga alabi...@google.com wrote:

 Is chrome in the android simulator supported? I've looked in other forums
 and no one seemed to have been successful in doing this.

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] Can a folder be created using instrumentation context instead of target context?

2012-08-10 Thread Dianne Hackborn
Not generally, when the instrumentation is running in the target process,
it is running under that uid.  You could do something like put a service or
content provider (or receiver) in your instrumentation apk that you can
interact with from the instrumentation code running in the app being tested.

On Thu, Aug 9, 2012 at 11:15 AM, dnkoutso dnkou...@gmail.com wrote:

 I am writing instrumentation tests for my app and want to create a
 temporary folder to store some files. However, I dont want to do that in
 the targetContext but rather in the test context.

 In other words:
 File dir = getInstrumentation().*getTargetContext()*.getDir(directory,
 MODE_WORLD_READABLE);  // Works, but this creates the folder in the target
 app.

 File dir = getInstrumentation().*getContext()*.getDir(directory,
 MODE_WORLD_READABLE);  // Does not work, the exists() returns false.

 Thoughts?

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] How can I check the value of wtf_is_fatal?

2012-08-10 Thread Dianne Hackborn
Why do you want to do this?  If you want to log an error that doesn't cause
your app to crash, use Log.w().  I generally recommend if you have a fatal
error, using Log.e() (though it is your responsibility to crash or whatever
the fatal error behavior is after that).

If you don't want the behavior of Log.wtf() (which is partly that it can
optional crash your app based on the setting), then don't use it.  The only
reason to use it that I can think of is because you want the behavior it
provides.  Is there some other reason you want to call that specific method?

On Fri, Aug 10, 2012 at 11:13 AM, Shri shri.bo...@gmail.com wrote:

 I want to check if Log.wtf will result in program termination. I want to
 use that property to enable expensive asserts in my program. How can I
 check for this? I used the following code but it throws
 SettingNotFoundException.

   int wtfIsFatal =
 android.provider.Settings.Secure.getInt(getContentResolver(),
 wtf_is_fatal);

 I tried adding android.permission.WRITE_SECURE_SETTINGS to my
 AndroidManifest.xml but that does not help. I had set wtf_is_fatal as such:

 adb root
 adb shell
 sqlite3 /data/data/com.android.providers.settings/databases/settings.db
  insert into secure (name, value) values ('wtf_is_fatal', 1);
  select * from secure;
 ...
 60|wtf_is_fatal|1
 ...

 Thanks,
 Shri

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] MAX Repeat count of windowEnterAnimation

2012-08-10 Thread Dianne Hackborn
No the window will only execute an animation when it goes through the
corresponding transition -- enter animations exit when the window is shown,
exit when it is hidden, etc.

On Fri, Aug 10, 2012 at 4:17 AM, danaimset danaim...@gmail.com wrote:

 Thanks a lot, Dianne!

 I believe it can be done by using the following method if you need to
 provide some animation to PopupWindow:
 http://developer.android.com/intl/ru/reference/android/widget/PopupWindow.html#update(android.view.View,
 int, int, int, int)

 But in that case a programmer should implement its own animation cycle.


 пятница, 10 августа 2012 г., 6:11:46 UTC+3 пользователь Dianne Hackborn
 написал:

 The window manager limits the duration of animations, I believe to 10
 seconds or so.

 Don't do this.  It is not right to have a window animation that runs
 indefinitely.

 On Thu, Aug 9, 2012 at 3:03 PM, danaimset dana...@gmail.com wrote:

  Hi Guys!

 I've face with problems with windowEnterAnimation.
 I'm trying to animate popup window over the view for infinite. But it
 seems that windowEnterAnimation has limitation of repeat count.


 https://lh4.googleusercontent.com/-6Dx_kkoUFkg/UCQzPlhdp1I/ECI/LuyFiRy9R2M/s1600/launcher.png


 I'm using the following animation:

 ?xml version=1.0 encoding=utf-8?
 set 
 xmlns:android=http://schemas.**android.com/apk/res/androidhttp://schemas.android.com/apk/res/android
 

 translate
 android:duration=500
 android:fromYDelta=0
 android:interpolator=@**android:anim/bounce_**interpolator
 android:repeatCount=infinite
 android:repeatMode=reverse
 android:toYDelta=-20 /

 /set

 And the following animation style for the popup window:

 style name=AnimationPopup
 item name=@android:**windowEnterAnimation@anim/**
 jump_up/item
 item name=@android:**windowExitAnimation@anim/**alpha/item
 /style

 The animation is repeated only 10 times but not infinitely :(

 Maybe somebody could give some advice how this problem could be solved ?

 Thanks.

 Best Wishes,
 Dan.


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




 --
 Dianne Hackborn
 Android framework engineer
 hac...@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




-- 
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] Non sticky service gets recreated (indefinetly?)

2012-08-10 Thread Dianne Hackborn
On Fri, Aug 10, 2012 at 12:17 AM, Johan Appelgren johan.appelg...@gmail.com
 wrote:

 Still occupies some amount of memory though, and the service's onCreate
 might not be cheap.


I'm not sure what this means...?  If you are concerned about the service
having too much overhead because you have bound to it and it doesn't need
to run just while bound, don't use BIND_AUTO_CREATE.


 Anyways, I guess this is one of those little undocumented things you just
 have to learn. Do not rely on START_NOT_STICKY if you both start and bind
 to a service if you don't want the service to stay around forever as a
 cached process after you've unbound it.


Honestly I think it is pretty fully documented.  But maybe we have a
misunderstanding -- once you unbind from the service, the fact that you had
previously bound to it has no further impact on how it is handled, and if
its process is killed after that it will not be restarted.

As long as you are bound to it with BIND_AUTO_CREATE, the system will try
to keep it created and if the process is killed while you remain bound to
it then it will try to restart it.

As long as the service is in the started state, the system will try to keep
it created/started, and if the process is killed then it will be restarted
if it is not sticky.

The decision about whether to restart the service is if either of those
conditions result in it wanting to restart it.

Again starting and binding are orthogonal to each other.  You just have to
know how each works individually, and what happens in the service is based
on whether either of them drive it to need to be created.  As I think is
covered pretty fully in the documentation.

-- 
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] Non sticky service gets recreated (indefinetly?)

2012-08-09 Thread Dianne Hackborn
Binding and starting are completely orthogonal things.  You bind to a
service to establish a persistent connection to it.  You start a service to
have it run for some undefined amount of time separately from the caller.
 A service needs to remain created as long as it is being asked to do
either of these things.

If you don't want it to stay created, either don't bind to it when you
don't want it around, or don't use BIND_AUTO_CREATE so you aren't forcing
it to remain created while bound to it.

On Wed, Aug 8, 2012 at 10:46 PM, Johan Appelgren
johan.appelg...@gmail.comwrote:

 So START_NOT_STICKY has no effect once I've bound to it even if I unbind?
 I must explicitly use stopService if the service has ever been bound to
 even if there are no more connection?


 On Thursday, August 9, 2012 2:54:41 AM UTC+2, Dianne Hackborn wrote:

 If you bind to it with BIND_AUTO_CREATE, you are saying you want the
 service to be created as long as you are bound to it.

 From the documentation:

 A service can be both started and have connections bound to it. In such a
 case, the system will keep the service running as long as either it is
 started or there are one or more connections to it with the
 Context.BIND_AUTO_CREATE flag.

 http://developer.android.com/**reference/android/app/Service.**htmlhttp://developer.android.com/reference/android/app/Service.html

 On Wed, Aug 8, 2012 at 1:52 PM, Johan Appelgren johan.a...@gmail.comwrote:

 If I have a simple service that returns START_NOT_STICKY in
 onStartCommand and I both start it explicitly (startService) and bind to it
 (bindService) in onCreate of my activity the service gets recreated after
 it has been killed over and over again. I unbind the service in onPause of
 my activity.

 Logcat shows that the service is scheduled for restart and is restarted
 over and over again. The service is not shown as running after it's been
 recreated in Settings - Apps - Running.

 08-08 21:57:25.081 D/ExampleActivity(23715): onPause
 08-08 22:11:44.480 W/ActivityManager(  306): Scheduling restart of
 crashed service com.example.service/.**MainService in 5000 ms
  08-08 22:11:49.519 I/ActivityManager(  306): Start proc
 com.example.strangeservice for service com.example.service/.**
 MainService
 08-08 22:11:49.597 D/ExampleService(24079): onCreate
 08-08 22:27:38.551 I/ActivityManager(  306): No longer want
 com.example.service (pid 24079): hidden #16
 08-08 22:27:38.574 W/ActivityManager(  306): Scheduling restart of
 crashed service com.example.service/.**MainService in 5000ms
 08-08 22:27:43.629 I/ActivityManager(  306): Start proc
 com.example.strangeservice for service com.example.service/.**MainService:
 pid=24401 uid=10101 gids={1028}
 08-08 22:27:43.785 D/ExampleService(24401): onCreate
 08-08 22:49:59.871 I/ActivityManager(  306): Process com.example.service
 (pid 24401) has died.
 08-08 22:49:59.871 W/ActivityManager(  306): Scheduling restart of
 crashed service com.example.service/.**MainService in 5000ms
 08-08 22:50:04.934 I/ActivityManager(  306): Start proc
 com.example.strangeservice for service com.example.service/.**MainService:
 pid=24857 uid=10101 gids={1028}
 08-08 22:50:05.051 D/ExampleService(24857): onCreate

 I thought START_NOT_STICKY meant that once it gets killed by Android it
 wont be restarted unless I explicitly start it again. Or does binding to a
 service override that and make the service sticky?

 I've been testing this on a Galaxy Nexus with stock Android 4.1.1.

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




 --
 Dianne Hackborn
 Android framework engineer
 hac...@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




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

Re: [android-developers] Non sticky service gets recreated (indefinetly?)

2012-08-09 Thread Dianne Hackborn
Binding to a service can only make that service's process as important as
the process of the client binding to it.  If the client process is in the
background, it can't bring the service up beyond the background, so it
doesn't count as a running process but a cached process.

On Thu, Aug 9, 2012 at 3:09 AM, Johan Appelgren
johan.appelg...@gmail.comwrote:

 Ok, thanks. But shouldn't it (non-sticky service with no active
 connections, nothing is bound to it) show up in the Running Services view
 when it has been restarted? Or is that only for sticky services?


 On Thursday, August 9, 2012 8:35:50 AM UTC+2, Dianne Hackborn wrote:

 Binding and starting are completely orthogonal things.  You bind to a
 service to establish a persistent connection to it.  You start a service to
 have it run for some undefined amount of time separately from the caller.
  A service needs to remain created as long as it is being asked to do
 either of these things.

 If you don't want it to stay created, either don't bind to it when you
 don't want it around, or don't use BIND_AUTO_CREATE so you aren't forcing
 it to remain created while bound to it.

 On Wed, Aug 8, 2012 at 10:46 PM, Johan Appelgren johan.a...@gmail.comwrote:

 So START_NOT_STICKY has no effect once I've bound to it even if I
 unbind? I must explicitly use stopService if the service has ever been
 bound to even if there are no more connection?


 On Thursday, August 9, 2012 2:54:41 AM UTC+2, Dianne Hackborn wrote:

 If you bind to it with BIND_AUTO_CREATE, you are saying you want the
 service to be created as long as you are bound to it.

 From the documentation:

 A service can be both started and have connections bound to it. In such
 a case, the system will keep the service running as long as either it is
 started or there are one or more connections to it with the
 Context.BIND_AUTO_CREATE flag.

 http://developer.android.com/**r**eference/android/app/Service.**h**tmlhttp://developer.android.com/reference/android/app/Service.html

 On Wed, Aug 8, 2012 at 1:52 PM, Johan Appelgren 
 johan.a...@gmail.comwrote:

 If I have a simple service that returns START_NOT_STICKY in
 onStartCommand and I both start it explicitly (startService) and bind to 
 it
 (bindService) in onCreate of my activity the service gets recreated after
 it has been killed over and over again. I unbind the service in onPause of
 my activity.

 Logcat shows that the service is scheduled for restart and is
 restarted over and over again. The service is not shown as running after
 it's been recreated in Settings - Apps - Running.

 08-08 21:57:25.081 D/ExampleActivity(23715): onPause
 08-08 22:11:44.480 W/ActivityManager(  306): Scheduling restart of
 crashed service com.example.service/.**MainServi**ce in 5000 ms
  08-08 22:11:49.519 I/ActivityManager(  306): Start proc
 com.example.strangeservice for service com.example.service/.**
 MainServi**ce
 08-08 22:11:49.597 D/ExampleService(24079): onCreate
  08-08 22:27:38.551 I/ActivityManager(  306): No longer want
 com.example.service (pid 24079): hidden #16
 08-08 22:27:38.574 W/ActivityManager(  306): Scheduling restart of
 crashed service com.example.service/.**MainServi**ce in 5000ms
 08-08 22:27:43.629 I/ActivityManager(  306): Start proc
 com.example.strangeservice for service com.example.service/.**
 MainServi**ce: pid=24401 uid=10101 gids={1028}
 08-08 22:27:43.785 D/ExampleService(24401): onCreate
 08-08 22:49:59.871 I/ActivityManager(  306): Process
 com.example.service (pid 24401) has died.
 08-08 22:49:59.871 W/ActivityManager(  306): Scheduling restart of
 crashed service com.example.service/.**MainServi**ce in 5000ms
 08-08 22:50:04.934 I/ActivityManager(  306): Start proc
 com.example.strangeservice for service com.example.service/.**
 MainServi**ce: pid=24857 uid=10101 gids={1028}
 08-08 22:50:05.051 D/ExampleService(24857): onCreate

 I thought START_NOT_STICKY meant that once it gets killed by Android
 it wont be restarted unless I explicitly start it again. Or does binding 
 to
 a service override that and make the service sticky?

 I've been testing this on a Galaxy Nexus with stock Android 4.1.1.

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




 --
 Dianne Hackborn
 Android framework engineer
 hac...@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

Re: [android-developers] MAX Repeat count of windowEnterAnimation

2012-08-09 Thread Dianne Hackborn
The window manager limits the duration of animations, I believe to 10
seconds or so.

Don't do this.  It is not right to have a window animation that runs
indefinitely.

On Thu, Aug 9, 2012 at 3:03 PM, danaimset danaim...@gmail.com wrote:

 Hi Guys!

 I've face with problems with windowEnterAnimation.
 I'm trying to animate popup window over the view for infinite. But it
 seems that windowEnterAnimation has limitation of repeat count.


 https://lh4.googleusercontent.com/-6Dx_kkoUFkg/UCQzPlhdp1I/ECI/LuyFiRy9R2M/s1600/launcher.png


 I'm using the following animation:

 ?xml version=1.0 encoding=utf-8?
 set xmlns:android=http://schemas.android.com/apk/res/android; 

 translate
 android:duration=500
 android:fromYDelta=0
 android:interpolator=@android:anim/bounce_interpolator
 android:repeatCount=infinite
 android:repeatMode=reverse
 android:toYDelta=-20 /

 /set

 And the following animation style for the popup window:

 style name=AnimationPopup
 item name=@android:windowEnterAnimation@anim/jump_up/item
 item name=@android:windowExitAnimation@anim/alpha/item
 /style

 The animation is repeated only 10 times but not infinitely :(

 Maybe somebody could give some advice how this problem could be solved ?

 Thanks.

 Best Wishes,
 Dan.


  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] Non sticky service gets recreated (indefinetly?)

2012-08-08 Thread Dianne Hackborn
If you bind to it with BIND_AUTO_CREATE, you are saying you want the
service to be created as long as you are bound to it.

From the documentation:

A service can be both started and have connections bound to it. In such a
case, the system will keep the service running as long as either it is
started or there are one or more connections to it with the
Context.BIND_AUTO_CREATE flag.

http://developer.android.com/reference/android/app/Service.html

On Wed, Aug 8, 2012 at 1:52 PM, Johan Appelgren
johan.appelg...@gmail.comwrote:

 If I have a simple service that returns START_NOT_STICKY in onStartCommand
 and I both start it explicitly (startService) and bind to it (bindService)
 in onCreate of my activity the service gets recreated after it has been
 killed over and over again. I unbind the service in onPause of my activity.

 Logcat shows that the service is scheduled for restart and is restarted
 over and over again. The service is not shown as running after it's been
 recreated in Settings - Apps - Running.

 08-08 21:57:25.081 D/ExampleActivity(23715): onPause
 08-08 22:11:44.480 W/ActivityManager(  306): Scheduling restart of crashed
 service com.example.service/.MainService in 5000 ms
 08-08 22:11:49.519 I/ActivityManager(  306): Start proc
 com.example.strangeservice for service com.example.service/.MainService
 08-08 22:11:49.597 D/ExampleService(24079): onCreate
 08-08 22:27:38.551 I/ActivityManager(  306): No longer want
 com.example.service (pid 24079): hidden #16
 08-08 22:27:38.574 W/ActivityManager(  306): Scheduling restart of crashed
 service com.example.service/.MainService in 5000ms
 08-08 22:27:43.629 I/ActivityManager(  306): Start proc
 com.example.strangeservice for service com.example.service/.MainService:
 pid=24401 uid=10101 gids={1028}
 08-08 22:27:43.785 D/ExampleService(24401): onCreate
 08-08 22:49:59.871 I/ActivityManager(  306): Process com.example.service
 (pid 24401) has died.
 08-08 22:49:59.871 W/ActivityManager(  306): Scheduling restart of crashed
 service com.example.service/.MainService in 5000ms
 08-08 22:50:04.934 I/ActivityManager(  306): Start proc
 com.example.strangeservice for service com.example.service/.MainService:
 pid=24857 uid=10101 gids={1028}
 08-08 22:50:05.051 D/ExampleService(24857): onCreate

 I thought START_NOT_STICKY meant that once it gets killed by Android it
 wont be restarted unless I explicitly start it again. Or does binding to a
 service override that and make the service sticky?

 I've been testing this on a Galaxy Nexus with stock Android 4.1.1.

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] How to get instance of PowerManagerService?

2012-08-06 Thread Dianne Hackborn
PowerManager is the public API.  Context.getSystemService() returns public
APIs.

PowerManagerService is private implementation.  More than that, it is
private implementation that does not run in your process, so you can not
directly access in any way.

On Mon, Aug 6, 2012 at 12:20 PM, macias pilichowski.mac...@gmail.comwrote:

 Bad news, but thank you. I wonder how it is possible, that (according to
 Android sources) what is added to services is PowerManagerService, but what
 is get is PowerManager (not service) -- when using legal methods such as
 getSystemService.

 Anyway, quite easy task -- for learning Android -- as building custom
 screensaver turned out to be paramount problem :-(

 Cheers,

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




-- 
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] Need help on sending events (Motion event, Key event and etc) from a service to system (android 4.0)

2012-08-06 Thread Dianne Hackborn
Currently the only way, outside of test environments, to deliver input
events to the platform is throw a kernel input device.  So your USB device
must report itself as a HID device (a keyboard, trackpad, mouse, or game
controller) which the kernel understands how to interact with and will
generate the appropriate low-level events from the input device.

On Mon, Aug 6, 2012 at 6:18 AM, Prabudas prabu...@gmail.com wrote:

 Hi,

 I am working on an external HID device for android 4.0 devices. The device
 will have a touchpad and hardware buttons to replicate the touch screen and
 android buttons(Home, back and menu). To make this device work with any
 android 4.0 device, I do not want to modify the build or root the device.
 All I can do is, I can write an app (service) which can interact with this
 device through USB (using accessory mode v 1.0). So, from that app, I want
 to create the necessary events based on the message from USB. This can be
 very easy in android 4.1 with accessory mode 2.0. But, I need this for 4.0.
 Please help me on this. Thanks in advance.

 …Prabudas

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] how can I design a floating keyboard?

2012-08-04 Thread Dianne Hackborn
You can use this to indicate how the application should be positioned
behind your IME:
http://developer.android.com/reference/android/inputmethodservice/InputMethodService.html#onComputeInsets(android.inputmethodservice.InputMethodService.Insets)


On Sat, Aug 4, 2012 at 12:35 AM, yakobom yako...@gmail.com wrote:

 Hi Dianne,
 If you design it to be floating so that it doesn't impact app content,
 you can easily put it anywhere - can you please explain how can I do that?
 And, is it possible to design it so this mode will be dynamically
 switchable? (Meaning, the user will be able to switch between the floating
 and the pushing modes)

 Thanks,
 yakobom


 On Wednesday, August 1, 2012 7:14:50 PM UTC+3, Dianne Hackborn wrote:

 In the current platform your IME UI can only push app content up from the
 bottom of the screen.  If you design it to be floating so that it doesn't
 impact app content, you can easily put it anywhere (if nothing else make
 the window fill the entire screen and leave all the parts transparent
 except where you want to draw your UI), but if you want apps to adjust
 their UI to accommodate the only option is to have their content shift up
 from the bottom.

 On Wed, Oct 13, 2010 at 2:02 PM, Saied saie...@gmail.com wrote:

 Hello,

 I am a developer and recently completed the implementation of my
 keyboard MessagEase. It's available on the Market (with its very-
 different features, making it quite unlike QWERTY).

 This keyboard works fine as a replacement of the standard keyboard on
 an Android Phone. But for a An Android Tablet, it would work best if
 it's implemented as a floating, movable keyboard.

 (the footprint of this keyboard is mostly dependable on the size of a
 human's finger; it remains the same even if the tablet's display is
 much larger than a phone's. Therefore it'll take a relatively smaller
 area on a tablet.)

 If I use the current SDK hooks, it will have to take a significant
 portion of the screen, defeating the purpose.

 Can someone point me to the right direction in creating a floating
 keyboard? or is it possible?

 Thanks.

 Saied Nesbat,
 Exideas (creator of MessagEase)

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@**
 googlegroups.com android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+**unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/android-developers?hl=enhttp://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




-- 
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: Android 2.2 or 4.1??

2012-08-02 Thread Dianne Hackborn
You generally don't need to use reflection for this.  That's a really
awkward way to do it...  just check the platform version number and only
call the API if it is = the version where that API was introduced.

On Thu, Aug 2, 2012 at 7:45 AM, Jeremy Villalobos 
jeremyvillalo...@gmail.com wrote:

 Yes

 Do note that some API calls will throw Exceptions on Froyo.  To avoid
 this, use Reflections

 For example: my app supports from Froyo upward, but Froyo does not support
 icons on the Preference Activity.  So I use this to set the icon for ICS,
 and skip the step on Froyo

  void workAroundSetPicture(Preference pref, int resource){
 try {
 Method m = pref.getClass().getMethod(setIcon, int.class);
  m.invoke( pref,  resource );
 } catch (SecurityException e) {
 e.printStackTrace();
  } catch (NoSuchMethodException e) {
 e.printStackTrace();
 } catch (IllegalArgumentException e) {
  e.printStackTrace();
 } catch (IllegalAccessException e) {
 e.printStackTrace();
  } catch (InvocationTargetException e) {
 e.printStackTrace();
 }
 }

 The top right corner on the Android Developer documentation mentions for
 which Version the methods were introduced.

 On Wednesday, August 1, 2012 10:27:06 AM UTC-4, Eric oboite wrote:

 When creating my new app should I build against 2.2 or 4.1? I know 2.2
 has 83% of the market right now but can I build against 4.1 and make the
 min sdk android 2.0?

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] Is there any way to know a view's height and width before it is really shown on screen?

2012-08-02 Thread Dianne Hackborn
The very first time anyone knows its size is when onSizeChanged() is called.

On Thu, Aug 2, 2012 at 7:21 AM, Fang fangchang1...@gmail.com wrote:

 Hi Android Developers,

 As a request of a function in my app, I need to know a view's height and
 width before it's really shown on screen.
 Here I want to know whether it is possible? If yes, then how about the
 performance? Thanks in advance.

 Regards,
 Fang

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] how can I design a floating keyboard?

2012-08-01 Thread Dianne Hackborn
In the current platform your IME UI can only push app content up from the
bottom of the screen.  If you design it to be floating so that it doesn't
impact app content, you can easily put it anywhere (if nothing else make
the window fill the entire screen and leave all the parts transparent
except where you want to draw your UI), but if you want apps to adjust
their UI to accommodate the only option is to have their content shift up
from the bottom.

On Wed, Oct 13, 2010 at 2:02 PM, Saied saie...@gmail.com wrote:

 Hello,

 I am a developer and recently completed the implementation of my
 keyboard MessagEase. It's available on the Market (with its very-
 different features, making it quite unlike QWERTY).

 This keyboard works fine as a replacement of the standard keyboard on
 an Android Phone. But for a An Android Tablet, it would work best if
 it's implemented as a floating, movable keyboard.

 (the footprint of this keyboard is mostly dependable on the size of a
 human's finger; it remains the same even if the tablet's display is
 much larger than a phone's. Therefore it'll take a relatively smaller
 area on a tablet.)

 If I use the current SDK hooks, it will have to take a significant
 portion of the screen, defeating the purpose.

 Can someone point me to the right direction in creating a floating
 keyboard? or is it possible?

 Thanks.

 Saied Nesbat,
 Exideas (creator of MessagEase)

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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: How to set theme using resources from another application?

2012-08-01 Thread Dianne Hackborn
You can't really do this by simply pointing to a theme.  The resources
object is used across the view hierarchy to load resources; to set the
theme from another apk you will need to have the resources coming from
there, but then you won't be able to access any of your own resources that
you need (like strings etc).

On Wed, Aug 1, 2012 at 2:38 PM, Mor G. gaz...@gmail.com wrote:

 Hi Richard, thanks for the reply.

 I have an app with light and dark themes defined in themes.xml.
 I have a setting to allow the user the select light/dark theme in the app.
 This works great.

 Now the themes are pretty heavy in graphics, since they define not only
 styling but different drawables as well, so I want to offer more themes
 like blue, green, red, etc. as external apks in Google play, like I've seen
 many other apps have done, so a user could install a MyApp blue theme
 apk, and then he'll be able to choose this theme from the main app settings.

 I've tried using: Resources res = pm.getResourcesForApplication(appInfo);
 Which gets the resources object of the external apk, but I can't seem to
 get and apply the theme from it using activity.setTheme(externalTheme).

 I've tried using: Context themedContext =
 activity.getApplicationContext().createPackageContext(com.myapp.blue,
 Context.CONTEXT_IGNORE_SECURITY);
 Which gets a themed context, but again, couldn't set this theme to my
 running activity.

 I've read a lot about this, but couldn't find any complete solution.

 Thanks,
 Mor.


 On Thursday, August 2, 2012 12:17:40 AM UTC+3, RichardC wrote:

 If it's your own application then read about library projects.
 Otherwise unless the app you are reading resources from is available
 under a suitable open source licence then in my opinion what you are trying
 to do could be infringing copyright.
 If the app is open source then just download it and use the resources.

 On Thursday, April 5, 2012 6:51:58 PM UTC+1, Terry wrote:

 I'm able to use getResourcesForApplication and getIdentifier to get the
 individual resources from another application. However, when I try to call
 setTheme using a remote theme.xml from another app, the references inside
 theme.xml point to the app that I'm running, not pointing to the remote
 application where the theme.xml is. As a result, I get a
 ResourceNotFoundException inside theme.xml where I try to use the styles I
 defined from the remote app. In other words, I can apply theme.xml but not
 reference to the styles inside it.

 Moderator, please don't block this post. I googled for days and have not
 found a resolution to it.

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




-- 
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] Trying to change the screen brightness programmatically

2012-08-01 Thread Dianne Hackborn
Did you read my reply to your original, exactly the same as far as I can
tell, code?

On Wed, Aug 1, 2012 at 5:01 PM, Cythes cytheshic...@gmail.com wrote:

 Well after taking a few days off its time to hit the bricks again. So here
 I am asking for help as to why my program is not setting the brightness
 requested... Here is the code I have so far.

 import android.app.Activity;
 import android.content.Intent;
 import android.os.Bundle;
 import android.provider.Settings;
 import android.provider.Settings.SettingNotFoundException;
 import android.view.WindowManager;

 public class bright extends Activity {

 @Override
 protected void onCreate(Bundle savedInstanceState) {
  // TODO Auto-generated method stub
 super.onCreate(savedInstanceState);
 int brightnessMode = 0;
  try {
 brightnessMode = Settings.System.getInt(getContentResolver(),
 Settings.System.SCREEN_BRIGHTNESS_MODE);
  } catch (SettingNotFoundException e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
  }
 if (brightnessMode == Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) {
 Settings.System.putInt(getContentResolver(),
 Settings.System.SCREEN_BRIGHTNESS_MODE,
 Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
  }

 WindowManager.LayoutParams layoutParams = getWindow().getAttributes();
 layoutParams.screenBrightness = 0.5F; // set 50% brightness
  getWindow().setAttributes(layoutParams);
 Intent i = new Intent(this, StartSpark.class);
 i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
 startActivity(i);
 finish();
 }
 }

 I heard some place that when you do things like this you need to send out
 a new window in order for it to refresh and take on the new brightness
 properties. So that is why I have the intent set up at the bottom.

 I have been messing with this on my own for a while now but everything I
 am trying is coming up dead... And not in the way I want it to be..

 So what am I doing wrong?

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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: How to set theme using resources from another application?

2012-08-01 Thread Dianne Hackborn
That doesn't solve the problem, which is that you are trying to create a
mix of resources from two .apks and you can't currently do that.

I would assume these other apps are just directly loading the bitmaps from
the other .apk where they need them.

On Wed, Aug 1, 2012 at 3:11 PM, Mor G. gaz...@gmail.com wrote:

 Hi Dianne, thanks for the info.

 I've seen methods like Resources.Theme.applyStyle which capable of
 overriding existing attributes with a supplied style resource-id, which
 would have been useful if I could tell it from what resource to get the
 resource-id from.
 Isn't there a similar method that I can use to only override certain
 attributes in my existing applied theme?

 If not, could you maybe suggest a different way to approach this problem?
 There are lots of themed apps on Android, so I'm sure there's a way to do
 this.

 Thanks again,
 Mor.


 On Thursday, August 2, 2012 12:51:30 AM UTC+3, Dianne Hackborn wrote:

 You can't really do this by simply pointing to a theme.  The resources
 object is used across the view hierarchy to load resources; to set the
 theme from another apk you will need to have the resources coming from
 there, but then you won't be able to access any of your own resources that
 you need (like strings etc).

 On Wed, Aug 1, 2012 at 2:38 PM, Mor G.

 Hi Richard, thanks for the reply.

 I have an app with light and dark themes defined in themes.xml.
 I have a setting to allow the user the select light/dark theme in the
 app.
 This works great.

 Now the themes are pretty heavy in graphics, since they define not only
 styling but different drawables as well, so I want to offer more themes
 like blue, green, red, etc. as external apks in Google play, like I've seen
 many other apps have done, so a user could install a MyApp blue theme
 apk, and then he'll be able to choose this theme from the main app settings.

 I've tried using: Resources res = pm.getResourcesForApplication(**
 appInfo);
 Which gets the resources object of the external apk, but I can't seem to
 get and apply the theme from it using activity.setTheme(**
 externalTheme).

 I've tried using: Context themedContext = activity.**
 getApplicationContext().**createPackageContext(com.**myapp.blue,
 Context.CONTEXT_IGNORE_**SECURITY);
 Which gets a themed context, but again, couldn't set this theme to my
 running activity.

 I've read a lot about this, but couldn't find any complete solution.

 Thanks,
 Mor.


 On Thursday, August 2, 2012 12:17:40 AM UTC+3, RichardC wrote:

 If it's your own application then read about library projects.
 Otherwise unless the app you are reading resources from is available
 under a suitable open source licence then in my opinion what you are trying
 to do could be infringing copyright.
 If the app is open source then just download it and use the resources.

 On Thursday, April 5, 2012 6:51:58 PM UTC+1, Terry wrote:

 I'm able to use getResourcesForApplication and getIdentifier to get
 the individual resources from another application. However, when I try to
 call setTheme using a remote theme.xml from another app, the references
 inside theme.xml point to the app that I'm running, not pointing to the
 remote application where the theme.xml is. As a result, I get a
 ResourceNotFoundException inside theme.xml where I try to use the styles I
 defined from the remote app. In other words, I can apply theme.xml but not
 reference to the styles inside it.

 Moderator, please don't block this post. I googled for days and have
 not found a resolution to it.

  --

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




-- 
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: Set bounds for one layer of LayerDrawable?

2012-07-31 Thread Dianne Hackborn
On Mon, Jul 30, 2012 at 11:34 PM, skink psk...@gmail.com wrote:

 as far i know this is not true: you can change the bounds of one layer
 without affecting the other layers. try to:
 d.setBounds(left, top, right, bottom);
 d.invalidateSelf();
 in some callback method e.g. onClick(View v) and you will see it works as
 expected


If you are suggesting to do this on one of the child drawables that you
have placed in the LayerDrawable, then you are relying on the framework
never calling setBounds() again on that Drawable itself.  This is a very
dangerous thing to rely on.  This is very very far into the realm of
relying on implementation details that there will be no guarantee remain
that way.

When you put a drawable into a parent drawable, the parent owns the state
management of the child drawable.  Don't try to play games whacking on its
state yourself in the hope you can get lucky and not conflict with it.
 (And this is a good rule to assume for any situation where you are placing
a child object into a parent container.)

-- 
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] Scanning root of SDcard does not work on 4.1

2012-07-31 Thread Dianne Hackborn
If you are running on a non-user build, as of JB you need to require the
new read external storage permission.  On a user build, you may have
enabled this restriction in developer settings.

On Wed, Jul 25, 2012 at 9:43 AM, Alessandro Pellizzari a...@amiran.itwrote:

 Hi all,

 I am having problems scanning my files on the root of the sdcard, but (it
 appears) only on 4.1.

 This is my code:

 public static void scanAll(NotifyScan target)
 {
  String source =
   Environment.getExternalStorageDirectory().getAbsolutePath()
  ;

  Log.d(SCANDIR, source);

  scanDir(new File(source));
 }

 private void scanDir(File path)
 {
   for ( File f:path.listFiles() ) {
 Log.d(SCAN, f.getAbsolutePath());
   }
 }

 I removed error catching for clarity.
 The output is:

 SCANDIR /mnt/sdcard
 SCAN /mnt/sdcard/LOST.DIR
 SCAN /mnt/sdcard/.android-secure

 But from the File Explorer in DDMS and from adb shell, I get:

 # ls -la /mnt/sdcard
 d- root root  2012-07-16 11:42 .android_secure
 d---rwxr-x system   sdcard_rw  2012-07-16 11:42 Alarms
 d---rwxr-x system   sdcard_rw  2012-07-16 17:06 MyDirectory
 d---rwxr-x system   sdcard_rw  2012-07-16 11:42 DCIM
 d---rwxr-x system   sdcard_rw  2012-07-16 11:42 Download
 d---rwxr-x system   sdcard_rw  2012-07-16 11:42 LOST.DIR
 d---rwxr-x system   sdcard_rw  2012-07-16 11:42 Movies
 d---rwxr-x system   sdcard_rw  2012-07-16 11:42 Music
 d---rwxr-x system   sdcard_rw  2012-07-16 11:42 Notifications
 d---rwxr-x system   sdcard_rw  2012-07-16 11:42 Pictures
 d---rwxr-x system   sdcard_rw  2012-07-16 11:42 Podcasts
 d---rwxr-x system   sdcard_rw  2012-07-16 11:42 Ringtones

 I need to scan every directory on the sdcard and find a certain type of
 file. It all worked fine in 2.2 and 2.3.

 What can I do?

 Thank you very much.

 Bye.


 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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: onCreate and orientation change

2012-07-31 Thread Dianne Hackborn
On Wed, Apr 28, 2010 at 11:42 AM, Amir Alagic amirs...@gmail.com wrote:

 Add this android:configChanges=keyboardHidden|orientation|keyboard
 to activity element in AndroidManifest.xml file. I hope that this is
 what
 you want.


No, don't.  That doesn't fix the problem, just hides it in some of the
common situations.  (This also breaks many behaviors around configuration,
such as selecting the right value for any resource that varies based on one
of these configurations.)

The correct solution is to write your activity correctly so that it does
the right thing when it is re-created from a previous saved state.

-- 
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] slick button?

2012-07-31 Thread Dianne Hackborn
For a button?  You don't want to do that, that is a huge amount of overhead
just for a button.

On Tue, Jul 31, 2012 at 3:27 PM, bob b...@coolfone.comze.com wrote:


 Is it possible to make a really slick button using OpenGL effects by doing
 something like this:


 public class MyButton extends GLSurfaceView


 ?


  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] Fragments Bitmap Recycling + a bunch of bitmap oriented questions.

2012-07-30 Thread Dianne Hackborn
On Sun, Jul 29, 2012 at 5:45 PM, bob b...@coolfone.comze.com wrote:

 Worried about memory?  Try this:
 application android:largeHeap=true


No.

First of all, this only helps you on higher-end devices that have lots of
memory to give you.  So you still need to look at the memory available and
make sure you don't exceed it, and the limit may not be any more than you
have now.  So this actually requires that you do *more* work on memory
management.

Second, let's look at the documentation:
http://developer.android.com/guide/topics/manifest/application-element.html#largeHeap


In particular: Most apps should not need this and should instead focus on
reducing their overall memory usage for improved performance.

And if you follow the link to getLargeMemoryClass():
http://developer.android.com/reference/android/app/ActivityManager.html#getLargeMemoryClass()

We'll further emphasize this: This is the space available for
memory-intensive applications; most applications should not need this
amount of memory, and should instead stay with the getMemoryClass() limit.

This API does not solve your memory problems.  You are programming for a
mobile, battery-powered, memory-constrained device.  Part of that is tight
memory management.  You don't get to shove an attribute in your manifest
and abdicate on that responsibility.

-- 
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] Programatically changing the screen brightness

2012-07-30 Thread Dianne Hackborn
I can't follow your question, but the code your posted has problems.

First, please don't set Settings.System.SCREEN_BRIGHTNESS.  This is the
global brightness set by the user.  It should not be changed by the
application.  It is not intended to be changed by the application;
generally there are other things you need to poke to have the system pick
up the new value, and this is all in the realm of implementation details
that you shouldn't rely on and almost certainly will not work consistently
across devices and platform versions.

Second, you also have some code that is setting
WindowManager.LayoutParams.screenBrightness.
 If you set this on your full-screen window, then while it is displayed on
the user it will force the screen brightness to the value you set here.
 You do need to make sure your activity is full-screen.  If it is, and your
activity is in the foreground, it will cause the brightness to change.  In
this case you are immediately starting another activity and finishing the
current one, so it will only very briefly impact the screen brightness (if
it all) for however long that activity remains visible to the user.

On Sun, Jul 29, 2012 at 2:55 PM, Cythes cytheshic...@gmail.com wrote:

 I'm now for sure 99% of the way complete on my code... I need to know one
 last thing. How do I programatically dim the of the android.

 I have tried making a set of intent groups. One loads the code for the
 dimmer then intents into the actual program and that runs with little issue
 other then the screen did not dim after the screen flipped over.
 Here is the code I am using:
 import android.app.Activity;
 import android.content.Intent;
 import android.os.Bundle;
 import android.provider.Settings;
 import android.view.WindowManager;

 public class bright extends Activity {
  @Override
 protected void onCreate(Bundle savedInstanceState) {
  // TODO Auto-generated method stub
 super.onCreate(savedInstanceState);
 Settings.System.putInt(this.getContentResolver(),
 Settings.System.SCREEN_BRIGHTNESS, 20);
 WindowManager.LayoutParams lp = getWindow().getAttributes();
 lp.screenBrightness =0.0f;// 100 / 100.0f;
 getWindow().setAttributes(lp);
 Intent i = new Intent(this, gateBridge.class);
 i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
 startActivity(i);
 finish();
 }
 }

 Since I know brightness settings can only be used after the screen has
 been reset or changed.

 So the question, how do I get this done?

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] Google Play vs. Android 4.0.3

2012-07-30 Thread Dianne Hackborn
Well I would say the second problem (not being able to connect to the
internet) is probably the cause of the first problem (Google Play not being
able to download or update applications).  Since I am pretty positive the
base 4.0.3 platform does connect to the internet, I think you are going to
need to talk with your manufacturer about your problem.

On Fri, Jul 27, 2012 at 11:56 PM, Jary Novak jaryen...@gmail.com wrote:

 Downloading apps in Android 4.0.3
 After installing 4.0.3 to Android htc evo 3d, you can not download
 applications or update existing ones, will not connect to the Internet
 (waiting for the network), although the internet or run?

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] Fragments Bitmap Recycling + a bunch of bitmap oriented questions.

2012-07-30 Thread Dianne Hackborn
On Mon, Jul 30, 2012 at 10:59 AM, bob b...@coolfone.comze.com wrote:

 *“640K ought to be enough for anyone”*

Um, no.  There is nothing similar to these two things.

Our limit is: devices don't have an infinite amount of RAM, applications
must be written to live within the available RAM on the device.

In fact the RAM limit for applications has been steadily increasing over
time, and we don't have an upper limit on it that we think is the maximum
we will ever need.

-- 
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] Fragments Bitmap Recycling + a bunch of bitmap oriented questions.

2012-07-30 Thread Dianne Hackborn
Btw, I love how more and more I see people dragging out this quote every
time they encounter some limit that they have to deal with, as if there
should just not be limits on the resources they can use.

On Mon, Jul 30, 2012 at 5:50 PM, Dianne Hackborn hack...@android.comwrote:

 On Mon, Jul 30, 2012 at 10:59 AM, bob b...@coolfone.comze.com wrote:

 *“640K ought to be enough for anyone”*

 Um, no.  There is nothing similar to these two things.

 Our limit is: devices don't have an infinite amount of RAM, applications
 must be written to live within the available RAM on the device.

 In fact the RAM limit for applications has been steadily increasing over
 time, and we don't have an upper limit on it that we think is the maximum
 we will ever need.

 --
 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] Set bounds for one layer of LayerDrawable?

2012-07-30 Thread Dianne Hackborn
No, the bounds are where the drawable will actually render itself.  If you
want two different bounds, that should technically be two different
drawables.

If you need to have this all in one drawable, the only option I can think
of is to make your own subclass of Drawable that computes the different
bounds as you want them.

On Mon, Jul 30, 2012 at 9:44 AM, Jonathan Koren jdko...@gmail.com wrote:

 I'm creating a custom View that looks like a horizontal ProgressBar but
 doesn't always have to touch the left edge. My approach is to use a
 LayerDrawable in which one layer uses different bounds (computed at run
 time). The attachement shows expected (top) versus actual (bottom) results.

 From what I can tell, setting the bounds for one layer also sets the
 bounds for the entire LayerDrawable. The code in the custom View is
 essentially this:

 int left, top, right, bottom;
 /*... do some math ... */
 Drawable d = mDrawable.findDrawableByLayerId(R.id.custom_layer_id);
 d.setBounds(left, top, right, bottom);


 Meanwhile, the xml for the drawable is this:

 layer-list xmlns:android=http://schemas.android.com/apk/res/android; 

  item

  shape android:shape=rectangle 

  solid android:color=#ff99 /

  /shape

  /item

 item

  android:id=@id/custom_layer_id

  android:drawable=@drawable/test_gradient/

 /layer-list


 Can I set bounds for an individual layer without affecting the other
 layers? If not, what can I do to get around this issue?

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




-- 
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] How to put ads in live wallpapers?

2012-07-29 Thread Dianne Hackborn
This isn't Google's opinion, it is my opinion.

If other people have found ways to do ads that work, then great.  As I
said, I am not morally opposed to it, this just isn't a design goal for
them.

And it sounds like you see ways to do things that you think are acceptable,
so what are you looking for in your original question...?

On Sun, Jul 29, 2012 at 10:05 AM, MobileVisuals eyv...@astralvisuals.comwrote:

 Thanks for explaining Google's opinion on this! The free version of
 Fireflies live wallpaper seems to have an ad solution, which works well.
 A transparent banner is shown at the top of the main screen for the live
 wallpaper. The reviews for the app are good and I don't see any complaints
 about the ad. I think it has been among the top40 most downloaded live
 wallapers.

 SlideME is the other big android appstore. The purchase to download rate
 here is almost 0%, so ad based free versions are the only solution for this
 appstore. One option is to have one free version without ads for Google
 play and and one version with ads for SlideME,but this would be time
 consuming.

 A purchase to download rate of 1% can be realistic on Google play. A
 company would get about 1$ if we the price is 1,5$. 100 000 free downloads
 each month on Google play would then be required to earn 1000$. Much less
 downloads would be required to
 get as much revenue if the free versions has ads.

 Could really a business model of only purchases generate as much revenue
 as purchases+ads? Maybe if removing the ads generated much more downloads.
 But there are a lot of live wallpapers with ads, which are getting lots of
 downloads, like Fireflies live wallpaper.



 Den fredagen den 27:e juli 2012 kl. 23:39:20 UTC+2 skrev FiltrSoft:

 Yea, I don't think live wallpapers were meant as a thing to build a
 business around, unless you can sell a whole lot of them for $.99, which
 you might on iOS (if they had the functionality).

 www.filtrsoft.com

 On Friday, July 27, 2012 6:22:39 AM UTC-4, MobileVisuals wrote:

 Could you please explain why you think it is a terrible idea to mix live
 wallpapers with advertising?

 I have talked to several mobile advertising companies now and now one
 has any other advertising solution for live wallpapers than push
 notifications. Is any one else here developing live wallpapers? If so, how
 are you managing the advertising in the live wallpapers?

 Den onsdagen den 25:e juli 2012 kl. 19:10:12 UTC+2 skrev Dianne Hackborn:

 Mixing live wallpapers with attempts at advertising seems like a
 terrible idea to me.  Have you considering instead trying something like
 in-app billing to allow users to unlock features in your app?

 On Wed, Jul 25, 2012 at 6:12 AM, MobileVisuals 
 eyv...@astralvisuals.com wrote:

 Is there any other way to advertise in live wallpapers than push
 notifications? My company is using push notifications. This pays off well,
 but it also results in some bad reviews.I got this suggestion from another
 company:

 o Create a welcome page (name of the company, some app’s information)

 o Call for a Full screen ad with go and skip button

 o The go button will generate a click and transfer the user to the add

 o The skip button will transfer the user to your app to continue the
 app experience.

 Would this really work when the wallpaper is set as the current live
 wallpaper? The user doesn't want to press a button every time the screen 
 is
 woken up?

 Does anyone have any other idea of how to put ads in live wallpapers?

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@**
 googlegroups.com android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+**unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/android-developers?hl=enhttp://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.


 Den fredagen den 27:e juli 2012 kl. 23:39:20 UTC+2 skrev FiltrSoft:

 Yea, I don't think live wallpapers were meant as a thing to build a
 business around, unless you can sell a whole lot of them for $.99, which
 you might on iOS (if they had the functionality).

 www.filtrsoft.com

 On Friday, July 27, 2012 6:22:39 AM UTC-4, MobileVisuals wrote:

 Could you please explain why you think it is a terrible idea to mix live
 wallpapers with advertising?

 I have talked to several mobile advertising companies now and now one
 has any other advertising solution for live wallpapers than push
 notifications. Is any one else here developing live

Re: [android-developers] What method gets called when a fatal exception occurs

2012-07-29 Thread Dianne Hackborn
You don't need to do anything, the process will be killed but the database
exists in persistent storage so whatever you had last committed to it is
still there and will be there the next time you open and need it.

On Sun, Jul 29, 2012 at 8:24 AM, Jim Morris jim.mor...@lecere.com wrote:

 This seems to be the simplest of questions, but I have not been able
 to find a suitable answer on Google or this forum.

 I am surprised to find that Android apparently does not call
 onDestroy, onStop, or onPause after a fatal exception occurs (e. g. a
 null pointer fatal exception). I have put the following code into two
 activities that are around when a fatal exception occurs. None of this
 code gets executed in either activity when a fatal exception occurs in
 one of the activities.

 public void onStop() {  Log.i(JIM,CALL ONSTOP); super.onStop();  }

 public void onDestroy() { Log.i(JIM,CALL ONDESTROY);
 super.onDestroy();  }

 public void onPause() { Log.i(JIM,CALL ONPAUSE);
 super.onPause();  }

 So this begs the question: What method is called that will allow me
 to, for example, close the database so the database does not get
 destroyed when a fatal exception occurs?

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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: Jelly Bean, READ_LOGS and 'Application Lockers'

2012-07-28 Thread Dianne Hackborn
On Fri, Jul 27, 2012 at 1:26 PM, Bryan Ashby nuskoo...@gmail.com wrote:

 Perhaps another solution is a API set and a new level of permission
 authentication. E.g., an developer would need to sign with a key that
 contains a trusted CA (Google stamp of approval or such)


That is not how Android works.  There are no CAs, no entity (including
Google) who owns the platform to approve what apps can do.

-- 
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] Fragments Bitmap Recycling + a bunch of bitmap oriented questions.

2012-07-28 Thread Dianne Hackborn
If you have a fragment that holds on to a lot of memory in its view
hierarchy and are concerned about this, then use
FragmentTransaction.remove() to make it no longer visible -- that will
remove it from its parent view and destroy its view hierarchy, so it
doesn't hold on to any references.  (If you are manually loading bitmaps in
the fragment, in onDestroyView() you can clear the references there.)  Of
course this means a bit more overhead when the user returns to the
fragment, since its view hierarchy needs to be re-inflated and initialized
again.  But it won't be any worse than the first time the user visited it,
and you need that to be fast as well.

It is true that FragmentTransaction.hide() does not remove and the destroy
the fragment's view hierarchy, just doing View.setVisibility().  But that
is not all -- it takes care of managing the fragment lifecycle so that
fragment will be paused and stopped (since it is no longer visible).  You
can implement the lifecycle to free up resources if you need to.  This will
also result in them being freed when the entire activity is stopped, which
is probably what you want as well.

You shouldn't be directly hiding the view associated with a fragment.  That
is what FragmentTransaction.hide/show() is for.  There is no need to
directly hide the view owned by it, and doing so means that you are letting
the correct fragment semantics execute.  (And for what it's worth, if you
have no reason to use fragments with ViewPager, there is nothing forcing
you to -- you can write your own adapter that directly manages raw views
and doesn't use fragments at all.)

On Sat, Jul 28, 2012 at 1:45 PM, Dmitriy F midnight@gmail.com wrote:

 Thanks for the answers! Would you mind to suggest on the part about
 fragments, bitmaps and memory management ? I decided to implement the app
 with 3 activities and about 8 fragments. The fragment number might slightly
 increase yet I think it's not the fragments but their bitmaps that gonna
 cause troubles with memory.

 For displaying the fragments I have two containers: a ViewPager(rotates
 3-4 fragments) element and a FrameLayout(displays strictly one fragment)
 element. Right now I'm simply hiding one type of container and showing
 another - setVisibility or fragmentTransaction.hide (I haven't figured out
 what is the difference between these two apart from the latest gives an
 ability of adding to activity's backstack). Is their any better way of
 switching between the containers ?

 Additionally, even if those fragments might not hold much memory by
 themselves - should I wrap those objects with SoftReference ?

 Could you tell any precautions/advices for implementing an app with such
 structure ? Thanks.


 On Saturday, July 28, 2012 9:36:27 PM UTC+3, Romain Guy (Google) wrote:

 1) Does ImageView.SetImageResource applied against the same id twice or
 thrice consumes memory for the same bitmap or uses a separate range for
 every imageview element ?


 I don't quite understand your question. When a Bitmap is loaded as a
 Drawable (which is what ImageView does), it gets cached by the system
 (using weak references.) This means that if do this:

 Drawable d1 = loadDrawable(R.drawable.**myImage);
 Drawable d2 = loadDrawable(R.drawable.**myImage);

 you will get 2 different instances of Drawable, but the underlying Bitmap
 will be loaded in memory only once.

 2) same as 1. but for BitmapFactory.decodeResource


 Every time you call this method you will load a new instance of a Bitmap
 object, which means you will use more memory.


 3) What part of Bitmap object consumes the most memory. If it's
 backbone memory object than what is it ? Where can I elucidate the
 structure of bitmap memory for myself ?


 A Bitmap is backed by a byte array containing all the pixels. This is
 what consumes the most memory. As of Android 3.0, this byte array can be
 found in Bitmap.java, in previous versions of the platform the pixel
 storage exists on the native side (you'd have to investigate SkBitmap.cpp.)

 --
 Romain Guy
 Android framework engineer
 romain...@android.com

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




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

Re: [android-developers] Does app updates count toward user installs on play store

2012-07-27 Thread Dianne Hackborn
Updates definitely don't increase your install count.  I very much doubt
that uninstalling and then re-installing would increase it, but don't quote
me on that.

On Mon, Jul 23, 2012 at 3:04 PM, Android Whiz hemant...@gmail.com wrote:

 I have basic question on how Google records the user installs that is
 listed on the play store.

 Does it increase the count in the following 2 scenarios:
 1. When user delete the App and re download the app again?

 2. When user download an update to the app?


 Thanks for the help.

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 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: Jelly Bean, READ_LOGS and 'Application Lockers'

2012-07-27 Thread Dianne Hackborn
That activity manager API was never intended to be used to poll the state,
it was there to provide debugging information.

I regret making it part of the SDK.  There is really no good use of it for
regular applications, and lots of bad uses.

I do agree that having facilities to provide restricted environments for
children are important.  I think the goal in the platform will probably be
to provide this as a feature in the platform, not an API for people to
build on top of.

On Fri, Jul 27, 2012 at 8:00 AM, Pent supp...@apps.dinglisch.net wrote:

  By the way, I think anyone at Google would argue this is a security hole,
  so I'm not alone

 They seem to allow services to do virtually anything that an activity
 can do at virtually any time. Doesn't seem to me they consider it a
 security hole.

 My app is called Tasker. It uses ActivityManager polling, which I
 detest.

 Pent

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] Regarding Application is not installed alert

2012-07-27 Thread Dianne Hackborn
It is fundamentally wrong to require a permission on your activity, and
then publish intent filters for it that would allow other applications to
try to launch it without explicitly expecting a permission (which means
matching any standard filters such as MAIN for your main activities, VIEW,
SEND, and on and on).

These are two completely incompatible things.  Publishing under one of
these intent filters says hey anyone who wants this standard kind of
activity, you can find me and run me and not know anything else about me!
 Requiring a permissions says hey you can only launch this activity if you
explicitly know about this special behavior it has that requires you hold
the appropriate permission to access.

Pick one or the other.  Not both.

On Wed, Jul 25, 2012 at 9:31 PM, Bunty syed itsmeatfo...@gmail.com wrote:


 Hi All,

 Actually I have one launcher with some child apps.

 I have given permission in all child apps so that only my launcher can
 launch them as follows
 permission
 android:name=android.permission.LAUNCH_KONY_POLICYINJECTED_APPS
 android:protectionLevel=signature/

 Tat is working fine. So with above, if any other application not signed
 with same keystore of child apps  not having required permission will get
 Permission denial exception while trying to launch the child apps .

 Now my doubt is when I click any of  installed child Apps in the phone
 application menu, I am getting Alert saying that Application is not
 installed..
  Tat is a expected behavior.
 But is there any way to customize that Alert message instead I want to
 display my alert message like Plz launch from my launcher app.




  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] Advantage of introducing Isolatedprocess tag within Services in JellyBean[Android]

2012-07-27 Thread Dianne Hackborn
I'll go farther: are you writing a web browser?  If no, just ignore it. :)

(Actually we can go a little more broadly and say it may be of interest if
you are writing an app that downloads arbitrary content from untrusted
sources which requires very complicated code to parse and render,
complicated enough that it is basically impossible to guarantee you don't
have security holes, so it would be useful to have another layer of
protection between your app and that content.)

On Fri, Jul 27, 2012 at 3:49 AM, Mark Murphy mmur...@commonsware.comwrote:

 On Thu, Jul 26, 2012 at 11:42 PM, Mehrag gaurav.cs.me...@gmail.com
 wrote:
  Can anyone put some light as what's the real/main advantage of
 introducing
  Isolatedprocess tag within Services in JellyBean[Android].

 It is a simple way of providing sandbox security, particularly for
 something that might be used by an app but could be exploited, such as
 a service using a scripting language to interpret scripts downloaded
 from the Internet.

 That being said, since it will create a second process, be judicious
 in its use, because it will consume extra RAM.

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

 _The Busy Coder's Guide to Android Development_ Version 3.8 Available!

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




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

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

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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] How to put ads in live wallpapers?

2012-07-27 Thread Dianne Hackborn
Let's assume that push advertising is a bad user experience.  (It is.)

Do you have a solution for presenting advertising to the user through a
live wallpaper that doesn't suck?

I can't think of one.  If you can't either, maybe this is just not an
appropriate thing to do.

We created live wallpapers as a cool little thing to jazz up the UI, with
an API that allows other people to make their own cool little things.  That
doesn't mean there are guarantees around monetizing these things through
anything besides direct user payments...  that wasn't really the goal of
this feature, the goal was just to make it possible to have interesting
things going on in the background of the home screen.

Maybe there are ways to monetize these through other things besides in-app
billing or some other such direct mechanism.  If you think you want to try
another way, you should at least have that as part of your plan from the
start.  Otherwise, you end up trying to shove some monetization on top of
something that wasn't designed from the start to have monetization, which
is probably going to be a bad result.  And as I said, since monetization
outside of direct charges isn't part of the core model around live
wallpapers, there is even more of a burden on you to figure out how to do
this nicely from the start.

On Fri, Jul 27, 2012 at 3:22 AM, MobileVisuals eyv...@astralvisuals.comwrote:

 Could you please explain why you think it is a terrible idea to mix live
 wallpapers with advertising?

 I have talked to several mobile advertising companies now and now one has
 any other advertising solution for live wallpapers than push notifications.
 Is any one else here developing live wallpapers? If so, how are you
 managing the advertising in the live wallpapers?

 Den onsdagen den 25:e juli 2012 kl. 19:10:12 UTC+2 skrev Dianne Hackborn:

 Mixing live wallpapers with attempts at advertising seems like a terrible
 idea to me.  Have you considering instead trying something like in-app
 billing to allow users to unlock features in your app?

 On Wed, Jul 25, 2012 at 6:12 AM, MobileVisuals 
 eyv...@astralvisuals.comwrote:

 Is there any other way to advertise in live wallpapers than push
 notifications? My company is using push notifications. This pays off well,
 but it also results in some bad reviews.I got this suggestion from another
 company:

 o Create a welcome page (name of the company, some app’s information)

 o Call for a Full screen ad with go and skip button

 o The go button will generate a click and transfer the user to the add

 o The skip button will transfer the user to your app to continue the app
 experience.

 Would this really work when the wallpaper is set as the current live
 wallpaper? The user doesn't want to press a button every time the screen is
 woken up?

 Does anyone have any other idea of how to put ads in live wallpapers?

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@**
 googlegroups.com android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+**unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/android-developers?hl=enhttp://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




-- 
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: Do we need images for all versions HDPI , MDPI , LDPI

2012-07-27 Thread Dianne Hackborn
Sure, if you are actually generating different bitmaps for different
densities, then you must be doing this because you want/need to carefully
control their graphics.  However my original point stands: if what you are
doing is drawing your icons at one high resolution and then scaling those
down automatically to generate lower dpi versions, it is well worth
considering just letting the platform do the scaling for you.

Also keep in mind that for the new tvdpi density that is used on things
like the Nexus 7, we *strongly* discourage developers generating their own
bitmaps for it.  Let the system take care of scaling those down (from the
hdpi or higher density version you supply).  This is what is happening for
very nearly every single graphic you see on the stock software that comes
with the Nexus 7.  If it is good enough for what is shipping on the N7, it
is probably good enough for you.

On Thu, Jul 26, 2012 at 5:30 PM, Mark Murphy mmur...@commonsware.comwrote:

 On Thu, Jul 26, 2012 at 8:26 PM, Francisco Marzoa fmmar...@gmail.com
 wrote:
  Also another point is the image to be scaled I itself. Some images may
 lost
  important details when scaled down while others won't do it.
 
  Photographs should scale down very will in most cases, but images
 generated
  by 2D design sometimes won't. For example, if you draw an straight line
 too
  thin that it's important for the design, it may disappear when scaling
 down.
  The same may occur with thin strokes. In these cases the unique approach
 is
  to export the image as a bitmap several times at different resolutions.

 Excellent point. Kirill Grouchnikov had a great blog post on a related
 topic, the old why aren't we using vector icons everywhere issue:

 http://www.pushing-pixels.org/2011/11/04/about-those-vector-icons.html

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

 _The Busy Coder's Guide to Android Development_ Version 3.8 Available!

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




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

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

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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] Issue with device scaling on Nexus 7 Tablet?

2012-07-26 Thread Dianne Hackborn
Take care when creating a 9-patch that the marks you use around the edges
are at least two pixels wide.  If you don't, when it is scaled down they
can disappear.

Another thing to watch out for is that the graphics associated with your
stretchable marks have one safe pixel before or after the marks, so that if
the graphic is scaled you won't end up with a different color at the edge
of the stretchable region (that color being a mix of the original color at
the edge, and the color of the pixel next to it).

On Wed, Jul 25, 2012 at 8:22 PM, Nicholas Campion camp...@gmail.com wrote:

 I am seeing some weird behavior on the Nexus 7 tablet when i set a
 centered relativelayout to have a background image with padding.

 http://stackoverflow.com/questions/11656534/padding-issue-on-nexus-7-tablet

 I thought an SO question might help illustrate better. The gist is that my
 small padding is being ignored by the relativelayout on the nexus 7 and I'm
 not able to recreate on the emulator using the nexus 7 settings. I'm cross
 posting here in the hopes that someone has seen similar issues and can
 share his or her insight.

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] How to put ads in live wallpapers?

2012-07-25 Thread Dianne Hackborn
Mixing live wallpapers with attempts at advertising seems like a terrible
idea to me.  Have you considering instead trying something like in-app
billing to allow users to unlock features in your app?

On Wed, Jul 25, 2012 at 6:12 AM, MobileVisuals eyv...@astralvisuals.comwrote:

 Is there any other way to advertise in live wallpapers than push
 notifications? My company is using push notifications. This pays off well,
 but it also results in some bad reviews.I got this suggestion from another
 company:

 o Create a welcome page (name of the company, some app’s information)

 o Call for a Full screen ad with go and skip button

 o The go button will generate a click and transfer the user to the add

 o The skip button will transfer the user to your app to continue the app
 experience.

 Would this really work when the wallpaper is set as the current live
 wallpaper? The user doesn't want to press a button every time the screen is
 woken up?

 Does anyone have any other idea of how to put ads in live wallpapers?

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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: Block Apk File Read.

2012-07-25 Thread Dianne Hackborn
On Wed, Jul 25, 2012 at 11:17 AM, JP joachim.pfeif...@gmail.com wrote:

 Which would create an incentive to forgo the install-on-SD-card
 option, because the external SD card can always be mounted on a non-
 Android host and APKs pulled from the card that way.


Apps installed on the SD card are placed in an encrypted container whose
encryption key is private to the device they were installed on.  They
aren't any more accessible than apps stored in internal storage (which is
basically world readable).

-- 
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: Jelly bean swiping task away from task list kills service

2012-07-24 Thread Dianne Hackborn
Could you include a binary?  I just want to see what the platform is doing;
I don't need to look at the code.  Thanks!

On Mon, Jul 23, 2012 at 10:40 PM, Andy dev andrewpmo...@gmail.com wrote:


 Dianne, I've created a very cut down version of my app where I'm still
 getting the issue. I've uploaded it to google drive here:
 https://docs.google.com/open?id=0B9RsW3kcQ9jPem9PLVIxdWdlQlU


 Basically, build and install the code and switch on accessibility for the
 app. Run the app and then change focus to a home screen or another app etc.
 Then receive a text message. You'll see the logcat line showing up for the
 new text message.

 Then use the tasklist to swipe away the app.

 Get another text message and as it arrives the service will crash, restart
 and you won't see the logcat message appear in the logs.

 The code is a little hacked together just to try and minimize the code for
 you to look at to try and recreate the issue. Let me know if you can't get
 it working or having any questions.

 On Sunday, July 22, 2012 8:19:23 AM UTC+1, Dianne Hackborn wrote:

 TransactionTooLarge means that the data being sent through the IPC call
 is too large.

 I just checked my test case and verified that this doesn't kill the
 service's process *if* it is in the foreground (with
 Service.startForeground()).  I'm not sure what may be different in your
 situation...  one thing to keep in mind is that when the user removes a
 task, and it is not safe to kill a process associated with it, then that
 process is marked as having a pending kill, and as soon as it becomes safe
 it will be killed.  So for example at whatever point after that you are no
 longer foreground, your process will be killed.

 There was a change in JB to make this interaction better about finding
 processes associated with the app and killing them.  If your service isn't
 running in the main process of the app, its process should always be killed
 now, where before it may not have been.

 However in all cases it is only killed if it is safe to do so -- that is
 if the process is at an oom_adj level that is safe to kill by the OOM
 killer.  Just running a background service means it is safe to kill; the
 service itself will be restarted if you have indicated this is what you
 want.  This is not a new situation that your app needs to deal with -- its
 process could always have been killed while in this state if memory was
 needed elsewhere (for example if the user launches a game that uses a lot
 of RAM).

 Back to the exception you mention, I wouldn't like to see this in the
 logs...  if you can give me steps to reproduce it, it is something I would
 like to investigate.

 That said, your initial description is not actually a system problem as
 you describe it -- yes your process gets killed, but this is a normal part
 of operation you should be dealing with, and if you can't recover when it
 is restarted then that is something that needs to be fixed in the app.

 On Sat, Jul 21, 2012 at 4:01 PM, Andy dev andrewpmo...@gmail.com wrote:

 Ok, I've found out a little more information. It seems that the crash
 doesn't happen when the task is swiped away, it's when one of the broadcast
 receivers tries to fire after the app has been swiped away. It works find
 beforehand, but it's cleared from the task list I'm also seeing this in the
 logs:


 07-21 23:57:40.286: E/JavaBinder(309): !!! FAILED BINDER TRANSACTION !!!
 07-21 23:57:40.286: W/BroadcastQueue(309): Exception when sending
 broadcast to ComponentInfo{com.example.**android.app/com.example.**
 android.app.receiver.**SmsReceiver}
 07-21 23:57:40.286: W/BroadcastQueue(309): android.os.**
 TransactionTooLargeException
 07-21 23:57:40.286: W/BroadcastQueue(309):  at 
 android.os.BinderProxy.**transact(Native
 Method)
 07-21 23:57:40.286: W/BroadcastQueue(309):  at android.app.**
 ApplicationThreadProxy.**scheduleReceiver(**
 ApplicationThreadNative.java:**767)
 07-21 23:57:40.286: W/BroadcastQueue(309):  at com.android.server.am.**
 BroadcastQueue.**processCurBroadcastLocked(**BroadcastQueue.java:220)
 07-21 23:57:40.286: W/BroadcastQueue(309):  at com.android.server.am.**
 BroadcastQueue.**processNextBroadcast(**BroadcastQueue.java:750)
 07-21 23:57:40.286: W/BroadcastQueue(309):  at com.android.server.am.**
 ActivityManagerService.**finishReceiver(**ActivityManagerService.java:**
 13281)
 07-21 23:57:40.286: W/BroadcastQueue(309):  at android.app.**
 ActivityManagerNative.**onTransact(**ActivityManagerNative.java:**346)
 07-21 23:57:40.286: W/BroadcastQueue(309):  at com.android.server.am.**
 ActivityManagerService.**onTransact(**ActivityManagerService.java:**
 1611)
 07-21 23:57:40.286: W/BroadcastQueue(309):  at android.os.Binder.**
 execTransact(Binder.java:367)
 07-21 23:57:40.286: W/BroadcastQueue(309):  at
 dalvik.system.NativeStart.run(**Native Method)
 07-21 23:57:40.286: W/ActivityManager(309): Scheduling restart of
 crashed service com.example.android.app/.**service.MainRunningService

Re: [android-developers] Re: Do we need images for all versions HDPI , MDPI , LDPI

2012-07-24 Thread Dianne Hackborn
The platform can scale to whatever density it needs, there is nothing
special about ldpi.

If you are going to be providing the different densities simply by scaling
the bitmap yourself, this is kind of pointless, because that is all the
platform does when it needs to have the image in a different density that
what you have supplied.  In this case providing the different densities
yourself is pretty much entirely a performance optimization -- the platform
doesn't need to do the scaling at runtime when loading your resources.

On Mon, Jul 23, 2012 at 3:53 PM, Justin Anderson magouyaw...@gmail.comwrote:

 With the exception of LDPI... As long as you provide the others, Android
 can efficiently convert to LDPI in most cases.  At least, that is what the
 Dev Guide says...

 Thanks,
 Justin Anderson
 MagouyaWare Developer
 http://sites.google.com/site/magouyaware



 On Mon, Jul 23, 2012 at 4:23 PM, RichardC 
 richard.crit...@googlemail.comwrote:

 yes


 On Monday, July 23, 2012 9:58:49 PM UTC+1, Android Developer wrote:

 Hi All,

 I am working in a avatar like application that has 20 plus images. I
 created HDPI images its looking good in HDPI mobiles not good in others.

 So do we need images for all version to support all phone models?




 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


  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] Usage of DisplayMetrics

2012-07-22 Thread Dianne Hackborn
On Sat, Jul 21, 2012 at 8:02 PM, Jim Graham spooky1...@gmail.com wrote:

 I'm not sure I understand  Are you saying that display.getWidth and
 display.getHeight don't return valid numbers?  Or did I miss something?


I am saying that I don't recommend using them, and I have no good strong
use cases for them.


 And if that's the case, why even have them in the developers guide?


If I was putting together the 1.0 SDK today, I would think hard about
whether or not these go into the SDK.

I don't recommend using them.

Do you have a specific use case where you think they are the right way to
go?

-- 
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: Jelly bean swiping task away from task list kills service

2012-07-22 Thread Dianne Hackborn
.

 I'm seeing this in the logs

 07-19 21:47:42.213: I/ActivityManager(307): Killing
 834:com.example.android.**appnam**e/u0a72: remove task
 07-19 21:47:42.236: W/AudioService(307):   AudioFocus   audio focus
 client died
 07-19 21:47:42.236: I/AudioService(307):  AudioFocus
 abandonAudioFocus(): removing entry for android.media.AudioManager@**
 41a**42020com.example.android.**appna**me.service.**
 MainRunningService$**1@41963ec0android.media.AudioManager@41a42020com.example.android.appname.service.MainRunningService$1@41963ec0
 07-19 21:47:42.244: W/ActivityManager(307): Scheduling restart of
 crashed service com.rageconsulting.android.**app**name/.service.**
 MainRunningServi**ce in 5000ms

 For the persistent Icon I'm doing the following:
 Notification foregroundNotification;
 foregroundNotification = new Notification(R.drawable.iconx,Example
 starting notification,System.**currentTi**meMillis());
 Intent i=new Intent(this, MainUIActivity.class);
 i.setFlags(Intent.FLAG_**ACTIVIT**Y_CLEAR_TOP|Intent.**FLAG_**
 ACTIVITY_SINGLE_TOP);
 foregroundNotification.flags|=Notification.FLAG_NO_CLEAR;
 startForeground(9642, foregroundNotification);



 Is there something I'm doing wrong? I've never had a problem in the
 past with this code, but it's not very good on jelly bean.



  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@**
 googlegroups.com android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+**unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/android-developers?hl=enhttp://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




-- 
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] Usage of DisplayMetrics

2012-07-22 Thread Dianne Hackborn
On Sun, Jul 22, 2012 at 5:21 AM, Jim Graham spooky1...@gmail.com wrote:

 That's probably what I'm not clear on  What is everything else
 in this case?  If display.getWidth and display.getHeight report that
 my tablet's display size is 1280x752 (which, I just discovered, is NOT
 what Settings--About Tablet--System Information--display pixels
 reports---it reports 1280x800) ... h   so which is right?


Given that you can have an arbitrary set of system controls around the
screen, carving out an arbitrary amount of space from the size available to
apps, that can be shown or hidden at arbitrary times, what does display
size mean?  (Not to mention more complicated organizations like say the
screen being split to show multiple applications.  Or other decorations
within the window like the action bar.)

The right way to do this is to put your UI up, giving the information to
the system about how it should be shown, and letting it go through a layout
with the screen to finally position and size your view that displays your
content of interest, retrieving the size there.

I see what this is all about now.  So display.getWidth/Height reports
 the wrong numbers, and View.getWidth() and View.getHeight() returns the
 correct display size?


It doesn't report the wrong numbers, it just can't guarantee to report the
actual size that your view showing its content will have.

Plus, you really want to be driven by being *told* the size of your view,
since this can change over time, and you want to respond when it does.
 Pulling a size from somewhere and assuming that is fixed is a rigidity in
your app that you should avoid.

-- 
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] Is there any logical way to make a notification bigger / Make more then one.

2012-07-22 Thread Dianne Hackborn
JB added support for larger notifications.  You can not force them to
display larger, however, they will change in size for various reasons as
appropriate.  It sounds to me like what you are trying to do may not be
what notifications are intended for.

On Sun, Jul 22, 2012 at 1:41 PM, Cythes cytheshic...@gmail.com wrote:

 I'm trying to work on an app that runs out of a notification.  Right now I
 am trying to make the notification bigger so it has more prevalence on the
 screen. And if that is not possible how do I make more then one
 notification so it runs one next to the other effectively making the app
 notification bigger..

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] Documentation for adb shell getevent / sendevent

2012-07-22 Thread Dianne Hackborn
No, this is fairly device-dependent.  getevent prints a summary of all the
devices so you know what those are.  The data generated for a device are
generally the Linux kernel's event protocol, so you can look there for
further help, but there is no guarantee that a particular device will be
following those conventions.

On Sun, Jul 22, 2012 at 1:55 AM, matt matthias.gru...@gmail.com wrote:

 hello,
 is there any documentation on the format of the getevent and sendevent
 shell commands? specifically the ones for touchevents.
 or is this device-dependent?

 it is a bit hard to guess what those ids are doing.

 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




-- 
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] onLayout is getting called multiple times during orientation

2012-07-22 Thread Dianne Hackborn
It can be, for example a layout manager may do this on its children.

On Sun, Jul 22, 2012 at 5:47 PM, Agus agus.sant...@gmail.com wrote:

 Hi all,

 I am getting onLayout called twice during orientation with different
 dimension values, is this an expected behavior ?

 -Agus.

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] Usage of DisplayMetrics

2012-07-21 Thread Dianne Hackborn
Not sure what you are answering...?  That is not a use case, that is just
retrieving the values.  Which, again, I recommend not using for anything.

On Fri, Jul 20, 2012 at 12:10 PM, bob b...@coolfone.comze.com wrote:

 Or like so:

 Display display =
 ((WindowManager).getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
 float width = display.getWidth();
 float height = display.getHeight();


 On Friday, July 20, 2012 1:06:36 PM UTC-5, Dianne Hackborn wrote:

 I recommend never using them.  The real correct size will be given to you
 through the view hierarchy.

 On Thu, Jul 19, 2012 at 7:32 PM, Agus agus.sant...@gmail.com wrote:

 What are the uses cases in which width and height values of
 DisplayMetrics used ?

 Is it just for games ?

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@**
 googlegroups.com android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+**unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/android-developers?hl=enhttp://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




-- 
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] Usage of DisplayMetrics

2012-07-20 Thread Dianne Hackborn
I recommend never using them.  The real correct size will be given to you
through the view hierarchy.

On Thu, Jul 19, 2012 at 7:32 PM, Agus agus.sant...@gmail.com wrote:

 What are the uses cases in which width and height values of DisplayMetrics
 used ?

 Is it just for games ?

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] Seeing wierd things with JB on Nexus 7 and timers/activities

2012-07-18 Thread Dianne Hackborn
The log line you posted just means that for some reason your UI thread has
been busy so missed frames.

If the code you printed is executing that log line more than once, then you
either have a race condition (because this is being executed from multiple
threads), or something is clearing that flag.  Either way, at this point it
looks like an issue in the app.

On Tue, Jul 17, 2012 at 9:08 PM, Mind steven...@gmail.com wrote:

 1st:  This does NOT occur on ICS.

 I have two Activities that I cycle between.  Game screen and Results
 screen (don't complain about not using Activity Fragments).

 I end one with finish() and then call the next.  If I exit out using the
 back button, some time later one of the Activies pops up.  Presumably
 because the timed game round ends and the next activity is auto-started or
 something.

 Additionally, I have a timer loop using Runnable.  Inside the loop I do
 things like this:

 if (game_time  0  game_time  5  flag)
 {
   flag = false;/// class variable
   Log.i(WTF, Why do I see this message more than once?);
 ... }

 Well, this code gets run MULTIPLE times I can see the log messages.

 If I upload the EXACT same APK to an ICS device, these behaviors do not
 happen.

 I also see this message in the log:
 07-18 00:05:51.187: I/Choreographer(20425): Skipped 42 frames!  The
 application may be doing too much work on its main thread.

 Is anyone seeing anything similar or can explain this ?


  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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: Maximum number of thread created by an Android activity

2012-07-18 Thread Dianne Hackborn
There is no such limit to the number of threads.

However, if you are wondering about such limits, you should probably be
re-thinking your app design. :}

On Tue, Jul 17, 2012 at 2:52 PM, b0b pujos.mich...@gmail.com wrote:



 On Tuesday, 17 July 2012 23:42:41 UTC+2, michael s wrote:

 Hi,

 Is there a limit for the number of thread created by an Android activity
 runs on a phone?
 If yes, how can I find out such limit?

 Thank you.


 It depends on devices but on most of them this limit is set to 42 threads.

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] possible to read drag in status bar notication

2012-07-18 Thread Dianne Hackborn
On Wed, Jul 18, 2012 at 1:12 AM, Rocky rkjhaw1...@gmail.com wrote:

 Can u tell me, if i'm dragging notification bar, any method of activity
 got fired or started ?


No, nothing, nada, zilch.

Heck a notification has nothing to do with an activity at all.  Even if
there was such a feature, it wouldn't have a clue what activity to do
anything with...  not to mention  even if it did, that activity could be in
the background and killed at that point.


-- 
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: Why doesn't Android API publicly allow to listen for incoming SMS?

2012-07-18 Thread Dianne Hackborn
On Wed, Jul 18, 2012 at 4:15 AM, kenjkelly kenke...@kenkelly.com wrote:

 I agree with the frustration of having secret undocumented intents.  Makes
 me wonder what else is available and how we would ever know. For example 
 put android.provider.Telephony.**SMS_RECEIVED ?  There is not even an
 android.provider.Telephony class in the API reference.  If Google is going
 to use text strings for Intents actions, they should be documented.


No they shouldn't.

Or hey, why don't you give us documentation to every string in your
application.  Thanks! :)


  Does anyone have a list of intents actions beyond what the API provides?


Any of that stuff is implementation details, that can vary across platform
releases and even different 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] Battery Changed

2012-07-18 Thread Dianne Hackborn
Also the manifest is requiring that whoever sends the broadcast to it hold
the BROADCAST_STICKY permission, which is unnecessary and really I'd say
outright wrong.  Also the manifest is requesting that permission, which it
does not need, and the BATTERY_STATS permission, which it does not need and
also can not get.

On Wed, Jul 18, 2012 at 2:13 PM, Mark Murphy mmur...@commonsware.comwrote:

 You cannot register for ACTION_BATTERY_CHANGED in the manifest. You
 can only listen for this broadcast via registerReceiver() from an
 existing, running component.

 On Wed, Jul 18, 2012 at 3:57 PM, krishna kumar send2mess...@gmail.com
 wrote:
  Hi All
 
  Not working my recever why ?
 
  here my code please help me
 
  
  import android.content.BroadcastReceiver;
  import android.content.Context;
  import android.content.Intent;
  import android.util.Log;
 
  public class MyRecever extends BroadcastReceiver {
 
  @Override
  public void onReceive(Context context, Intent intent) {
 
 
 int level = intent.getIntExtra(level, 0);
 Log.i(MyRecever, ---+level);
 
 
  }
 
  }
  manifest.xml===
 
  ?xml version=1.0 encoding=utf-8?
  manifest xmlns:android=http://schemas.android.com/apk/res/android;
  package=my.custom
  android:versionCode=1
  android:versionName=1.0 
 
  uses-sdk android:minSdkVersion=7 /
  uses-permission android:name=android.permission.BROADCAST_STICKY/
  uses-permission android:name=android.permission.BATTERY_STATS/
 
  application
  android:icon=@drawable/ic_launcher
  android:label=@string/app_name 
  activity
  android:name=.CustomserviceActivity
  android:label=@string/app_name 
  intent-filter
  action android:name=android.intent.action.MAIN /
 
  category
 android:name=android.intent.category.LAUNCHER /
  /intent-filter
  /activity
  receiver android:name=MyRecever
  android:enabled=true
   android:permission=android.permission.BROADCAST_STICKY
  intent-filter
  action
  android:name=android.intent.action.BATTERY_CHANGED/
  /intent-filter
  /receiver
  /application
 
  /manifest
 
 
  --
  You received this message because you are subscribed to the Google
  Groups Android Developers group.
  To post to this group, send email to android-developers@googlegroups.com
  To unsubscribe from this group, send email to
  android-developers+unsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/android-developers?hl=en



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

 _The Busy Coder's Guide to Android Development_ Version 3.8 Available!

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




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

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

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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] Activity being started with old bundle data

2012-07-18 Thread Dianne Hackborn
Did you use PendingIntent.FLAG_CANCEL_CURRENT?

On Wed, Jul 18, 2012 at 7:55 AM, Matt Schoen mtsch...@gmail.com wrote:

 Hi there,

 I'm having an issue with an activity, which is started via a notification,
 which is spawned by an alarm.

 I've added debug outputs to determine whether the right data is being
 sent, and it is.  What's happening is this:

 The alarm fires, which picks a random entry from my database, and creates
 a notification with an intent starts an activity with that ID value as a
 bundle extra.  When this activity starts, the notification is cancelled.
  The first time this all works like a charm.  However, the second time this
 alarm fires, it creates a new notification, and adds a different ID to the
 bundle extra (I'm sure of this since I print out the value of the
 variable).  However, when the new activity starts, it reads the OLD ID from
 the bundle extras.

 What gives?

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] New READ_EXTERNAL_STORAGE permission breaks file:// URIs

2012-07-17 Thread Dianne Hackborn
You can put your data in your own content provider.

Actually, you should stop and think about doing this approach at all.  You
say this is for an app widget...  why not provide the bitmaps as bitmaps
instead of having it load the data elsewhere?  Note that if you don't
provide the bitmaps directly, anything you do means you are making this
data globally readable by everyone (because you can't make any assumptions
about the permissions available to whoever is hosting your app widget),
which is generally a big no-no for security reasons.

This isn't a launcher bug.  Launcher is just one possible host of app
widgets.  You can't assume whoever is hosting your app widget will have any
specific permissions.

Also this is why the protection in JB is turned off by default.  Right now
app developers should be updating their apps to fix these issues, so when
this protection is turned on for all users in a future release they will
still work.

Btw this change is described in the permissions section of the 4.1 API
overview:  http://developer.android.com/about/versions/android-4.1.html

On Tue, Jul 17, 2012 at 9:21 AM, String sterling.ud...@googlemail.comwrote:

 Throwing this out for discussion here...

 Now that I have a JB device in-hand, I've found a sneaky little problem
 with the new READ_EXTERNAL_STORAGE permission. Specifically, if you pass
 another app a URI - say via a ContentProvider - that uses the file://
 protocol, then the receiving app NEEDS the new permission in order to read
 from that URI. Thus, the new permission has the (presumably unintended)
 potential to break an unknown number of existing apps when it enters
 production: their ContentProviders will suddenly cease to work.

 I ran into this because I've re-implemented most of my AppWidgets to use
 file:// URIs for their imagery, rather than passing the bitmap directly
 through RemoteViews. [This was done as a workaround for
 http://code.google.com/p/android/issues/detail?id=17509.] And it works
 fine unless you enable the READ_EXTERNAL_STORAGE check on JB hardware, at
 which point the images fail to load due to a permission failure from
 Launcher.

 One solution would obviously be to report this as a bug in Launcher, and
 for the appropriate team at Google to add READ_EXTERNAL_STORAGE to its
 permissions. Not a great solution, though, because it only fixes this
 single case. All other homescreen-replacement apps, from everyone from OEMs
 to indie devs, would need to make the same change. And I can promise you
 some won't.

 Another possible solution would be for me to keep these images in internal
 storage, making them world-readable so the URI recipient can read them. I
 haven't tested this to see if it'll work, but even assuming it does, it's a
 change that anyone who generates a file:// URI would need to make. And
 probably, some of them are generating URIs to files that can't reasonably
 be moved to internal storage. So we're back in the business of breaking
 existing apps.

 I don't know the internals well enough, but is it possible that there's a
 solution that could be implemented at the platform level? That whatever
 platform mechanism fulfills file:// URIs would bypass the
 READ_EXTERNAL_STORAGE permission check?

 Or is this by design, platform team? If so, I think it really needs to be
 publicized.

 Comments?

 String

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] can we restart systemserver..............?

2012-07-17 Thread Dianne Hackborn
You can't.  Asking the same question again doesn't change the answer. :/

And good ghod, no of course you can't restart the freaking activity manager
without restarting all the apps.  I mean... come on!

You haven't actually said what you are trying to do, but the path you are
going down here is almost certainly wrong for whatever it is.  Restarting
something like the activity manager is not in any way shape or form correct
as a normal part of the system operation.

On Tue, Jul 17, 2012 at 7:52 AM, Abhilash baddam 
abhilash.androiddevelo...@gmail.com wrote:

 HiDianne Hackborn ,

 Thanks for the reply, still I am having some doubts,

 1) I read that HeadsetObserver which is a systemservice, starts whenever
 headset is detected and stops working whenever we removed the headdset.
 Similarly I want to start or stop particular
 systemservice(PackageManagerService,ActivityMAnagerService etc...) whenever
 it's required.

 **

 ** **

 Why I want to do restart the systemservices means, whenever user presess
 on a button I want reload all the applications, without rebooting complete
 device. instead of that I am planning to 

 restart some systemservices like PackageManagerService and
 ActivityManagerService because these are services which plays keyrole for
 loading 

 apps(SystemApps and Market apps).

 ** **

 2) If it's not possible to restart the systemservices then I am planning
 to restart the SystemServer(SystemServer .java) so that all systemservices
 will be restarted, eventually all

 **

 apps will be reloaded without rebooting complete device.

 ** **

 I dont know whether these are possible things or not just I am thinking. I
 am ready to do Framework level changes.


 Could you please suggest me as I am new to Application Framework.



 On Sun, Jul 15, 2012 at 1:01 PM, Dianne Hackborn hack...@android.comwrote:

 Not from a third party app.  You can stop/start it with adb shell stop
 and adb shell start.  If it is stopped, all of the framework goes down,
 including all applications.  You can't stop/start individual system
 services.

 On Sat, Jul 14, 2012 at 10:17 PM, Abhilash baddam 
 abhilash.androiddevelo...@gmail.com wrote:

 Hi,

 Generally SystemServer wiil start all systemservices
 (ActivityManagerService, PackageManager etc..)right.

 1)Is it possible  to restart the systemserver  so that all
 systemservices will be restarted.
 2) Similarly can we restart the particular systemservice for ex:
 PackageManagerService.

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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




-- 
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] New READ_EXTERNAL_STORAGE permission breaks file:// URIs

2012-07-17 Thread Dianne Hackborn
On Tue, Jul 17, 2012 at 11:46 AM, String sterling.ud...@googlemail.comwrote:

 The summary is, passing middling-large imagery to a widget doesn't work;
 IPC fails silently. The content provider was the recommended workaround,
 and it's done well until now.


I would really suggest reducing the memory of your bitmaps then.  This
limit is actually important -- if you are pushing huge bitmaps into the
launcher, you run the risk of the launcher failing when it exhausts its
heap due to them.

We have limits.  Limits are important.  Respect the limits. :)


 This isn't a launcher bug.  Launcher is just one possible host of app
 widgets.

 That's what I said in my OP, yes. To fix this from the content-consumer
 side, every appwidget host out there would have to request the new
 permission. Which isn't likely.


More than not likely, it's not going to happen.


 Which brings me back around to my main point: this is a permission change
 that needs to be made *in an app other than the one that's failing*. The
 file:// URI content provider can't make the change; it's the
 content-consuming app that needs to request the new permission. And that's
 not in the docs, nor is it something that's necessarily obvious to the
 content-consumer dev, especially if the testing they're doing is with
 non-file URIs.


Not sure what you mean not in the docs -- it is described in the document
I pointed to.  I do agree that there should be more discussion of this, and
I can assure you there will be -- that is why we are doing things this way,
to have the facility in place for JB for developers to test against before
a later change actually impacts apps.


 You say it's not a Launcher bug; I do see your point, but I've had
 differing opinions on that. If Launcher is happily accepting file:// URIs
 that point to external storage, shouldn't it be requesting the appropriate
 permission to resolve that URI?


No.

We are pushing to get away from the free-for-all of external storage; this
is one of the steps in that.  We want a system in which as few apps as
possible are requesting these permissions.

-- 
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: Jelly Bean and Strict Mode

2012-07-16 Thread Dianne Hackborn
The bug I think is that the documentation should be updated.  We definitely
want the new behavior -- when strict mode is enabled by default (on
non-user builds) we explicitly do not want the checks happening in
Application.onCreate() because it is okay to do disk access and such there
(the process is after all in the process of being launched).

On Mon, Jul 16, 2012 at 1:25 PM, Ievgenii Nazaruk 
ievgenii.naza...@gmail.com wrote:

 Just curious, how did this influence your application? Do you access
 network layer from UI thread?

 Anyway, I think this is a bug, there is nothing changed in documentation.
 And StrictMode example in documentation still uses App's onCreate(). So
 there are no signs of this being an intentional change so far.


 On Monday, July 16, 2012 9:43:59 PM UTC+3, b0b wrote:


 Thank you for your in-depth analysis.

 I've ended up with this, call in the Application derived class onCreate():

 private  void setLaxStrictMode() {

 if(Build.VERSION.SDK_INT  Build.VERSION_CODES.**GINGERBREAD)
 return ;

 if(Build.VERSION.SDK_INT   Build.VERSION_CODES.JELLY_**BEAN) {
 StrictMode.setThreadPolicy(**ThreadPolicy.LAX);
 log.info(StrictMode: LAX);
 } else {

 new Handler().postAtFrontOfQueue(**new Runnable() {
 @Override
 public void run() {
 StrictMode.setThreadPolicy(**ThreadPolicy.LAX);
 log.info(StrictMode (JB): LAX);
 }
 });
 }
 }


 Now the real question is if the change in handleBindApplication() was
 intended, or if it is a real bug.

 In any case it broke my app on JB, and got me a few expeditive 1-star
 comments on Google Play

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] can we restart systemserver..............?

2012-07-15 Thread Dianne Hackborn
Not from a third party app.  You can stop/start it with adb shell stop
and adb shell start.  If it is stopped, all of the framework goes down,
including all applications.  You can't stop/start individual system
services.

On Sat, Jul 14, 2012 at 10:17 PM, Abhilash baddam 
abhilash.androiddevelo...@gmail.com wrote:

 Hi,

 Generally SystemServer wiil start all systemservices
 (ActivityManagerService, PackageManager etc..)right.

 1)Is it possible  to restart the systemserver  so that all systemservices
 will be restarted.
 2) Similarly can we restart the particular systemservice for ex:
 PackageManagerService.

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] Does Android Support Secondary Microsd Card?

2012-07-15 Thread Dianne Hackborn
The standard platform does not support multiple cards.  Many manufacturers
make modifications to support multiple cards, but as a result this is not a
consistent feature.

On Sat, Jul 14, 2012 at 2:42 PM, Dan dan.bez...@gmail.com wrote:

 Hi Everyone,

 I was wondering if Android supports a secondary MicroSD card.

 And if it does, then are there any phone or tablets on the market which
 provide a secondary slot for a secondary MicroSD card?


 Thanks,
 Dan

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] why is the account managed by AccountManager is delete automatically ?

2012-07-14 Thread Dianne Hackborn
The Galaxy Nexus never installs things on external storage, because that
is the same partition as internal storage.  You will note there is no UI
for moving apps between internal and external storage on such devices.

This is probably a bad interaction with the new app encryption at boot.

On Fri, Jul 13, 2012 at 1:01 AM, Mathias Roth simply.m...@gmail.com wrote:

 Some of my users are experiencing the same issue. My suspicion is that the
 default install location changed from internal to external on 4.1.1. At
 least one user reported things are working with

 android:installLocation=internalOnly

 set in the manifest. This should be default behavior according to API-doc,
 but it seems like it isn't on 4.1.1.

 For more discussion, take a look at my related issue 
 tickethttps://redmine.limun.org/issues/153
 .
 Cheers,
 Mathias

 On Thursday, July 12, 2012 11:14:28 PM UTC+2, marten wrote:



 Am Mittwoch, 23. März 2011 07:50:56 UTC+1 schrieb Dianne Hackborn:

 Because when the SD card is unmounted the apps on it disappear, so
 things that have state associated with those apps will clean it up.  This
 is why the documentation says you should not allow these kinds of apps to
 be placed on the SD card.


 Ok, but this also happens on the Galaxy Nexus (which doesn't feature a SD
 card slot). Afaik it didn't happen with Android 4.0.4, but it happens for
 users who upgraded to Jelly bean.
 What can I do to prevent this.

 Marten


 On Mon, Mar 21, 2011 at 8:22 PM, 琅琅 wuxiaojun2...@gmail.com wrote:

 My little App creates an account in AccountManager. But if i move the
 App from internal storage to SD card, the account is automatically
 delete by AccountManagerService if i unmounted the SD card or reboot
 the machine.

 does anyone have any idea about this ? does this mean we cannot move
 the App to SD card or is it because i am missing some config
 attributes in the config xml ?

 D/AccountManagerService( 245): deleting account XXX because type
 com.XXX no longer has a registered authenticator D/
 ContactsProvider( 945): removing data for removed account Account
 {name=, type=com.XXX}

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@**
 googlegroups.com android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+**unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/android-developers?hl=enhttp://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




-- 
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] How to stop terminate the Android application when using the native code

2012-07-14 Thread Dianne Hackborn
You just need to fix your native code so it doesn't do this.  Anyone giving
you a native library that is calling exit() in it is an evil sadist. :p

On Fri, Jul 13, 2012 at 3:02 AM, Clark kent nguyenle...@gmail.com wrote:

 Hello every body

 I have this problem which can not resolve it.

 I'm calling the native code(*C code*) from the android application. But
 in the native code, they call function *exit(0)* so it makes the app on
 Android terminate. Could any one know how to stop this one, because after i
 called one method from native code , after it finished, it will terminate
 the Android application.

 I found a way is disable the method *exit(0)*, so it will not terminate
 the Android app, but it meet error when i called the native method second
 time, some error kind like this: *Invalid heap address in
 internal_realloc*. I think that came from the re allocation the memory.
 So if any one know how to free all memory of native call, please let me
 know. Thanks for any comments

 Thanks

 Clark

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] Handler.sendEmptyMessageDelayed() unreliable on some versions of OS?

2012-07-14 Thread Dianne Hackborn
Note that these times are *uptime*.  If the screen is off, and nobody is
holding a wakelock, then the CPU will go to sleep, and uptime will stop
counting until it wakes up again.

On Fri, Jul 13, 2012 at 9:24 AM, mapeters mapet...@ideasave.com wrote:

 I have a thread (guts implemented as a subclass of Runnable) whose job is
 to perform an operation on demand from other threads or automatically every
 two minutes if no other thread invokes the operation. The run() method of
 this Runnable calls Looper.prepare(), creates a Handler object in a member
 variable, uses that to call sendEmptyMessageDelayed(1, 3000), then calls
 Looper.loop().

 Other threads use a method in this thread's public API to invoke its
 operation. That method just calls the handler's sendEmptyMessage(0) method
 to invoke it. When the handler's handleMessage(Message) method is called,
 it acquires a lock (ReentrantLock), calls the handler's
 removeCallbacksAndMessages(null) method and performs its operation (within
 a try/catch block). The finally section of that block calls the handler's
 sendEmptyMessageDelayed(1, 12) method then releases the lock.

 This works fine on every device I have tested it on, and by everything I
 know, it is a valid way to do this that ought to work on every version of
 Android OS. Recently, however, somebody claimed it wasn't running every two
 minutes as it should, and gave me the log file it produces to prove it
 (which it does). That log shows that sendEmptyMessageDelayed(1, 12) was
 called, and then 11 minutes later, the handleMessage(Message) method was
 called. I know this invocation of handleMessage() was in response to that
 sendEmptyMessageDelayed(1, 12) call because Message.what was 1 (a value
 used only by the sendEmptyMessageDelayed() call).

 How is this possible? I could understand the timing being off by a few
 seconds, but 11 minutes? In subsequent attempts to reproduce this, I have
 seen that timing being off by 45 minutes and more. This problem has been
 observed on an HTC One X running Android 4.0.3 and a Samsung Galaxy SII
 running OS 2.3.6.

 Has anybody else seen this issue? Does anybody have a suggestion for what
 might be causing this? My current position is that this is an OS bug, but I
 am loathe to just accept that and call it a day. BTW - just for kicks, I
 temporarily re-implemented this using a Timer object instead, and observed
 exactly the same problem (using Handler is a better solution anyway).

 Thanks,

 Mark Peters


  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] Showing Action Bar ONLY on tablet?

2012-07-14 Thread Dianne Hackborn
On Sat, Jul 14, 2012 at 1:30 PM, Latimerius l4t1m3r...@googlemail.comwrote:

 Giving the user a good feeling about using a device/app is a very
 tricky area.  I worked for the official games industry for 7 years and
 I saw the attention these guys tend to give controls.  While not every
 little Android app has to be as fine tuned as a twitch shooter, every
 app should feel good - something Apple is famous for understanding.
 You can't say that a painting app is good enough just because there
 are still a bunch of pixels left for the actual painting after we've
 rendered our UIs.


Okay: Apple is famous for having great UIs.

iOS does not have a hard menu button.

I believe there is an implication that you can do a great UI here without
relying on a hard menu button.

You might well be right on this, however the decision to leave out the
 Menu button is of a much much broader consequence than just finger
 paint apps for children.  There are apps for which an off-screen
 button is just *the* simple and natural solution, everything else is
 kludgy work-around.  If there were no such apps at the moment, they
 would appear in the future.


Except in the world on iOS where they manage to have great UIs, in-spite of
the heavy burden of not having a menu button?

Must be that Apple magic.  Wish we had some of that.


 Saying no Menu button should be enough for everyone reminds a
 similar well-known statement that concerned 640kB of memory -
 supporting such claims you run an acute risk of getting on the wrong
 side of history. :-)


But this is what I was really here to reply to.

Seriously?

You are comparing whether there is a physical button for invoking a menu
vs. an affordance within the application to a statement that one will never
need more than the *amount* of a certain resource?

Well okay then.

Oh btw, if you want to know whether the device has a physical menu button,
you can use this:
http://developer.android.com/reference/android/view/ViewConfiguration.html#hasPermanentMenuKey()

So if it has a menu key, you can leave your old UI, and if it doesn't I
guess you'll need to accept a UI this crappy like iOS.

-- 
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] Restriction in ContactsProvider has gone ?

2012-07-13 Thread Dianne Hackborn
This was never a supported API in the SDK, and the design behind it was
fundamentally flawed (which is one reason it was never in the SDK).

On Thu, Jul 12, 2012 at 11:29 PM, jindog jin...@gmail.com wrote:

 Hi,

 I've searched for IS_RESTRICTED field or restriction feature in
 Android Open Source Project git repo, but i couldn't.

 I found the commit ed6bfd922fd84db21de08c1d12e93c501b86560d - Remove
 restricted white-listing

 I want to know why this feature removed from source. (What's happing??)

 (Because of removal feature, any application can access the restricted
 data of ContactsProvider freely? )

 Regards,







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




-- 
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] Restriction in ContactsProvider has gone ?

2012-07-13 Thread Dianne Hackborn
This isn't a public API.  You can't assume anything about implementation
details like this.

On Fri, Jul 13, 2012 at 12:13 AM, jindog jin...@gmail.com wrote:

 Hmm...

 But, I found the source code that the feature is implemented on 
 ContactsContract
 ( Android 2.2 or higher including ICS).

 And in my phone (Galaxy S2 with ICS), the Contacts DB has the field
 is_restricted yet.



 According to your reply, how they (especially, facebook app.) can use this
 feature ?? ( Hacked ?? )



 On Friday, July 13, 2012 3:34:10 PM UTC+9, Dianne Hackborn wrote:

 This was never a supported API in the SDK, and the design behind it was
 fundamentally flawed (which is one reason it was never in the SDK).

 On Thu, Jul 12, 2012 at 11:29 PM, jindog jin...@gmail.com wrote:

 Hi,

 I've searched for IS_RESTRICTED field or restriction feature in
 Android Open Source Project git repo, but i couldn't.

 I found the commit **ed6bfd922fd84db21de08c1d12e93c**501b86560d
 - Remove restricted white-listing

 I want to know why this feature removed from source. (What's happing??)

 (Because of removal feature, any application can access the restricted
 data of ContactsProvider freely? )

 Regards,







  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@**
 googlegroups.com android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+**unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/android-developers?hl=enhttp://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




-- 
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: Service launch issues

2012-07-13 Thread Dianne Hackborn
You really need to post your stack crawl.  If you can't get adb connected,
you can't reasonably do development.

On Fri, Jul 13, 2012 at 3:41 PM, Cythes cytheshic...@gmail.com wrote:

 Actually to be specific I am looking to make my main activity run from the
 service via intent. however if need be I can just take my code from the
 main activity, I can just put the code into the service.


 On Friday, July 13, 2012 5:39:22 PM UTC-4, Tommy wrote:

 Activities have to run in the foreground. Services run in the background.
 Maybe we are just misunderstanding. What exactly do you want to run in the
 background?



 *From:* 
 android-developers@**googlegroups.comandroid-developers@googlegroups.com[mailto:
 android-developers@**googlegroups.comandroid-developers@googlegroups.com]
 *On Behalf Of *Cythes
 *Sent:* Friday, July 13, 2012 5:20 PM
 *To:* 
 android-developers@**googlegroups.comandroid-developers@googlegroups.com
 *Subject:* Re: [android-developers] Re: Service launch issues



 I seem to be getting This isn't possible quite a bit. I know I'm not
 a genius at this stuff in fact I'm far from it but every time someone says
 that I have been finding usable workaround's. Please note this is not me
 being cocky. Just something I am noticing.

 On Friday, July 13, 2012 5:04:25 PM UTC-4, MagouyaWare wrote:

 Wait, I just realized something... you are wanting your activity to run
 in the background?  AFAIK this isn't possible... why are you wanting to do
 this?

 Thanks,
 Justin Anderson
 MagouyaWare Developer
 http://sites.google.com/site/**magouyawarehttp://sites.google.com/site/magouyaware

 On Fri, Jul 13, 2012 at 2:58 PM, Nobu Games dev.nobu.ga...@gmail.com
 wrote:

 http://stackoverflow.com/**questions/11476906/service-**
 launches-then-crasheshttp://stackoverflow.com/questions/11476906/service-launches-then-crashes

 If you feel like cross-posting your own questions then please take the
 advice of the guys over at Stackoverflow seriously and post the exception
 message / log cat / stack trace, too. It crashes after 30 seconds can
 have a billion different reasons.

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@**
 googlegroups.com android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+**unsubscr...@googlegroups.comandroid-developers%2bunsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/android-developers?hl=enhttp://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 android-developers@googlegroups.com
 To unsubscribe from this group, send email to
 android-developers+**unsubscr...@googlegroups.comandroid-developers+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/**group/android-developers?hl=enhttp://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




-- 
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] App Name

2012-07-13 Thread Dianne Hackborn
I would recommend against this.  What do you think is going to happen in
all of the places where this label is shown as a single line?

At the very least, the correct way to do a line break in Android is with
just \n; don't include a \r.

On Fri, Jul 13, 2012 at 4:38 AM, Rahul Kaushik rahulkaushi...@gmail.comwrote:

 Hi,

 I have an App whose name to be displayed under icon, i want to show the
 second word in new line

 in manifest file
 1. is android:label=ABC\r\nMobile is it stable ?

 Thanks
 RK

 --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] How to show menu in Android 3/4 full screen app?

2012-07-13 Thread Dianne Hackborn
The menu at the bottom is for compatibility with old applications.  You
should not be relying on it with new applications.

Put an affordance somewhere in your UI to invoke this thing.  The menu
button is no longer a guaranteed affordance.

On Fri, Jul 13, 2012 at 5:32 PM, limtc thyech...@gmail.com wrote:

 I am faced with an issue trying to support full screen app (in both an
 arcade game and an infant painting program). There will be no ActionBar
 when the app run, but I needs to support Android 3.2 for some of the
 features I used.

 If there is no ActionBar, the ideal place for the menu will be at the
 bottom (status bar?) just like old app running on Android 3/4. I cannot
 depend on a dedicated hardware button as many new phones will not have it
 anymore.

 So what's the solution in such a case? 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




-- 
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] READ_LOGS permission is not granted to 3rd party applications in Jelly Bean (api 16)

2012-07-12 Thread Dianne Hackborn
Hi, sorry this didn't get documented.

The change is that third party applications can no longer get the read logs
permission, however every app can read the logs containing only the lines
*they* have written, without needing any permission.

Keep in mind that access to the logs has never been part of the SDK, and is
still not part of the SDK.  If you are relying on it then, even after this
change, you run the risk of breaking in the future.  (And that is partly
why this got lost for documentation, it is not part of the SDK, so there
isn't really a place to document it, in fact documenting it would kind-of
make it a part of the SDK which we don't want. :p)

Also we really really hope that developers don't take this as license to
further abuse the system logs and spew increasing amounts of stuff into it
from their app.  Log noise has been a continual problem on Android (not
just for third party apps, we always struggle to ship the open source
platform without a lot of noise), and if things continue to get worse we
will probably make further changes to it to better control it.

On Sun, Jul 8, 2012 at 12:26 PM, Ievgenii Nazaruk 
ievgenii.naza...@gmail.com wrote:

 Hi all,

 I've been working on an application for developers that uses
 DropBoxManager. The DropBoxManager requires READ_LOGS permission to be
 granted in order to query information from it.

 Today I've tested my application on newest (api 16) emulator before
 releasing it to Google Play. It turned out that Android now refuses to
 grant this permission to 3rd party applications. This is weird because I've
 looked through all Jelly Bean's documented changes and couldn't find
 anything that mentions READ_LOGS permission.

 So basically my questions:

- Did anyone see this change documented?
- Can someone confirm this behavior on Galaxy Nexus with Jelly Bean on
it (the one released to attendees of Google I/O)?

 And questions to someone from Android team:

- Why this breaking change wasn't described in documentations like

 READ_EXTERNAL_STORAGEhttp://developer.android.com/reference/android/Manifest.permission.html#READ_EXTERNAL_STORAGEwas?

- What should developers and testers do in order to use those handy
utility applications that require READ_LOGS to be useful? Is there any way
to allow READ_LOGS to 3rd party applications without making custom build
(i.e. something in Developer Options that I could've missed)?

  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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] Regarding Packagemanager..?

2012-07-12 Thread Dianne Hackborn
Specifically, PackageManagerService.java and related classes it uses.

On Thu, Jul 12, 2012 at 8:40 AM, Justin Anderson magouyaw...@gmail.comwrote:

 Look at the source code for PackageManager...

 Thanks,
 Justin Anderson
 MagouyaWare Developer
 http://sites.google.com/site/magouyaware



 On Thu, Jul 12, 2012 at 9:22 AM, Abhilash baddam 
 abhilash.androiddevelo...@gmail.com wrote:

 Hi,

 I came to know that after booting device, all the system apps and market
 apps( if there) will be loaded right. These all things will be handled by
 PackageManager means which are the already installed apps, based on that it
 will load all the apps. But how the PackageManager gets the information
 about installed apps in the device. I want to know to know more about
 PackageMAnager. I have gone through developer.android.com, but I want to
 know more about this.  Can anybody help me regarding on the same.




 Regards
 Abhilash




  --
 You received this message because you are subscribed to the Google
 Groups Android Developers group.
 To post to this group, send email to android-developers@googlegroups.com
 To unsubscribe from this group, 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




-- 
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: Showing Overflow menu button on ICS.

2012-07-12 Thread Dianne Hackborn
On Thu, Jul 12, 2012 at 2:54 AM, b0b pujos.mich...@gmail.com wrote:

 Btw what is the rationale for the system to never display the overflow
 menu on ICS phones having a hardware menu key ?
 Isn't that bad for discoverability, one of the benefits of the overflow
 menu ?


It would be redundant, and this behavior is consist with the long standing
UX for devices with a physical menu button.

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

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

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, 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: READ_LOGS permission is not granted to 3rd party applications in Jelly Bean (api 16)

2012-07-12 Thread Dianne Hackborn
/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] READ_LOGS permission is not granted to 3rd party applications in Jelly Bean (api 16)

2012-07-12 Thread Dianne Hackborn
On Thu, Jul 12, 2012 at 10:24 AM, Mark Murphy mmur...@commonsware.comwrote:

 On Thu, Jul 12, 2012 at 12:59 PM, Dianne Hackborn hack...@android.com
 wrote:
  however every app can read the logs containing only the lines
  *they* have written, without needing any permission.
 OK, I'll bite: how do you do this? Most of the read-the-logs code that
 I have seen uses logcat via Runtime#exec(), and I don't see a
 command-line switch on logcat to limit output to just your own
 process' lines.


There is no command line switch.  The kernel drive does this based on
whether you have the permission to access the full logs.  If not, it only
gives you the logs associated with your uid.

-- 
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] READ_LOGS permission is not granted to 3rd party applications in Jelly Bean (api 16)

2012-07-12 Thread Dianne Hackborn
On Thu, Jul 12, 2012 at 1:07 PM, Kristopher Micinski krismicin...@gmail.com
 wrote:

  Do users even look or comprehend what permissions are being used in any
  given app? The user wants the app, they agree, agree, agree and then get
  malware.

 This is a problem with permissions, not specifically the read logs
 permission.

 The problem with the read logs permission is that it doesn't clearly
 map into something the user can think about.

 The user can see reads logs and may think, oh, reading things the
 device does, like, battery, etc...?

 But doesn't get that it basically can let you monitor when apps start,
 plus whatever stupid developers do to like leaking high security data
 to a public channel ...


Yeah, ultimately, this just is not an appropriate use for a permission.  It
is not the kind of app functionality that 99% of users can even comprehend,
let alone have a chance of deciding whether it is okay for the app they are
installing.  We have over the years gone through a number of different
wordings of the permission, but at the end of the day it is just not
something that can be sensible displayed to the user.

So, it is now a development permission (a new concept introduced in JB),
which will never be shown to users, but developers can enable through their
development tools.

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

  1   2   3   4   5   6   7   8   9   10   >