Be programming Android

>be programming Android
>want to communicate with a server
"Oh, I'll just use a socket."
>fails miserably for no reason whatsoever
>search info online. Turns out you cannot do any networking on the main thread, so you've got to shit threading code for ANY networking operation.
*sigh* Ok.
>got it working
"Now I'll just update the UI from the network thread."
>doesn't work
REEEEEE FUCKING CHRIST WHY
>turns out you can only update the UI from the main thread. You better be ready for passing messages through a Handler or some other horrible bullshit, bro!
Jesus fucking Christ, I cannot believe just how COMPLICATED Android's bullshit is. It's a fucking mess. There's no clean way of separating business logic from UI logic. You've gotta use threads for even the most basic of tasks, there's always 3857 different ways of doing stuff, and each one of those ways has its own little quirks and complications. How the FUCK do you learn properly this piece of shit platform? The API is just a gigantic mess and Google's tutorials/examples are useless. Thank fucking God for pajeets and StackOverflow, otherwise I would have already killed myself.

Attached: 1486621936979.png (601x595, 309K)

Other urls found in this thread:

stackoverflow.com/a/9289190
stackoverflow.com/questions/11140285/how-do-we-use-runonuithread-in-android
twitter.com/SFWRedditGifs

>try to write blatantly garbage code
>platform stops you
>reee what the fuck just let me be retarded!
Any programmer with a brain writing graphical software knows not to do blocking tasks on the UI thread. Stop throwing a hissy fit about not being allowed to write code like a dumbass pajeet.

>>search info online. Turns out you cannot do any networking on the main thread
Source?

>software platform enforce basic programming hygiene
>schizo goes to gee and complain
Every time

You can't do raw socket stuff in the main thread so op is just partially shitposting

>doing anything on the main thread
Dumb frogposter, you're the reason applications stutter.

>There's no clean way of separating business logic from UI logic

sure there is. use that fucking handler you just glossed over. it's java you moron. you can separate every fucking tiny event if it stops you from having panic attacks.

Seems like you can, though: stackoverflow.com/a/9289190
It would lag the shit out of your UI but it seems like it would be possible, which would make OP an even bigger retard than he already is.

Why in the fuck would you shit up your fart app with code that freezes the UI? You don't deserve an IDE. You use a stick until you know better.

You are actually retarded. For IO processes that block you do NOT want to run that shit on a thread that is in charge of the UI/UX

Why would you want your entire app to block while you wait for response from the server on the main thread?

bcuz synkronus code is eazer to writ lmao nerdss

Attached: ___.gif (498x359, 408K)

>cucks have to use stackoverflow to develop for their platform
how is your wife's son doing

Attached: 1565055544802.png (960x1040, 34K)

Brainlet...

this is exactly why we need rust

You could disable strict mode, that will let you run long running tasks on the UI thread, but you really shouldn't because your interface will lag like fuck.

import socket
s = socket.socket()
s.bind(('',1337))
s.listen(1)
(r,z) = s.accept()
print("OP is a faggot", r.recv(999))

yo wtf, I could've sworn OP originally said python. Why the fuck would you want your application literally frozen while it goes to perform some networking task?

probably because it's not an interactive part of the application

>networking on the main thread
Internet lags, interface also lags.

PAJEET TIER PROGRAMMER.

Are you just pretending to be retarded?

no, imagine you enter a mode where you download something and the user waits on it. the only thing you lose is the ability to cancel the download.

>download something and the user waits on it

No progress bar.
User probably thinks the app froze, user closes the app, and open again, goes to the same mode, thinks app freeze again.
User gives 1 star because the app freezes all the time.

Retard

>writing native Android code
>in Java
>in 2k19

React Native more, faggot

I don't actually make software for morons

Of course a thread like this would be on g. Only fucking retards would want to freeze the ui thread by stuffing it with shit that should be in the background.

Use this nigger and get of my board
stackoverflow.com/questions/11140285/how-do-we-use-runonuithread-in-android

You probably could even do fairly well with libraries which built on top of asynchronous I/O (java.nio), but for the most part you will end up with a mess similar to single-threaded Windows installers which go faster when you jiggle the mouse or stick a key because it keeps the message queue filled and the main event loop running.

