15/06/2021 Week 4: Workshop Quiz: Attempt review
FIT2081 Mobile application development – S1 2021
Dashboard / My units / FIT2081_S1_2021 / Assessments / Week 4: Workshop Quiz
Started on State Completed on Time taken Grade
Print friendly format
Question 1
Monday, 22 March 2021, 5:20 PM Finished
Monday, 22 March 2021, 9:56 PM 4 hours 36 mins
7.67 out of 10.00 (77%)
Question 1
Complete
Mark 7.67 out of 10.00
Q1- Why is the datatype of the input parameter declared as ‘View’?
A View occupies a rectangular area on the screen and is responsible for drawing and event handling. The view is the base class for widgets, which are used to create interactive UI components like buttons, text fields, etc.
When declaring the input parameter, upcasting is applied and that method like event handler could be used for multiple UI component instances such as Button, text field, etc. It’s without needing to specifying which View objects are being accessed.
Comment:
(Q1=100% Q2=100% Q3=91% T4=0% )
Question 2 Complete Not graded
https://lms.monash.edu/mod/quiz/review.php?attempt=18850221&cmid=8331150 1/3
15/06/2021 Week 4: Workshop Quiz: Attempt review
Question 2
Q2 a) What is the main difference between Guidelines and Barriers?
Guideline’s position is always fixed, but Barrier’s position is flexible that always based on the size of multiple UI elements contained within it.
b) When does the horizontal bias in constraint layout become redundant?
They are bidirectionally connected to each other, so when the views are in a horizontal chain, giving bias to one of the view will also automatically change the bias of the connected views.
Question 3 Complete Not graded
Question 3
Q3- a) What is the role of the second input parameter to the BroadcastReceiver onRecieve() method?
The role of the second input parameter is used to specify the messaging object that can be used to request an action from another app component. In addition, the action can be identified and carried out.
Question 4 Complete Not graded
Question 4
b) If you have the following:
•Intent Filter =“week4.fit2081.quiz” • Key =“Key” • Data=“FIT2081”
Using the details above, write a piece of code that sends the Data in a broadcast message.
https://lms.monash.edu/mod/quiz/review.php?attempt=18850221&cmid=8331150 2/3
15/06/2021 Week 4: Workshop Quiz: Attempt review
Void sendData (Context context){
Intent msgIntent = new Intent(); msgIntent.setAction(“week4.fit2081.quiz”); msgIntent.putExtra(“Key”,”FIT2081”); context.sendBroadcast(msgIntent);
}
Question 5 Complete Not graded
Question 5
Q4 – Code the missing line that allows the ‘onReceive’ method in the activity above to get invoked each time the following piece of code gets executed.
Each message is received as an Intent object parameter and the onReceive( ) method is called when the BroadcastReceiver is receiving an Intent broadcast.
Missing line code:
public void onReceive(Context context, Intent intent){
throw new UnsupportedOperationExcepiton(“Not yet implemented”); Toast.makeText(context, “Broadcast Intent Detected.‘’, Toast.LENGTH.LONG).show( );
}
◄ Week 3: Workshop Quiz
Jump to…
Week 5: Workshop Quiz ►
https://lms.monash.edu/mod/quiz/review.php?attempt=18850221&cmid=8331150 3/3