« first day (2621 days earlier)      last day (2552 days later) » 

user6754053
00:23
I'm working on handling runtime changes in my application. There are some globals I need to keep during the Activity being destroyed and recreated. The information I've found so far suggests that I use a singleton class to hold them. Is that a good idea?
that or add them as constants in your Application class
user6754053
@DaveS From what I could tell the Application class can be destroyed and recreated at any time by Android while the app is in the background.
Anything you need to persist through the app life cycle should be kept in local storage like SharedPreferences or a Database
user6754053
@DaveS
user6754053
00:29
It's an Object.
Anything you need to persist through the app life cycle should be kept in local storage like SharedPreferences or a Database
what you're proposing is a forced memory leak to save your global variables and that screams terrible idea and bad design on just about every level
figure out how to represent that data in local storage and read/write to it on start up etc
user6754053
@DaveS The data can be destroyed once I close the application. Am I supposed to be keeping things like that in a database?
user6754053
Sorry if this sounds basic, but I'm fairly new to Android programming, coming from standard Java.
Shared Preferences is probably what you're looking for
you can save key value pairs locally to the device
you also don't need to ping me everytime before you talk
user6754053
Sorry. :)
00:33
np =p
user6754053
A singleton class would normally be GCed when the app is closed, right?
user6754053
So if the only reference to it was held in the Activity, it's contents would be lost.
user6754053
Thus if I were to use it, I would have to declare the variables static.
user6754053
Am I getting this?
00:35
and you're getting into really bad practies
singletons have their place but persisting data is not it
they can be used, however, as a single data store when the app is active
user6754053
So if I don't need to persist data through different launches of the app, then a singleton is OK. Otherwise, I should use SharedPreferences.
If you have a large amount of dynamic data you want to store this in a database solution, SQLLite is pretty easy to get going on Android and there are lots of libraries for that
If you have a few key value pairs you want to stick around no matter what, unless the app is uninstalled, sharedprefs
user6754053
The issue is that it's hard to convert my Object to a String. It has lots of different fields.
Write a function that does it for you
you can use a key/value pair for every field
mySharedPrefs.getString("memberVariable1");
etc
user6754053
Can I serialize it?
00:38
Sure
user6754053
I think that would take care of it, provided that all the fields were Serializable
You only need serializable if you want to use serialize interfaces
user6754053
I'll have to look into this further, it seems that handing the whole lifecycle thing is complicated.
user6754053
I'm thinking that I can serialize it to a byte array, dump that into a String, store that String in SharedPreferences.
sure but I would wonder why you have a shared pref so complicated
the use case seems to be fighting the Android eco system
user6754053
00:41
This is coming from an emulator library I am using.
user6754053
It has an object for the CPU, and I need to store the state somehow.
user6754053
On pure Java, there's none of the Activity restart logic, so I didn't have any issues.
user6754053
On Android, however, it makes it a lot more complicated.
I see
user6754053
That's why I feel a singleton is suitable for the job. It only needs to last until the application is closed by the user.
00:43
If it only needs to last until the application is closed, the application class is less likely to cause a memory leak than singleton refs everywhere. Your singleton can be killed in the background just as easily as the application class
user6754053
@DaveS But when another app comes over top, the Application class can be destroyed even if the Activity isn't.
I don't believe that to be true
user6754053
Which brings us to the core of the problem: The application object will not stay in memory forever, it will get killed. Contrary to popular belief, the app won’t be restarted from scratch. Android will create a new Application object and start the activity where the user was before to give the illusion that the application was never killed in the first place.
user6754053
I have to go now, but that article seems to have a differing opinion.
00:46
ah
user6754053
Thanks for your time. It should really help.
but what you're missing I think is the activity is also destroyed
user6754053
I see.
user6754053
So the Application class and Activity class will go down together
yes
user6754053
00:47
Which will defeat the purpose
user6754053
OK, so using the Application class is out of the question
and a singleton for the same reason
user6754053
I will look into SharedPreferences more.
^article to turn a POJO into JSON using gson
and store in shared prefs
01:07
o/
and on that note, good night all!
also o/ cM
Good night, Dave!
Glad we could have this talk
Stimulating as always
indeed
I feel like a better person for having it
 
5 hours later…
06:16
lol
o/
@DaveS finally received email reply
 
