[android-developers] PackageManager.queryIntentActivities() returns incomplete list?

2012-05-11 Thread Farmer
Hi there,

I am writing a launcher in Android and here is the problem I have been
trying to fix for a while with no luck.

I have below code to query all activities running at very beginning of
my launcher, say onResume().

final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
final List infos =
packageManager.queryIntentActivities(mainIntent, 0);
for (final ResolveInfo info : infos) {
// create my own record for each activity
}

The problem is that if I set my launcher as default and reboot the
device, every time I can get only part of the full list by above code.
It seems some big fat activities (such as Wind-up knight) are always
missing. However running above code second time will return the full
list. Does any one have idea why? My guess is that PackageManager
needs some time to parse the fat activities and if
queryIntentActivities() is called too early, it just returns a partial
list, is that true?

But why the default launcher has no such issue at all?

Thanks for any help in advance!

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


[android-developers] Re: PackageManager.queryIntentActivities() returns incomplete list?

2012-05-15 Thread Farmer
Ah, thanks a lot Dianne!

I do forget to handle ACTION_EXTERNAL_APPLICATIONS_AVAILABLE in my
code.

On May 12, 8:25 am, Dianne Hackborn  wrote:
> Those apps are probably on external storage, which has not been mounted
> yet.  You need to look at the broadcasts to find out when it is available.
>
>
>
>
>
>
>
>
>
> On Thu, May 10, 2012 at 4:02 PM, Farmer  wrote:
> > Hi there,
>
> > I am writing a launcher in Android and here is the problem I have been
> > trying to fix for a while with no luck.
>
> > I have below code to query all activities running at very beginning of
> > my launcher, say onResume().
>
> >    final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
> >    mainIntent.addCategory(Intent.CATEGORY_LAUNCHER);
> >    final List infos =
> > packageManager.queryIntentActivities(mainIntent, 0);
> >    for (final ResolveInfo info : infos) {
> >        // create my own record for each activity
> >    }
>
> > The problem is that if I set my launcher as default and reboot the
> > device, every time I can get only part of the full list by above code.
> > It seems some big fat activities (such as Wind-up knight) are always
> > missing. However running above code second time will return the full
> > list. Does any one have idea why? My guess is that PackageManager
> > needs some time to parse the fat activities and if
> > queryIntentActivities() is called too early, it just returns a partial
> > list, is that true?
>
> > But why the default launcher has no such issue at all?
>
> > Thanks for any help 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
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.

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


[android-developers] onConfigurationChanged() is not called when flipping between landscape and reverse landscape?

2012-06-07 Thread Farmer
Hi there,

On ICS, when I flip the phone between landscape and reverse landscape,
it seems onConfigurationChanged() won't be called. How can I get
notified when such event happens, or did I miss anything here?

Thanks in advance!

best,
duanxiaotao

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


[android-developers] Re: onConfigurationChanged() is not called when flipping between landscape and reverse landscape?

2012-06-14 Thread Farmer
Thanks guys for your reply!

I tried to set 
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize",
but it didn't help.

To Hoang, I can understand that Configuration does not change when I flip 
the phone. Actually I am calling getRotation() to decide
current display rotation. The thing is that I need a trigger to call the 
method when orientation is changing between landscape and
reverse landscape. And onConfigurationChanged() is my first thought. Any 
idea?

On Friday, June 8, 2012 1:26:08 AM UTC+8, Hoang DN wrote:
>
> Hi guy, 
>
> In your case, actually, Configuration did not change, therefore the 
> method onConfigurationChanged() won't be called. 
> If you want handle this event, you can use 
> android.view.Display.getRotation(). The returned value may be 
> Surface.ROTATION_0 (no rotation), Surface.ROTATION_90, 
> Surface.ROTATION_180, or Surface.ROTATION_270. 
>
> Hope this useful for you. Good luck! 
>
>
> Br, 
> hoangdn 
>
> On 7 Tháng Sáu, 23:49, Farmer  wrote: 
> > Hi there, 
> > 
> > On ICS, when I flip the phone between landscape and reverse landscape, 
> > it seems onConfigurationChanged() won't be called. How can I get 
> > notified when such event happens, or did I miss anything here? 
> > 
> > Thanks in advance! 
> > 
> > best, 
> > duanxiaotao

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

[android-developers] Re: onConfigurationChanged() is not called when flipping between landscape and reverse landscape?

2012-06-15 Thread Farmer
I am using a rotation listener as work around for this, but that means my 
code has to be synced with framework
in terms of orientation change (I mean landscape vs reverse landscape). In 
theory, that's an issue, isn't it.

Hi Dianne, thanks for your reply! Actually I have a camera preview running 
when user flips the phone. In that case
if I don't handle the camera rotation myself, all widgets are good except 
that preview is upside down.

As Streets Of Bostom suggested, I can make it work by writing a rotation 
listener. Just want to ask is there any
better, or official solution for this?

Thanks in advance! 

On Friday, June 15, 2012 10:02:20 AM UTC+8, Streets Of Boston wrote:
>
> You could write a listener to the sensors to get the *rotation*.
>
> On Thursday, June 14, 2012 7:36:41 PM UTC-4, Farmer wrote:
>>
>> Thanks guys for your reply!
>>
>> I tried to set 
>> android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize",
>> but it didn't help.
>>
>> To Hoang, I can understand that Configuration does not change when I flip 
>> the phone. Actually I am calling getRotation() to decide
>> current display rotation. The thing is that I need a trigger to call the 
>> method when orientation is changing between landscape and
>> reverse landscape. And onConfigurationChanged() is my first thought. Any 
>> idea?
>>
>> On Friday, June 8, 2012 1:26:08 AM UTC+8, Hoang DN wrote:
>>>
>>> Hi guy, 
>>>
>>> In your case, actually, Configuration did not change, therefore the 
>>> method onConfigurationChanged() won't be called. 
>>> If you want handle this event, you can use 
>>> android.view.Display.getRotation(). The returned value may be 
>>> Surface.ROTATION_0 (no rotation), Surface.ROTATION_90, 
>>> Surface.ROTATION_180, or Surface.ROTATION_270. 
>>>
>>> Hope this useful for you. Good luck! 
>>>
>>>
>>> Br, 
>>> hoangdn 
>>>
>>> On 7 Tháng Sáu, 23:49, Farmer  wrote: 
>>> > Hi there, 
>>> > 
>>> > On ICS, when I flip the phone between landscape and reverse landscape, 
>>> > it seems onConfigurationChanged() won't be called. How can I get 
>>> > notified when such event happens, or did I miss anything here? 
>>> > 
>>> > Thanks in advance! 
>>> > 
>>> > best, 
>>> > duanxiaotao
>>
>>

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