I would recommend that you create your own Fragment and then make your own instantiation method:
Something like that:
public class MyFragment extends Fragment {
public MyFragment() {
// empty constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// here you can load whatever layout you want for your fragment
View v = inflater.inflate(R.layout.your_fragment_layout, container, false);
// for example set the address as a textview text, or do whatever you want with it
TextView tv = (TextView) v.findViewById(R.id.tvAddress);
tv.setText(getArguments().getString("address"));
return v;
}
public static MyFragment newInstance(String address) {
MyFragment myFragment = new MyFragment();
Bundle args = new Bundle();
args.putString("address", address);
myFragment.setArguments(args);
return myFragment;
}
}
And then inside the onItemClick() method:
// new fragment handling
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(R.id.content_frame, MyFragmet.newInstance(fragmentAddresses[position]);
transaction.commit();