Button Click Counter App, TextView, Button, Constraint Layout
Create a new app named Button Click Counter (min api 17)
EditText userInput
Button button
TextView textView
userInput = (EditText)findViewById(R.id.editText);
Button Click and onClickListener
View.OnClickListener onClickListener = new View.OnClickListener()
)To make textView scrollable, we must define a movementMethod on it (setMovementMethod(new ScrollingMovementMethod());
)
Override the following Activity Lifecycle methods to review the lifecycle process
onDestroy()
onStart()
onStop()
onRestart()
onPause()
onResume()
onSaveInstanceState()
onRestoreInstanceState()
outState.putString(TEXT_CONTENTS, textView.getText().toString());
Notes
Although we’re using the latest version of the Android SDK we can still create apps that run on older versions well it’s actually the app compat library that makes that possible the good news is the app compat library has been updated for android nougat and we’re now able to deploy applications using android nougat software functionality and also the version of the API and of course the cool thing we want to include in that case is the constraint layout and Google is sending updates to the app compat libraries on regular intervals to make sure things are updated so you can be assured that other support devices will come out over time using this new constraint layout as well go now all supported devices this time means everything going back to gingerbread which is API 9 so ultimately this means that as developers we can take advantage of the latest features while still allowing our apps to run on older devices.