startActivity(new Intent(SecondScreen.this,FragmentOne.class).
putExtra("key", VideoFullUrl));
在FragmentOne.class中扩展了android.support.v4.app.Fragment
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
String url = getIntent().getStringExtra("key");//here showing compilation error "cannot resolve method getIntent "
//somecode....
答案 0 :(得分:2)
Fragment to Fragment set and get Argument:
开始活动:
int friendId = 2; //value to pass as extra
i = new Intent(firstActivity, SecondActivity.class);
i.putExtra("friendsID", friendId);
firstActivity.startActivity(i);
SecondActivity:
Fragment_A mFragment_A = new Fragment_A();
mFragment_A.setArguments(getIntent().getExtras());
Fragment_A:
Bundle bundle = new Bundle();
String Item = getArguments().getString("friendsID");
bundle.putInt("friendsID", Integer.parseInt(Item));
// code
Fragment_B mFragment_B = new Fragment_B();
mFragment_B.setArguments(bundle);
Fragment_B:
Bundle bundle = getArguments();
int value = bundle.getInt("friendsID");
Log.e("value Fragment get Argument ", "friendsID :" + value);
这项工作对我来说,试试这可能是这个样本帮助你。