Skip to content

Instantly share code, notes, and snippets.

@the-dagger
Last active December 28, 2017 13:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save the-dagger/7f46c297edbea5c9b0bdf9d4d0c9c3fb to your computer and use it in GitHub Desktop.
Save the-dagger/7f46c297edbea5c9b0bdf9d4d0c9c3fb to your computer and use it in GitHub Desktop.
Kotlin synthetic binding blog
class MainActivity extends AppCompatActivity{
TextView studentName, studentSubject, studentCenter;
//Since I might need them later on outside of my onCreate method
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
studentName = findViewById(R.id.studentName),
studentCenter = findViewById(R.id.studentCenter),
studentSubject = findViewById(R.id.studentSubject);
}
@Override
protected void onResume() {
super.onResume();
studentName.setText("Harshit Dwivedi");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment