Accessing data of parent activity from a fragment
<p>What is the best way to access data members of an activity from its fragment
Some ways which I know include -</p>

<ol>
<li><p>Create an interface in the Fragment which the Activity will implement. The interface will have the methods to access data members of the Activity.</p></li>
<li><p>Directly access using ((Activity)getActivity).getXXX() from the fragment.</p></li>
<li><p>Pass the data members or custom parcelable class to newInstance method of the fragment and set the fragment arguments as the class for e.g. -</p>

<p>Bundle args = new Bundle();</p>

<p>args.putInt("num", num);</p>

<p>f.setArguments(args);</p>

<p>and later we can get the arguments using getArguments()</p></li>
</ol>

<p>Which method is the best and what are the drawbacks of each?</p>