How to start a child activity from a parent by submitting a parameter in Android Studio?

Who I am
Pavel Yosifovich
@pavelyosifovich
Author and references

An application generally consists of multiple interaction screens, these need to be created from tasks, so you need to understand how to start a secondary task in Android Studio.

This allows you to see the application better, allowing you to move between action screens in a simple and organized way.

In case you didn't know, the Android Studio program lets you add a gradient to a button.

How to start a secondary business from a main one?

The first thing you should have done is to complete the actions of your first activity, now you can start developing the second one.



Start by creating a method " open second business ”And assign it to one of the buttons for your first activity. Then proceed to create a working intent to open Activity 2.

Then create a " extra ”With the name you prefer and the text you want to display. Now define a " layout Where the text you prefer will go.

Now, you just need to repeat the steps you would normally do for register this option in the manifest and they are the same ones you have already done. In order to record changes in the main activity, this ensures that the system links it correctly.

This way, you should be able to observe your main and secondary activity separately and within the application section.

What are the collateral activities for?

The simplest way to define the use of these, is through an example, if the application you are developing deserves a options menu, this can be developed as a sideline.


The button associated with this that would be present in the main activity, for example, with the name of " options ”When pressed it would immediately redirect the user to that subtask.


This procedure improves the display of the application, giving it a better reception by the user, as well as allowing the adding several actions which can be very useful.

Likewise, it allows the data contained in the app not to be piled up on a single screen, but rather gives you one better content distribution.

Advantages of starting a side business

This additional activity turns into a new page for adding content or interactions, most of the users love organized apps. Here they can slide easily without feeling crowded.

It is also important to think that the options that go hand in hand can be on the same screen without any problem, for example by keeping the volume of music and application sounds on the same screen.

disadvantages

As with everything, some people believe that too excesses are uncomfortable. Therefore, if an application has too many secondary activities, it can make the user uncomfortable. For example, going through two or three screens to change something minimal is pretty annoying.

Likewise, it should be borne in mind that the more additional screens the app has, the greater its weight. This may affect its download or use by users with low / mid-range devices.


It should always be kept in mind that if an application deserves a large amount of RAM it can be easily discarded. Therefore, all these aspects should be studied during development and thus avoid negative reviews.


 

Although we have seen that starting a side business from a main one is quite simple and can be quite productive for development. You have to do it carefully so as not to damage everything you have done.


This helps to see how complicated the process of creating an application can be and all the details that need to be taken into consideration for it to function optimally.

Finally, we hope this short tutorial will be of great help and allow you to learn new things about Android Studio and be able to create the best apps.


Once you have finished editing your application, I recommend that you use the Broadcast Receiver application which allows you to start your application yourself or if you want to save it you can export or import it as a Zip file.

If you are new to building applications in Android Studio, it will be helpful to know that you can create or use a SQLite program database for your applications. You also have programs like SharedPreference that will help you save or delete data.


add a comment of How to start a child activity from a parent by submitting a parameter in Android Studio?
Comment sent successfully! We will review it in the next few hours.