1 hour later…
07:26
just incase i can't login until after christmas
merry christmas from Useit Software S.L. and myself to all of ya.
merry christmas eric
Gooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo‌​ooooooooooooood Morning Everyone!!!!!! :D
SHE'S BACK
fires beacons
@MarkYisri you can use kryo for compact serialization (it is really good if you use it right) and if you need a string result, the result can be encoded trivially (base64, or ascii85, etc)
07:39
json is passable in most cases but it's not really compact for many kinds of data
json is as compact as the data it holds
it's literally a string.
07:57
wow whole line complete womp
had it been one more "o" it would have been in 2nd line :D
yeah json is good
08:10
Hiya CF!!!!! :D
whatsup catalans?
08:33
o/
user443346
08:46
o/
Hiya Cygery, Jordy, Warren!!!!! :D
user443346
Do you ever feel like killing yourself the first hours at work?
user443346
Well, I do every single day.
09:08
D:
user443346
Suicidal mode off, had my 2nd cup of coffee.
lol
yo jordy
user443346
morning o/
09:25
@Jordy :/
09:55
o/
Who dares message me?
@CptEric who?
10:07
@RaghavSood is that a rhetoric question?
Naturally
@netpork can't believe that guy has a few embedded GPUs :D
Is it possible to pass a generic object as an argument without it being in a Collection?
for example I want: ? extends TextView because I want to be able to pass either a EditText or a Button
10:19
extends View
oh Button is actually a child of TextView didn't know
Yep
Also there's no View.setText method unlike TextView
Use T instead of ?
Doesn't seem to work
Doesn't recognise T
10:25
<T extends TextView> void stuff(T view)
@WarrenFaith german banking office employee that spent 6 months counting 2.6M frank cents
Ah so you need to add the <T extends TextView> before the void?
If it's only for the method, yes
never heard of him
@TimCastelijns thanks Tim, was wondering why I couldn't use void testMethod(<T extends TextView> view)
10:27
@MarkO'Sullivan it's called the introduction of the type. You have to tell the method what T is or it doesn't know
your method works for ? but not for T
Na it showing this error hint message when using ? wildcards may only be used as reference parameters
@TimCastelijns never knew that, so I appreciate the lesson! Thanks
What about in the case you want to return object <T extends TextView>?
oh yea for collection
change to <T extends TextView> T stuff(T view)
Ah brilliant
Thanks
after the introduction, T is a reference to whatever you introduced it as
10:32
Okay I'm glad this was possible, I wasn't sure if it was only possible to use generics for Collections
anything is possible as long as you believe in it
It being Realm right? :D
I can't comment on that m8
man eating those xmas biscuits is giving lot of kcals
10:39
eveyrthing is possible in the Realm
oh man it would be so awesome that Realm had monarchy types as codenames
Realm X.Y "Feudal Despotic"
Realm X.Y "Elective"
:P
eric did you see realm 3.0 for ios has native types supported in realmlist
i don't use realm anymore lately.
there's no realm for javascript
so :/
LMAO, look at the new undercover vehicles from the special forces in germany i.redd.it/n6e67tbvoo401.png
there is for react, and for node
user443346
I've been reading the last 20 minutes about CharSequences and it's purpose however every explanation is vague.
10:44
@TimCastelijns fake news. node is just for server side, and react is a micro subset of javascript.
yes, and ok
Hi guys. Maybe someone familiar with Bluetooth Low Energy? I've built an application, but struggling with one stupid issue.
there's no way i can use realm and JS on front end or on a web app or a hybrid app
hence, it's like it didn't exist.
@Jordy in summary, don't use it unless you are given one by some external method
user443346
^ that's the case
user443346
10:45
public boolean onSelection(MaterialDialog dialog, Integer[] which, CharSequence[] text) {}
just call toString on it and continue as usual
user443346
Did that aswell but it just shows me Ljava.lang.CharSequence;@7a63fc4
@SaQada oh no you said the BLE word
@MarkO'Sullivan yep :)
" So Realm isn't designed to be embedded in a browser - Chrome would need to ship with Realm Core in order for this to work"
@Jordy you using the material dialog library
WHY NOT BUILD REALM CORE FOR JS?
what's the point of it then?
what do you mean "shows me"
Jordy that's an array of charsequences
user443346
@TimCastelijns The .toString()
10:49
what murat said
user443346
@MuratK. Exactly
@MarkO'Sullivan did you work with BLE ?
I don't understand the problem
user443346
Well, I don't understand how to iterate through the charsequence array
7
for each loop?
10:50
bro you don't know how loops work, is that it
@SaQada yep, so did @TimCastelijns and @codeMagic (I think)
user443346
I do, but it doesn't work :')
... xD
try harder
show code, it is wrong
10:51
lol
we will fix this
Is it already weedkend for him? :D
user443346
It looks like it
user443346
Had to delete it tho, otherwise Warren kidnaps me
I don't think you can create an iterator out of String
37
Q: Why doesn't the String class in Java implement Iterable?

user333335Many Java framework classes implement Iterable, however String does not. It makes sense to iterate over characters in a String, just as one can iterate over items in a regular array. Is there a reason why String does not implement Iterable?

