Office Hours — Today, July 2

Tuesday, June 30

Jul 2
7:20 PM
Mark M.
has entered the room
Mark M.
turned on guest access
7:25 PM
has entered the room
Mark M.
hello, maredef!
how can I help you today?
Hi Mark
I have my custom keyboard and a non-editable EditText ...
Is custom view and it seems we need some standard behavior(s)
one is autoSizeTextType
other is blinking cursor
so I wrote a TextWatcher
that measures text
and if is too big
7:30 PM
1. modifies content.textScaleX
(content is EditText)
or 2. modifies textSize so it will fit
it works fine
until rotation
the view has Id
so it restores fine
I see the text in LayoutInspector
what happens is that autoscaler is calculating available space
and for rotation is 0
something like content.length
I am adding this textwatcher in a constructor of custom view
Mark M.
your saved instance state will not yet be applied by the time your constructor is called
7:35 PM
yes I think it happens later
avaialble space is calculated in textwatcher
so is fired after someones sets the text on this new instance
Mark M.
you may need to override your custom view's onRestoreInstanceState(), chain to the superclass, and then update your text scale at that point (as you should have the text by then)
I think it would be to early
content.width is zero apparently
and since textwatcher is called, someone is saving
*some is restoring state
7:40 PM
so. the problem is not that the text is empty or something
Mark M.
then perhaps use ViewTreeObserver.OnGlobalLayoutListener to find out when the custom view has been laid out, and at that point both register your TextWatcher and handle any text that you have at the time
because once the view has been laid out, you should have its size to use for your text-length analysis
ok will try it out
7:50 PM
seems to work!
Mark M.
seem the token is still mine :)
recently we released multiple apk
one for api level 16-21 and 22+
this 22+ was already in a market
so I just added the apk for old devices
and i am not sure if is related
7:55 PM
but go receiving and error like this
I don't see the message
is only Android 10
I am using androidxref for source
it does not have android 10 yet
Mark M.
except that line 3059 is blank
Mark M.
since device manufacturers change Android, line numbers do not always line up with official AOSP sources
I try to go more by method names from the stack trace, as those usually are consistent
Samsung, Nokia, OnePlus
if (creator == null) {
only this throws this Bad...
8:00 PM
Mark M.
what is the error message on the exception?
I dont' see it
Mark M.
that's a problem
where are you getting the stack trace from?
google play
console, Android Vitals
Mark M.
ah, OK, I and my consulting clients have always used something else, so I do not have direct experience with the one in the Play Console
but without that message, it will be difficult to determine what is going wrong
do you have any custom Parcelable classes?
yes @Parcelize
quite a lot I think
Mark M.
are you putting any of those as extras on an Intent being wrapped in a PendingIntent?
such as for a notification, or for AlarmManager?
yes notification
Mark M.
that is risky
btw the stacktrace does not contain anhything from our aopp
8:05 PM
Mark M.
you may want to consider the "convert the Parcelable to a byte[]" approach that I mention at the end of that blog post
ok will read that
Mark M.
in that Android 10 source, this problem would result in a BadParcelableException (among all those other cases)
the thing is
the app is pretty long on the market
this never happen before
and the recent release was re-release
Mark M.
perhaps Android 10 is unpacking the Parcel in scenarios where it was not doing it before
this is just one area where I know that we can get this exception in seemingly-safe code
I have more on this problem in *The Busy Coder's Guide*:
ok thanks for pointers
Mark M.
I had to apply this for my current customer's project, for this problem, earlier this year
so, it might not be the source of your crash, but it is worth trying
will just post a stacktrace
View paste (6 more lines)
  at android.os.Parcel.readParcelableCreator (
  at android.os.Parcel.readParcelable (
  at android.os.Parcel.readValue (
  at android.os.Parcel.readArrayMapInternal (
  at android.os.BaseBundle.initializeFromParcelLocked (
  at android.os.BaseBundle.unparcel (
  at android.os.BaseBundle.size (
  at (
  at java.util.AbstractList.hashCode (
  at java.util.Objects.hashCode (
  at (
  at (
  at (
  at$H.handleMessage (
8:10 PM
maybe it gives more clue
if not I am happy with the links
will have to digest it
Mark M.
unpacking a Bundle just for hashCode() seems excessive, but, I did not write this :-)
but this code should be running in your process, and the PendingIntent problem that I cited is a case where the crash really is in another process and triggers a crash in our own process through some IPC mechanism
ok thanks
Mark M.
LaunchActivityItem is tied into launching an activity (not surprising)
so, I would be worried a bit more about Intent extras for this case
but I do not know why you are not getting the detailed error message for the exception
8:15 PM
Mark M.
and that is really what you need to find out what is going on
I am not sure either
I think play console don't gather messages
none of the exceptions have them
Mark M.
that sucks
ok another thing
Mark M.
longer-term, you might want to consider using something else for crash logging (Crashlytics, your own hosted backend using ACRA as the collector, etc.)
yes would like to have crashlytics
ACRA would be an option too
one thing about designer/developer cooperation
we support lot of devices
the designs are usually for tall slim phones
8:20 PM
the question is what would be the best way to tackle that
Mark M.
tackle what, exactly?
excuse me
tackle design for smaller phones
1. expect each screen also for smaller devices
convince designers to have small phone by default
or expect sample screens for smaller phones
Mark M.
ideally, designers design around the smallest screen that your firm is willing to support -- usually it is easier to expand a small design than it is to shrink a large design
since that did not happen here, the simplest thing to do is to get a smaller device, test the app, take screenshots of where things are not fitting, and ask for updated designs that can take the smaller screen into account
some of your screens will be fine, and others will require some adjustment
8:25 PM
what I do is I create emulator that has size exactly as in zeplin/figma
then I can compare screenshot and export
Mark M.
I have it a bit easier, in that I have *lots* of hardware, acquired over the years
somebody might grumble that the emulator is not "real", so I try to test with hardware where I can
ok thanks for the chat
Mark M.
happy to help!
good night
8:30 PM
I am watching Jupiter and Saturn btw
one at a time ofc
Mark M.
enjoy the planet-watching!
and, have a pleasant evening!
has left the room
Mark M.
turned off guest access

Tuesday, June 30


Office Hours

People in this transcript

  • marekdef
  • Mark Murphy