We use intents to switch between two activities and also fragments are for the same purpose. So why can't we use intents always instead of fragments?
Asked
Active
Viewed 2,204 times
0
-
1you DONT use fragment to switch activities – Marco Pierucci Jan 29 '19 at 18:25
-
Related post: [What are the differences between activity and fragment? ](https://stackoverflow.com/questions/25822656/what-are-the-differences-between-activity-and-fragment) – Vignan Sankati Jan 29 '19 at 18:17
2 Answers
0
Intent, you can think of intention to do some work. It can be either go from one activity to another activity, send email, open some links and so on.
Fragment is just like part of those activities.
To make it simple you can think of activities
as full website page whereas fragment
as a part of that website page. So, activity
can contain any number of fragments
.

Bijay Yadav
- 928
- 1
- 9
- 22
0
I think :
1.In the changing fragment you just change part of activity and not whole of them , but by intent you change whole of activity to other.
2.by intent you can communicate between android components such as activities, content providers, broadcast receivers and services, but by fragment you cant and in the otherwise fragment is child of activity.

milad salimi
- 1,580
- 2
- 12
- 31