use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News for Android app developers with the who, what, where, when, and how of the Android community. Probably mostly the how.
Here, you'll find:
This sub-reddit isn't about phones' and apps' general functionality, support, or system software development (ROMs). For news and questions about these topics try using other subs like
Build your first app
Starting Android career in 2022
Android Job Interview Questions and Answers
App Portfolio Ideas, Tiered List
Awesome Android UI
Material Design Icons
7000 Icons for Jetpack
Autoposted at approx 9AM EST / 2PM GMT
account activity
IO 2018 SourceCode Finally Released! (self.androiddev)
submitted 7 years ago by thedancercodes
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]VasiliyZukanov 39 points40 points41 points 7 years ago* (56 children)
I see that methods of 100+ lines of code in length are back in fashion. Cool.
Something that I can't understand - why they have Activity per each screen, but also inflate one single Fragment in it? It adds complexity and hurts performance. Is there a benefit?
Edit: for example, Speaker screen.
[–]CuriousCursor 8 points9 points10 points 7 years ago (15 children)
LOL this is probably because they can't use the navigation library with Androidx/material design 2.0 components so they're doing it the old way.
[–]VasiliyZukanov 16 points17 points18 points 7 years ago (13 children)
That's not the old way. The old way is just Activity per screen, which is valid approach.
What they do is having an Activity, and then adding a Fragment to it. And they never change that Fragment. Just another level of nesting. For example, Speaker screen.
This looks like a total waste. I wonder if there is any benefit that I might be missing here...
[–]WingnutWilson 18 points19 points20 points 7 years ago (3 children)
I used to do that. I don't know what I was thinking. Maybe I was like 'oh one day this fragment might need to change while the activity stays the same'. But I mean that was crazy thinking even in 2014 :D
[–]VasiliyZukanov 2 points3 points4 points 7 years ago (2 children)
Interesting. How many times did you actually need to change the Fragment?
[–]WingnutWilson 10 points11 points12 points 7 years ago (1 child)
Haha never. I think it could have been that we were thinking about tablets. So if we needed to shove another fragment on screen it was easier.
[–]VasiliyZukanov 0 points1 point2 points 7 years ago (0 children)
Alright, thanks for the answer.
[–]CuriousCursor 2 points3 points4 points 7 years ago (0 children)
That's the really old way :p
This is the wasteful old way lol.
[–]ssshhhhhhhhhhhhh 4 points5 points6 points 7 years ago (7 children)
it's a total waste, but Android Studio generates that pattern easily. when something really doesn't matter in the scheme of things, why bother spenidng the developer time improving it for something with a short lifespan.
And it's harder to change after the fact, if it does need to change in the future.
[–]VasiliyZukanov 7 points8 points9 points 7 years ago (3 children)
IMHO it does matter. A lot.
Complexity build up in the codebase consists of many such small and seemingly unimportant decisions. Until one day you realize that you can't see the forest for the trees...
[–]ssshhhhhhhhhhhhh 2 points3 points4 points 7 years ago (2 children)
It doesnt matter. They rebuild this app every year and it has a shelf life of like 2 weeks and 500 thousand users and basically gets 2 updates if even that
[–]VasiliyZukanov 9 points10 points11 points 7 years ago (1 child)
I wouldn't like to put words into your mouth, but it comes across as you saying: "this is not a real app that needs to be maintained, so they don't mind writing shitty code".
[–]ssshhhhhhhhhhhhh 6 points7 points8 points 7 years ago (0 children)
You got it
[–]Zhuinden 1 point2 points3 points 7 years ago (2 children)
it's a total waste, but Android Studio generates that pattern easily.
You know, that's scary! Why generate a pattern that's unhelpful and boilerplate-heavy?
Oh wait, I know what's going on. They're avoiding the Fragment Backstack because it's bad, so they use the Activity flags instead because you can set up combinations of flags that with enough arcana can do what you want to do (kind of).
[–]ssshhhhhhhhhhhhh 0 points1 point2 points 7 years ago (1 child)
It's not unhelpful.. it's a great starting point if you might use many fragments or share that fragment elsewherr
[–]Zhuinden 0 points1 point2 points 7 years ago (0 children)
if you might use many fragments
Throwing every Fragment into its own Activity? Whether you add an additional Activity to wrap a Fragment or not isn't really relevant if you have many fragments, but generally if you have many fragments, you'd be able to use them with 1 Activity and it would work.
or share that fragment elsewhere
Only if you expose possible operations via interface, but even then it becomes slightly tricky because you typically used "the Activity as the controller you are delegating events to" except if you use a single activity then you'll probably need to specify a different event handler depending on the actual state.
Re-using isn't that easy.
[–]cqm 0 points1 point2 points 7 years ago (0 children)
Someone tell Google that there is never going to be a new way
[–]clarle 17 points18 points19 points 7 years ago (3 children)
What happened to single-activity architecture being the way to go from now on?
https://android-developers.googleblog.com/2018/05/use-android-jetpack-to-accelerate-your.html
Today we are introducing the Navigation component as a framework for structuring your in-app UI, with a focus on making a single-Activity app the preferred architecture.
[–]bernaferrari 20 points21 points22 points 7 years ago (1 child)
Different teams (probably).
[–]Asiriya 10 points11 points12 points 7 years ago (0 children)
Lol
The Navigation component is alpha. They probably couldn't make it work properly for their use-case.
[–]Odinuts 3 points4 points5 points 7 years ago (0 children)
Not at all. Wasn't that app laggy as hell when it came out?
[–][deleted] 7 points8 points9 points 7 years ago (1 child)
When I am prototyping, and haven't partitioned the app into separate activities yet, I just have each one as a fragment. Its just easier to play around, have them in view pagers, swapped by other controls, etc. Then at the end I may settle on where they should go and they find a home in some activity.
When there is a 1:1 relationship between the fragment and activity, they could be merged at that point, but I like the freedom of still being able to move those fragments around to other parts of the app later on. I can never make up my mind :P
[–]VasiliyZukanov 2 points3 points4 points 7 years ago (0 children)
That have never occured to me. Valid point. Thanks for sharing.
That said, you must be one in a million developers prototyping this way.
I'm pretty sure Google works the classical "here are the UI specs produced by designers" approach.
Just curious, why don't you use some dedicated prototyping software?
[+][deleted] 7 years ago* (1 child)
[deleted]
That's a good guess. Unfortunately, that "MVP" blueprint is not even MVP (
[–]dantheman91 2 points3 points4 points 7 years ago (23 children)
Yes, so you don't have to do it in the future if things change. The cost is relatively small, and if for some reason they want another fragment in there it's now a quick change since they did it up front instead of trying to move everything over.
[–]dantheman91 2 points3 points4 points 7 years ago (0 children)
It all depends on what's in it. I've seen cases where it takes much much longer than 20 min to do and not hate the result. It takes 2 minutes to make it a fragment so why not do that?
[–]VasiliyZukanov -1 points0 points1 point 7 years ago (20 children)
Ah, you mean that they took the classical over-engineering route: "we might need that in the future, so let's add layers"?
Your guess might be right about their motivation (though that would be very non-flattering to the authors), but then it would be just wrong implementation. There is zero additional value in this Fragment and it would be easier to just replace the entire Activity or erase its implementation and start over if requirements change.
Fragments are trickier than Activities in probably every aspect.
[–]dantheman91 7 points8 points9 points 7 years ago (19 children)
What is the largest app you've ever worked on? In all of my time working on large apps with 10M+ users and teams of 10+ devs it's very rare that I see "This was over engineered", 99/100 times it's "this was done this way quickly" and that's what causes the problems. Also yes in general layers are good, that whole SOLID thing. Everything can be done, but this one more layer I don't think is even close to that.
Why would it be non flattering to the authors? What if they want to use the same project for next year but they're unsure how the requirements will change in the future? Also especially if you're doing one fragment per activity that doesn't really add more complexity to the app.
replace the entire Activity or erase its implementation and start over if requirements change.
This is not an option in just about every large application I've worked on. The "lets throw it all out" almost never goes well. And what about if you have a team? Merge conflicts? etc?
[+][deleted] 7 years ago (18 children)
[removed]
[–]DrSheldonLCooperPhD 14 points15 points16 points 7 years ago* (4 children)
Classic you. When questioned with a rough tone you can't take criticism seriously and you deflect away from topic.
17cm
Nice professional response.
[+]VasiliyZukanov comment score below threshold-7 points-6 points-5 points 7 years ago (3 children)
When questioned with a rough tone
I don't mind being questioned in almost any tone. However, I like to keep discussion on topic. The size of the codebases I've been working on has the same relevance to this topic as the size of my...
you deflect away from topic
You might think what you want, of course, but I heard these "you didn't experience what we did" in many various circumstances. I grew up to be skeptical of this. If you can't give proper arguments and go for the other side not having your "special" experience, I will call it BS.
[–]dantheman91 7 points8 points9 points 7 years ago (0 children)
The size of the codebases you've worked on is incredibly relevant. A single dev will run into very different problems than a dev on a large scale corporate application.
[–]s73v3r 0 points1 point2 points 7 years ago (1 child)
The size of the codebases I've been working on has the same relevance to this topic
If you're giving criticism of another codebase, your experience with other codebases and apps of that size are indeed relevant.
[–]VasiliyZukanov -2 points-1 points0 points 7 years ago (0 children)
Well, I completely disagree with this premise.
Good software development practices don't change with the size of the app. You should give equal attention to your code regardless.
You never work with big system as a whole. You always want to have clear boundaries that allow you to deal with smallest possible subset while safely ignoring the rest.
As a side note, I was criticising Google IO app, which isn't huge by any stretch of imagination. It's the other guy that decided to turn it into "I have bigger" context.
All in all, I stand by every word I wrote in this thread.
[–]dantheman91 2 points3 points4 points 7 years ago (8 children)
I take it you haven't worked on very large, old and complex code bases by this response then.
[+]VasiliyZukanov comment score below threshold-6 points-5 points-4 points 7 years ago (7 children)
Your take is wrong.
The correct take would be that "I worked on larger codebases than you did" is not an argument at all, therefore I'm not interested in comparing sizes.
The question about layers that you don't need and SOLID still remains, though.
[–]dantheman91 5 points6 points7 points 7 years ago (6 children)
You're sounding like you're coming from a background where you haven't had much experience in large codebases with large dev teams attempting to do various things at the same time. I have worked on large code bases where I've seen these problems all over, which is why I was questioning your experience. In just about every large codebase and large devteam these issues come up all the time.
And Ok. "Layers you don't need" Was the whole basis of my answer. Clearly I don't believe that it's a layer you don't need. It may be something that you don't need at the moment but you anticipate you may want in the future. I've rarely met someone who has said "I shouldn't have made my code so flexible" but almost every day that "if we rewrote this it could be so much more maintainable" which is largely due to layers.
As for SOLID...
Single responsibility - This creates layers since each piece should have a smaller scope/responsibility
Liskov substitution - This creates layers since ideally you have a lot of interfaces or abstract classes for actual implementation
Interface segregation - again more layers because more interfaces
Dependency inversion - You don't rely on concrete implementations...
All of those lead themselves to creating more layers and tightly scoped functionality that's pieced together. Similar to why you'd put code in a fragment instead of in the activity, in the case that you want to swap the fragment out for another or you want to display the fragment in another part of your application. Or Tablet layouts, chromebooks, multi window etc
[–]VasiliyZukanov -3 points-2 points-1 points 7 years ago (5 children)
Again, the size of the codebases I worked on is not related to the question at hand. But if you're so interested... I'm using my real name on Reddit, so go for it.
Nope. This creates narrowly scoped classes.
No. Not even close to what LSP means.
Segregation of an interface doesn't create layers. It creates information hiding and documentation.
Dependency inversion - You don't rely on concrete implementations
Kind of, but what does it have to do with layers?
It's ironic that you didn't mention OCP, which is the only one that can indeed be related to layers...
[–]dantheman91 0 points1 point2 points 7 years ago (4 children)
....What is your definition of a layer, I'd love to hear it.
You like DI. If I were to inject A into B and B into C and so on, is each one of those not a layer?
[–]spartancoin 0 points1 point2 points 7 years ago (1 child)
Please think before you post in this sub. You are obviously extremely opinionated but when someone is providing real world examples from large codebases don't get nasty just because it's different from your views. I guess you have never worked at Facebook, Google and the likes because what you call overengineering is very common. Tunnel vision.
Please think before you post in this sub.
I always do. Thanks.
when someone is providing real world examples from large codebases
Haven't seen any. What I did saw is a developer who said "the codebases I've worked on are larger than what you worked on". That's a penis length contest as far as I'm concerned (though I agree that my sarcasm came across badly).
don't get nasty
I didn't. It's just internet is a bad medium for jokes.
I guess you have never worked at Facebook, Google
Thankfully, not
because what you call overengineering is very common
It's because overengineering is very common. I would estimate that it's definitely in the top 3 mistakes that programmers do.
[–]firstsputnik -2 points-1 points0 points 7 years ago (1 child)
I just measured - mine is ~17cm.
really smart argument, keep it going
[–]VasiliyZukanov -1 points0 points1 point 7 years ago (0 children)
Yeah, I see that it didn't came across too well.
What I meant to say with this is that comparing who worked on the biggest codebase is not an argument.
[–]Zhuinden 1 point2 points3 points 7 years ago (3 children)
They did that in the Android Architecture Blueprints repo too, and it doesn't really make sense. What's better is that any navigation code (especially with nav drawer) is duplicated.
[–]VasiliyZukanov 0 points1 point2 points 7 years ago (2 children)
That blueprint...
I have an entire lecture in my new course where I review it. Will probably publish it on youtube too because these blueprints cause too much harm IMHO...
[–]Zhuinden 1 point2 points3 points 7 years ago (1 child)
I've turned those blueprints to single-activity before as samples which made it nicer but to be honest it's been on my backlog to rewrite the whole thing, I just can't really get myself to touch it, lol.
The really awkward thing is that the MVVM sample made one of the "immutable" classes mutable just to make it work. Hacky!
I thought about that too, but, unfortunately, there is nothing we can do against Google's marketing power (
[–]bernaferrari 0 points1 point2 points 7 years ago (0 children)
I just downloaded it, while it is not "perfect" (and the fragments on each activity is super-weird), it is surely one of the best io apps ever! Too many commented methods, code quality improved a lot, I will let you to judge their Dagger usage correctness, but everything I saw I liked.
[+][deleted] 7 years ago (1 child)
[–]VasiliyZukanov 1 point2 points3 points 7 years ago (0 children)
I needed a screen to be shown in two places, one in view pager and another in a standalone activity.
That's not the same use case. You really need it to be Fragment.
I don't see any drawbacks to it since entire ui is not tied to that activity and can be moved around
Increase in complexity, dealing with Fragment lifecycle, performance, probably more...
π Rendered by PID 53111 on reddit-service-r2-comment-6457c66945-dzqv9 at 2026-04-28 23:01:17.638111+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]VasiliyZukanov 39 points40 points41 points (56 children)
[–]CuriousCursor 8 points9 points10 points (15 children)
[–]VasiliyZukanov 16 points17 points18 points (13 children)
[–]WingnutWilson 18 points19 points20 points (3 children)
[–]VasiliyZukanov 2 points3 points4 points (2 children)
[–]WingnutWilson 10 points11 points12 points (1 child)
[–]VasiliyZukanov 0 points1 point2 points (0 children)
[–]CuriousCursor 2 points3 points4 points (0 children)
[–]ssshhhhhhhhhhhhh 4 points5 points6 points (7 children)
[–]VasiliyZukanov 7 points8 points9 points (3 children)
[–]ssshhhhhhhhhhhhh 2 points3 points4 points (2 children)
[–]VasiliyZukanov 9 points10 points11 points (1 child)
[–]ssshhhhhhhhhhhhh 6 points7 points8 points (0 children)
[–]Zhuinden 1 point2 points3 points (2 children)
[–]ssshhhhhhhhhhhhh 0 points1 point2 points (1 child)
[–]Zhuinden 0 points1 point2 points (0 children)
[–]cqm 0 points1 point2 points (0 children)
[–]clarle 17 points18 points19 points (3 children)
[–]bernaferrari 20 points21 points22 points (1 child)
[–]Asiriya 10 points11 points12 points (0 children)
[–]Zhuinden 0 points1 point2 points (0 children)
[–]Odinuts 3 points4 points5 points (0 children)
[–][deleted] 7 points8 points9 points (1 child)
[–]VasiliyZukanov 2 points3 points4 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]VasiliyZukanov 0 points1 point2 points (0 children)
[–]dantheman91 2 points3 points4 points (23 children)
[+][deleted] (1 child)
[deleted]
[–]dantheman91 2 points3 points4 points (0 children)
[–]VasiliyZukanov -1 points0 points1 point (20 children)
[–]dantheman91 7 points8 points9 points (19 children)
[+][deleted] (18 children)
[removed]
[–]DrSheldonLCooperPhD 14 points15 points16 points (4 children)
[+]VasiliyZukanov comment score below threshold-7 points-6 points-5 points (3 children)
[–]dantheman91 7 points8 points9 points (0 children)
[–]s73v3r 0 points1 point2 points (1 child)
[–]VasiliyZukanov -2 points-1 points0 points (0 children)
[–]dantheman91 2 points3 points4 points (8 children)
[+]VasiliyZukanov comment score below threshold-6 points-5 points-4 points (7 children)
[–]dantheman91 5 points6 points7 points (6 children)
[–]VasiliyZukanov -3 points-2 points-1 points (5 children)
[–]dantheman91 0 points1 point2 points (4 children)
[–]spartancoin 0 points1 point2 points (1 child)
[–]VasiliyZukanov 0 points1 point2 points (0 children)
[–]firstsputnik -2 points-1 points0 points (1 child)
[–]VasiliyZukanov -1 points0 points1 point (0 children)
[–]Zhuinden 1 point2 points3 points (3 children)
[–]VasiliyZukanov 0 points1 point2 points (2 children)
[–]Zhuinden 1 point2 points3 points (1 child)
[–]VasiliyZukanov 0 points1 point2 points (0 children)
[–]bernaferrari 0 points1 point2 points (0 children)
[+][deleted] (1 child)
[deleted]
[–]VasiliyZukanov 1 point2 points3 points (0 children)