简体   繁体   中英

How to switch between different activities like tabs in android?

在此处输入图片说明

I need to develop an application which contain these tabs shown in the image. Each tab contain a form which will be filled by the user.User can switch to any tab.

User click Activity1, Activity 1 gets displayed and user enters some data; then user press Activity 2, activity 2 gets displayed, user press Activity1 again, Activity 1 gets displayed with the data entered by the user(not the blank activity).

At the end when user click "Save" I need to get all the data from these activities and save it somewhere.

I have worked a lot in java but new to android, I am stuck in developing the UI for this scenario. However I have done this many times in iOS.

Anybody please share your experience of developing such UI.

Thanks,

Fragments will be more suitable for this scenario, the benefit are

  1. They are light weight and faster

  2. Managed automatically by the FragmentManager.

  3. Data Sharing between Fragments is smoother and simpler than it is for Activities

  4. They don't complicate the Architecture of the Application

You can have as many Fragments as you want in you Activity. Following two links can be useful for you.

A similar Thread

A Good Tutorial

Another good tutorial

If even after that you decide to use Activities, You need to think

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM