Here's the problem
I have a Fragment
class DisplayFragment
and I already have one show in the content frame
, then I do
DisplayFragment a = DisplayFragment.newInstance();
getSupportFragmentManager().beginTransaction()
.replace(R.id.contentFrame, DisplayFragment)
.commit();
Then I want to get the view
of fragment
a using View v = a.getView();
, but it return a null view
.
Can anyone tell me why? Cause I have to change some view setting of the new Fragment
.
onCreateView()
in DisplayFragment
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_display, container, false);
//Some TextView setup
Button button = (Button) view.fineViewById(R.id.button);
return view; }