so a for each loop is not possible
user443346
10:54
^ thanks for that answer tho, now I don't look like a rookie
why do you want to loop over the string
it's an array of charsequences
but should your ide not have told you that
@MarkO'Sullivan sounds nice. then I hope some of you can help. My question is how to get UUIDs of services and characteristics in a way that we can say that this characteristic is contained in this certain service.
user443346
What the actual fuck, I clean -> rebuild, try again and it works.
10:56
what works
(╯°□°)╯︵ ┻━┻
user443346
The loop
user443346
Calm down Tim, don't flip your desk
I didn't see the message you deleted
no
foreach with string is not possible
10:57
no one is talking about strings
it is if you toCharArray it
user443346
For you Tim, I'll delete soon.
welp here we go
i'll open the worm can.
> Cordova
> Ionic
> Realm
sounds all pretty shit
good luck
user443346
11:02
@Ahmad Remove Realm please
meh it's just a comodity
i don't need it but i'd love to be able to use it
user443346
"Well, I don't understand how to iterate through the charsequence array", this seems pretty stupid right now. If I ask to unstar it because it shames me, it might get starred 16 times.
6
@Ahmad Ionic is actually a pretty cool platform, ktolin/swift -ish syntax (typescript 2.5), lots of plugins / libraries that add native functionality...
@Jordy just use a normal for loop
11:15
@SaQada not sure, why you wanting to do that?
I'll open the worm can again
@SaQada this might answer your question: stackoverflow.com/a/38826580/2411667
@CptEric it's javascript
so no
typescript
Is there a material calendar icon?
11:24
yeah
it looks like a, uhm, calendar.
this is what i got
the 2nd
the first is for an event range
1st is for date range, 2nd for event
why no calendar Google
bc standards are for poor.
I remember when the web front was much easier, when you only had to include jquery UI and have a calendar ready XD
11:30
xD
JQUERY solution to all your query
and that's true! :D
jquery sucks
why?
$('cause');
11:37
Well that's messed up
hardly surprising lol
user6754053
@SargeBorsch Kryo sounds interesting. I think it might do for my purposes!
@SaQada did it help?
12:03
@ColdFire LOL
@MarkO'Sullivan sorry, I had to leave for some time. let me see what is there
@MarkO'Sullivan I'm aware of BluetoothGatt.getServices(), Problem is that it returns not only services but all together ingluding characteristics and descriptors
Lol
And they say that Face Id is safer than finferprint
Fingerprint
nothing is safe.
dickprint is the future.
0_o
that would be gender discrimination tho
okay. nippleprint then
12:10
that would be offensive to some
why?
yes, the ones who had a mastectomy
for god's sake
noseprint
and fuck voldemort.
12:11
lol
easily changeable with plastic surgery
not secure enough
bloodPrint
you cut your hand to unlock phone
lol
Retina Scan
?
12:13
too complex
and what if i wear glasses?
what if glasses are dirty?
blood is the best way
Then remove your glasses and throw them out..lol
boodritual
with nano seringues, this way users don't bleed
@SaQada no idea how you'd split them sorry
lickPrint
you have to lick the screen to unlock it.
yess master/mistress, lick up to unlock (gender voice choice-able)
12:17
Guys without using Shared Preferences and Android SQLite how do apps like Uber maintain session ?
easily hackable if someone drools on his pillow
@MarkO'Sullivan I'm sure there is way to do it. at least nRF Connect app (you can find it in Play Store) can do this
@MehdiB. but what about the fun ov everyone giving a job to their phone screens?
@MarkO'Sullivan thanks for your effort to help me
Eric XD
12:23
@AdamMc331 having a pixel phone is unfair to other phones.
it's like a ferrari compared to our other test devices
or our client devices.
eveyrthing loads fast.
@SaQada yeah I've used that app on multiple occasions lol
user443346
@ColdFire Hahahah oh man, this is so wrong
@BatCat bearer tokens maybe?
API download to find out if the existing token has expired or not
@MarkO'Sullivan Uber does not use AccountManagement nor shared preferences nor SqLite db
they probably use realm
12:27
^
@BatCat how you know they don't use any of these things?
Uber uses a .txt file and a lot of threads.
given how the app behaved in my old phone
</sarcasm>
I have a rooted phone and checked their Android SQLite DB's and Shared Preferences..looked through all of them none of them belonged to them
goddamit that was fucking fast
my chinese bought package is already in spain
Uber did not appear under Accounts in Settings so they use none of them
took just 3 days
12:33
@TimCastelijns How did you come to know about this ?
guess based on your comment
Oh ok.
I created a question https://stackoverflow.com/questions/47887029/bluetooth-low-energy-ble-how-to-get-uuids-of-service-characteristic-and-des

If you will have any idea or remember something, please put some note there. Thank you.
opinions are like assholes, everybody has one.
why so much hate for the new star wars movie?
user443346
7,8/10 @ IMBD, can't argue with that logic.
12:41
i mean the public ratings
cinemascore is fine, it's an A, like the past
(8/10)
but rotten tomatoes fan score is 60%-ish
user443346
I stopped watching Star Wars 5 years ago
user443346
Scratch that, 10 years ago
time to lunch
user443346
12:47
@MarkO'Sullivan @TimCastelijns How can I get the index from Realm results?
@Jordy welp not apple's fault when you have millions of people looking similar
user443346
^ thats racist
user443346
@TimCastelijns Well since Realm makes relationships with the indexes. I also need a index in this case.
@CptEric one should test on a lousy samsung or huawei device :)
12:49
"Realm makes relationships with the indexes" what does this mean
user443346
Well can't describe it any more clearer than that.
user443346
You know what a index is right?
user443346
doesn't belong to realm. Stetho adds it
user443346
12:55
The relations between 2 tables also uses it so that doesn't seem to be true
user443346
user443346
I believe that but the index does gets used inside the other table, as you can see in the 2nd image.

« first day (2621 days earlier)      last day (2552 days later) »