Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.sam.myfragmentprac;
- import android.support.v4.app.Fragment;
- import android.os.Bundle;
- import android.view.LayoutInflater;
- import android.view.View;
- import android.view.ViewGroup;
- import android.widget.TextView;
- public class MyFragment extends Fragment {
- @Override
- // onCreateView method provide an UI for this Fragment
- public View onCreateView (LayoutInflater inflater,
- ViewGroup container,
- Bundle savedInstanceState){
- View view = inflater.inflate(R.layout.my_fragmentui,container,false);
- TextView textView = (TextView)view.findViewById(R.id.tvFragmentResult);
- // cuz this is the second page, it would get some data from its previouse page
- Bundle bundle = this.getArguments(); // Fragment::getArguments(): Bundle
- String title = bundle.getString("title");
- textView.setText(title);
- return view;
- }
- }
Add Comment
Please, Sign In to add comment