Is isAdded() same as null != getActivity() in Android Fragment?

Viewed 2492

I wonder if these two methods leads to same results or one is better to use than the other.

if(isAdded()){
//do something with activity since fragment is currently added to its activity.
}

And

if(null != getActivity()){
//do something with activity. Its not null
}
1 Answers
Related