What is a recommended Android utility class collection?
Posted
by
Sebastian Roth
on Stack Overflow
See other posts from Stack Overflow
or by Sebastian Roth
Published on 2010-12-29T07:43:59Z
Indexed on
2010/12/29
7:54 UTC
Read the original article
Hit count: 191
android
|android-widget
I often find myself writing very similar code across projects. And more often than not, I copy stuff over from old projects.
Things like:
- Create images with round corners
- read density into a static variable & re-use. 4 lines..
- disable / hide multiple views / remote views at once. Example:
}
public static void disableViews(RemoteViews views, int... ids) {
for (int id : ids) {
views.setInt(id, SET_VISIBILITY, View.GONE);
}
}
public static void showViews(RemoteViews views, int... ids) {
for (int id : ids) {
views.setInt(id, SET_VISIBILITY, View.VISIBLE);
}
}
I'd love to package these kind of functions into 1 letter / 2 letter class names, i.e. V.showViews(RemoteViews views, int... ids)
would be easy to write & remember I hope.
I'm searching for Github recommendations, links and if nothing is found, I perhaps will start a small project on github to collect.
© Stack Overflow or respective owner