Created
April 19, 2016 16:34
-
-
Save MartelliEnrico/f2625e6f5984e39eb8b0805dd18e4ed7 to your computer and use it in GitHub Desktop.
Android findViewById auto casting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BaseActivity extends Activity { | |
@SuppressWarnings("unchecked") | |
public <T extends View> T $(int id) { | |
return (T) findViewById(id); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment