What is the importance of putExtra() method in Android? How is it different from setData() ? Anyway both are passing data, then what is the difference?

setData() - is to pass data on which to take action. 
putExtra() - is to send extra information about this intent.
Description:
setData() - is to pass data on which to take action. putExtra() - is to send extra information about this intent.
Eg: If one is starting an activity to perform ACTION_CALL, then he has to set number in setData(). this function will contain on which data target component has to take action. if one want to pass extra details also, then only use putExtra().

No comments:

Post a Comment