Home>IT Tests>Questions>What is the output of the following code?
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button button = findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO: Add your code here
}
});
}
}
Question from the Android test
What is the output of the following code? public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button button = findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO: Add your code here } }); } }
Hard
In the Android design library, what is the purpose of the CoordinatorLayout?
Author: Nicolas LaurentStatus: PublishedQuestion passed 378 times
Edit
1
Community EvaluationsNo one has reviewed this question yet, be the first!
1
How to start a service in Android5
What is the purpose of a RecyclerView in Android?1
How to save the state of an Android activity when the device is rotated?1
What is the name of the Android tool that is used to generate the R.java file?2
How to get the view id in Android2
In the onStop() method. I am sure that this callback will always be called and it is likely to be returned only a few times.2
What is the name of the Android runtime?