Question

When receiving a result from another Activity, which method must be overridden? Explain the meaning of...

  1. When receiving a result from another Activity, which method must be overridden? Explain the meaning of the parameters to this method.

  2. During which Activity lifecycle method should you save any state in your application?

  3. What is the difference between an explicit Intent and an implicit Intent?

  4. Explain what happens when you try to start an Activity using an implicit Intent?

  5. List the Activity lifecycle events in order, for the following situation. Activity 1 is already in

    the the created state (onCreate has already been called).

    1. A button in Activity 1 is pressed, launching Activity 2

    2. Once Activity 2 has become visible, the user presses the back button.

    3. Activity 1 is displayed and the user presses the back button again.

0 0
Add a comment Improve this question Transcribed image text
Answer #1


1.OnCreate(),Onstart() ,Onresume(),OnsaveInstance state()-In this state activity life cycle changes the states,
ex-When a configuration change occurs, the activity is destroyed and recreated. The original activity instance will have the onPause(), onStop(), and onDestroy() callbacks triggered.
A new instance of the activity will be created and have the onCreate(), onStart(), and onResume() callbacks triggered.
Use a combination of ViewModels, the onSaveInstanceState() method preserve an activity’s UI state across configuration changes,and its combining these options depends on the complexity
of your UI data, use cases for your app, and consideration of speed of retrieval versus memory usage.

2-explicit vs implicit intend

Explicit intent is an intent that is publicly stated and its made available for the participants and
Implicit intent is an intent that is not publicly stated.To use an implicit intent, create an Intent object as you did for an explicit intent, only without the specific component name.
implicit Intents do not directly specify the Android components which should be called, it only specifies action to be performed and by using Uri can be used with the implicit intent to specify the data type.
Explicit intents are used in the application itself where in one activity it can switch to other activity,can also be used to
pass data to other activity using putExtra method and retrieved by target activity .


3-Such implicit Intents are used when you don't explicitly know which Activity has to be started and you want the Android system to decide which component to start.If the system finds multiple components which can handle handle your Intent, it will allow the user to choose.
Implicit intents are used when you want start an activity in another application simply by specifying the type of action you want to perform, When we pass an implicit intent,
the Android system resolves the intent to an app that can handle the intent and starts that app's

4.List of activity life cylce occures and activiy 1 is alraedy in use and now launching activity 2 ,once activity 2 is visble the use press back button then ---Start Activity2 with startActivityForResult and use setResult method for sending data back from Activity2 to Activity1. In Activity1 you will need to override onActivityResult for updating TextView with EditText data from Activity2, and in the activity 1 user again click on back button.

Add a comment
Know the answer?
Add Answer to:
When receiving a result from another Activity, which method must be overridden? Explain the meaning of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • need this in #c . You will now add server side validation code to the frmPersonnel...

    need this in #c . You will now add server side validation code to the frmPersonnel page. Currently, when the Submit button is pressed, the frmPersonnelVerified page is displayed. This is because the frmPersonnelVerified page is set as the Submit button's PostBackUrl property. Instead of having the page go directly to the frmPersonnelVerified page when the Submit button is pressed, we want to do some server side validation. If any of the validation rules fail, we will redisplay the frmPersonnel...

  • could you please help me with this problem, also I need a little text so I...

    could you please help me with this problem, also I need a little text so I can understand how you solved the problem? import java.io.File; import java.util.Scanner; /** * This program lists the files in a directory specified by * the user. The user is asked to type in a directory name. * If the name entered by the user is not a directory, a * message is printed and the program ends. */ public class DirectoryList { public static...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT