Saturday, December 15, 2012

Re: [android-developers] Android Lint Tool - Suggestions for 2 fatal problems (missed)

If the "minority of devices" have legitimately licensed copies of the
Play Store, then these crashes represent missing tests in the CTS, for
which we can file some issues.

If the "minority of devices" do not have the Play Store on them, or
are likely to have a pirated copy of the Play Store, then the problem
may lie in the devices themselves. Android developers are not
responsible for adjusting all their apps to work on non-standard
devices.

The second problem, in particular, has nothing whatsoever to do with
Lint. So long as you have called setContentView() before messing with
the action bar, nothing more needs to be "requested".

Your first problem (missing parent style) might be a legitimate Lint
check, though I am not sure it is worth an error severity if
compatible devices should work properly.

So, please provide some details as to which devices you are seeing
these problems on, so we can determine the proper course of action --
thanks!

On Sat, Dec 15, 2012 at 7:46 AM, I.E. <inibehe@gmail.com> wrote:
> The Android Lint tool is very good at spotting potential errors.
>
> But I think it missed 2 fatal problems:
>
> 1) No parent style defined for a custom style. [Flag as error]
>
> If you create a custom style in res/values/styles.xml, and your new
> style does not inherit from a standard Android theme, then your app
> will crash at startup on a minority of devices. It's hard to spot
> because most devices and the emulator do not crash. You will only find
> out when you release your app, and receive loads of crash reports...
>
> ...But the crash log is weird and the solution is here:
> http://stackoverflow.com/questions/2605999
>
>
> 2) Call getActionBar() without explicitly requesting the ActionBar to
> show. [Flag as error]
>
> If you do this...
>
> protected void onCreate() {
> getActionBar().setDisplayHomeAsUpEnabled(true);
> }
>
> ...It will work on most devices. But a minority will crash at startup,
> because they don't show the ActionBar by default, so getActionBar()
> returns null. The correct way is like this:
>
> protected void onCreate() {
> getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
> getActionBar().setDisplayHomeAsUpEnabled(true);
> }
>
> Please add these checks to the Android Lint tool. 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+unsubscribe@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 4.4 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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment