Я хочу использовать ViewPager
, но получаю ошибку.Фрагмент возвращает ноль.Что-то не так в этом коде?
public class FirstFragment extends Fragment {
private Bundle arguments;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.first_fragment, container, false);
TextView tv = (TextView) v.findViewById(R.id.tvFragFirst);
tv.setText(getArguments().getString("msg"));
return v;
}
public static FirstFragment newInstance(String text) {
FirstFragment f = new FirstFragment();
Bundle b = new Bundle();
b.putString("msg", text);
f.setArguments(b);
return f;
}
public void setArguments(Bundle arguments) {
this.arguments = arguments;
}
}