0

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?

Prateek Aggarwal
  • 166
  • 1
  • 2
  • 14
FARHANA S
  • 39
  • 5

2 Answers2

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, activitycan 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