>going for the low-hanging fruit
You're missing the point, retards. I know it's not proper to have blocking operations in the UI, I just wanted to quickly prototype some bullshit and the fucking platform got in the way. Besides that's not my main complaint. Google documentation SUCKS. Their own examples and tutorials are outdated as fuck. You literally cannot compile their shit examples without the compiler throwing a million warnings about deprecated packages or some other bullshit (boy, don't even get me started on what the average stacktrace looks like: a single faulty line of code can produce 120 errors, 1 of which is yours and the rest is the rotten Java/Android stack mess). AndroidStudio is a fucking bloated piece of shit. I hate how complicated simple stuff is. I hate the retarded UI designer, which basically makes editing XML manually a necessity. Wanna arrange some simple widgets? Well, FUCK YOU NIGGER, you better be prepared to learn a couple of different layout modes with completely different semantics for height/width/etc. Wanna change some widget color? Well fuck you, you better create a fucking resource file bro :^). It's all so fucking quirky and annoying. I just wanna have a simple item list that isn't laggy as fuck, why the fuck do I need to use a fucking RecyclerView (great name, retards), inherit (BOY, you're gonna be inheriting shit out of your ass every two lines of code) from two or three different classes, making me either a) have a lot of small independent boilerplate bullshit classes, b) littering my actual useful code with inner classes (and before any of you retards says something, I have all of this stuff already working properly). God, I miss the simplicity of C.

>React
Kys, you're the reason apps nowadays are pieces of shit

What about
> MUH FLUTTER
?

>using java

Really brought it on yourself mate. I imagine there has to be better jvm languages that work on android and I'd imagine the more modern ones have a functional event loop implementation to hide most of those asynchronous workloads you expect to accomplish.

All of these things are true and precisely why I use shit like react native. Webview is easier to cope with than half that java pajeet tier shit honestly. Its all too tedious.

Well that's to be expected from an OS for poorfag phones

protobuf-lite you fucking degenerate faggot

Just write your networking code in an AsyncTask and write a callback method in the UI thread.

My nigga

This is why only pajeets do Android.

This is precisely why Google is developing a new OS.

Android is fucking J2EE crap and it must die

of course you can only update UI from the main thread, that's what it is for. of course you can't do networking on the main thread, you don't freeze the fucking app to wait for network operations. are you literally 12?

>>fails miserably for no reason whatsoever
because you're a shit programmer
>Jesus fucking Christ, I cannot believe just how COMPLICATED Android's bullshit is.
it's kinda easy if you're not dangerously incompetent. even the dumbest of pajeet and commie android developers have figured how to communicate to a remote server. you? absolutely fucking useless, even with the internet at your fingertips.

>AsyncTask
Wew, what a great fucking advise.

OP, if you want easy concurrency use Kotlin coroutines. If you want easy RecyclerView use Epoxy. For the database use Room. Or just fucking switch to Flutter if you want to only prototype your shit.

>>turns out you can only update the UI from the main thread. You better be ready for passing messages through a Handler or some other horrible bullshit, bro!
BullshitClass bullshitClass = new BullshitClass(getApplicationContext());
You could also create the TextView and ImageView in your Main Activity and pass them to the class.

Not that you should do that, but it's trivial to do.

java isn't even the standard for android anymore, its kotlin now and has been for some time.

>installers which go faster when you jiggle the mouse or stick a key because it keeps the message queue filled and the main event loop running
jfc I thought I was going insane whenever this was happening to me and everyone I told about it was too incompetent to even notice. Thanks for explaining that.

>retard cannot into the actor pattern

Thanks for this post, it made me kek. You are an incompetent programmer.

>what is RxJava
>what are courotines
>what are design patterns
I agree Android is overcomplicated in so many areas but you sound like you just want to put all your shitty code in MainActivity and expect not to lose your sanity. Sounds like you're bad at programming, not bad at Android.

xcode doesn't have this problem!

Xcode is shit compared to Android Studio.

>simplicity of C
Top-tier bait.

you are fucking retarded op and you fundamentaly dong know how android programming works if you think that you actually have to do that shit.

This. It's like freshman level coding. I hope op is learning android for the first time and it's his first week.

Also
>complaining about the platform enforcing good practices
Yikes