MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/androiddev/comments/5ezdoy/effective_java_for_android_cheatsheet/dagduhl/?context=3
r/androiddev • u/netcyrax • Nov 26 '16
49 comments sorted by
View all comments
32
Static factory methods are really good for creating intents as well:
public class MyActivity { private static final String EXTRA_ARG = "SomeArg"; public static Intent newIntent(Context context, String someArg){ Intent intent = new Intent(context, MyActivity.class); intent.putString(EXTRA_ARG, someArg); return intent; } }
Great writeup! Thanks for sharing.
1 u/[deleted] Nov 26 '16 [removed] — view removed comment 4 u/chickennoodlegoop Nov 26 '16 This works fine when you can make assumptions about the arguments/extras that you need the intent to have, but gets a little tricky to abstract away otherwise.
1
[removed] — view removed comment
4 u/chickennoodlegoop Nov 26 '16 This works fine when you can make assumptions about the arguments/extras that you need the intent to have, but gets a little tricky to abstract away otherwise.
4
This works fine when you can make assumptions about the arguments/extras that you need the intent to have, but gets a little tricky to abstract away otherwise.
32
u/Plastix Nov 26 '16 edited Nov 26 '16
Static factory methods are really good for creating intents as well:
Great writeup! Thanks for sharing.