Handling different actions

Report a typo

Inside your onReceive() method in your BroadcastReceiver class, you want to show different Toast messages for different Intent actions. Reorder the lines of codes to achieve this goal.

Handle the case of AIRPLANE_MODE_CHANGED first!

Reorder lines using drag or arrows. Adjust indentation with left buttons
                }
              
                Toast.makeText(context, "The date was changed", LENGTH_LONG).show()
              
                Toast.makeText(context, "Airplane mode was changed", LENGTH_LONG).show()
              
                Intent.ACTION_DATE_CHANGED ->
              
                when (intent.action) {
              
                Intent.ACTION_AIRPLANE_MODE_CHANGED ->
              
___

Create a free account to access the full topic