MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/androiddev/comments/5ezdoy/effective_java_for_android_cheatsheet/dahen2l/?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.
10 u/ditn Google Developer Expert Nov 26 '16 There's a shortcut/postfix completion thing in Android Studio to do this for you. Type 'start' on a new line. 2 u/Plastix Nov 26 '16 Woah I didn't know this live template existed. Thanks! 4 u/ditn Google Developer Expert Nov 27 '16 Nor did I until a week ago! Turns out hitting CMD+J (iirc) lets you browse the templates in context, it's worth having a dig around for half an hour and seeing what's useful to you.
10
There's a shortcut/postfix completion thing in Android Studio to do this for you. Type 'start' on a new line.
2 u/Plastix Nov 26 '16 Woah I didn't know this live template existed. Thanks! 4 u/ditn Google Developer Expert Nov 27 '16 Nor did I until a week ago! Turns out hitting CMD+J (iirc) lets you browse the templates in context, it's worth having a dig around for half an hour and seeing what's useful to you.
2
Woah I didn't know this live template existed. Thanks!
4 u/ditn Google Developer Expert Nov 27 '16 Nor did I until a week ago! Turns out hitting CMD+J (iirc) lets you browse the templates in context, it's worth having a dig around for half an hour and seeing what's useful to you.
4
Nor did I until a week ago! Turns out hitting CMD+J (iirc) lets you browse the templates in context, it's worth having a dig around for half an hour and seeing what's useful to you.
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.