I can not figure out how to transfer the position of a line to a fragment. I need the fragment to get the number of the selected line
public class TabAdapter extends FragmentPagerAdapter { public static final String[] TITLES = {"текст1","текст1", "текст1", "текст1", "текст1"}; public InformTabAdapter(FragmentManager fm) { super(fm); } @Override public Fragment getItem(int position) { Log.i(String.valueOf(position), "Что тут у нас 0 да?"); InfoTabFragment tabFragment = new InfoTabFragment(); Bundle b = new Bundle(); b.putInt("position", position); tabFragment.setArguments(b); return tabFragment; } @Override public int getCount() { return TITLES.length; } @Override public CharSequence getPageTitle(int position) { return TITLES[position]; } }
I write int x = getArguments (). getInt ("position"); he crash