Oct 27 | 7:25 PM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Oct 27 | 7:30 PM |
ani | has entered the room |
Mark M. |
hello, ani!
|
Mark M. |
how can I help you today?
|
ani |
View paste
|
Oct 27 | 7:35 PM |
Mark M. |
thanks, thanks, and thanks! :-)
|
ani |
Thanks for this platform, and what you have done for community :)
|
Mark M. |
I try to be useful!
|
ani |
View paste
|
Mark M. |
taking the latter part first, the Jetpack Paging component works with Room
|
Mark M. |
I have an example of it in *Elements of Android Room*, part of your Warescription
|
Mark M. |
that works well if your end target is to put the data in a RecyclerView
|
Mark M. |
if you want to do anything else, you may be better off handling it yourself
|
Mark M. |
in terms of your timestamp concerns, I am not certain what you mean by a "logical timestamp"
|
Mark M. |
for data in a database, we normally think of the data having lifetimes measured in days/weeks/months/years, so we cannot use something like SystemClock.elapsedRealtime()
|
Mark M. |
if you do not want to use the system clock as your time source, and your app needs Internet connectivity for other reasons, you could contact a time server and get a timestamp from it
|
Mark M. |
or, if your app needs location access for other reasons, you could get a timestamp from GPS fixes
|
ani |
I see.. sorry, I keep on getting thrown out of the chat by the system
|
Oct 27 | 7:40 PM |
Mark M. |
really? I'm not seeing that on this end
|
Mark M. |
what happens when it throws you out?
|
ani |
View paste
|
ani |
I switched the tab and when I switched back to this tab, I was logged out
|
Mark M. |
that's strange -- I have not heard anyone else report that problem
|
Mark M. |
in terms of your timestamp, if all you want is a sequence number, you could track that yourself in a separate table, incrementing it as you go and using that value when you insert/update your "real" entities
|
Mark M. |
while SQLite has its own ROWID, you are not guaranteed that they will be in chronological order
|
ani |
Row ID: I see, thanks
|
Oct 27 | 7:45 PM |
ani |
About my own counter: I was thinking that but felt I may be a little crazy for thinking that.
|
Mark M. |
it is a classic technique -- I think I first encountered it about 25 years ago
|
Mark M. |
frequently, it only works when there is only program writing to the database, but in your case, only your app should be writing to it, so you are OK
|
ani |
hahaha.. I bet it would be very interesting to hear you talk about similar stuff and stories that you would have
|
ani |
thanks Mark
|
Mark M. |
happy to help!
|
ani |
View paste
|
Mark M. |
SystemClock.elapsedRealtime() reports the number of milliseconds since the phone last rebooted
|
Oct 27 | 7:50 PM |
ani |
are you suggesting to not use "SystemClock.elapsedRealtime()" for the data lifecycle being long ?
|
Mark M. |
well, in a days/weeks/months/years timeframe, the phone probably reboots a few times :-)
|
Mark M. |
and that will reset the elapsedRealtime() counter to 0
|
Mark M. |
which is not what you want for your use case
|
ani |
ya, right
|
Oct 27 | 8:00 PM |
ani |
Here is another that you can suggest something fornif that is ok:
|
ani |
How would you go about changing the style on a button at runtime? I didn't find any API like setStyle..
|
Mark M. |
AFAIK, that is not possible
|
Mark M. |
you can adjust individual properties, and you can adjust the group of properties controlled by textAppearance
|
Mark M. |
but you are correct, there is no setStyle()
|
Mark M. |
this is one of the many annoying aspects of the View system that I look forward to getting away from once Jetpack Compose starts gaining momentum
|
ani |
Ah.. thanks
|
Oct 27 | 8:05 PM |
ani |
Airbnb has a library called Pairs that claims to handle this but that didn't work in my case either
|
Oct 27 | 8:10 PM |
ani |
I would like to bump this question up on Stack overflow, can you please take a look once you get a chance please: https://stackoverflow.com/questions/63692210/wh...
|
Oct 27 | 8:15 PM |
Mark M. |
well, that question does not have the source code that triggered the crash
|
Mark M. |
is this your question, or are you just interested in it?
|
ani |
That's mine too 😀
|
Mark M. |
The crash is coming from the Navigation component. If you are using the Navigation component to manage this DialogFragment, you would not call show() -- you would use a NavController to navigate to it
|
ani |
I don't have the source but I can create a hello world with just that if that would help
|
ani |
Makes sense, I try both ways to make sure that's it.
|
Mark M. |
if you have a sample project that demonstrates a DialogFragment that has nothing to do with the Navigation component, where the Navigation component then crashes... that is probably worth a post on the issue tracker, if nobody has reported it already
|
ani |
Sounds good Mark, you are the best.
|
Mark M. |
thanks for the kind words!
|
Oct 27 | 8:20 PM |
ani |
That's all I have for now Mark, stay safe and take care. Thanks again.
|
Mark M. |
you're welcome!
|
Oct 27 | 8:30 PM |
Mark M. |
OK, that's a wrap for today's chat
|
Mark M. |
the transcript will be posted to https://commonsware.com/office-hours/ shortly
|
Mark M. |
the next chat is Thursday at 8:30am US Eastern
|
Mark M. |
have a pleasant day!
|
ani | has left the room |
Mark M. | turned off guest access |