uopspop

Untitled

Sep 27th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.94 KB | None | 0 0
  1. package com.example.sam.myfragmentprac;
  2.  
  3. import android.support.v4.app.Fragment;
  4. import android.os.Bundle;
  5. import android.view.LayoutInflater;
  6. import android.view.View;
  7. import android.view.ViewGroup;
  8. import android.widget.TextView;
  9.  
  10. public class MyFragment extends Fragment {
  11.     @Override
  12.     // onCreateView method provide an UI for this Fragment
  13.     public View onCreateView (LayoutInflater inflater,
  14.                        ViewGroup container,
  15.                        Bundle savedInstanceState){
  16.         View view = inflater.inflate(R.layout.my_fragmentui,container,false);
  17.         TextView textView = (TextView)view.findViewById(R.id.tvFragmentResult);
  18.         // cuz this is the second page, it would get some data from its previouse page
  19.         Bundle bundle = this.getArguments(); // Fragment::getArguments(): Bundle
  20.         String title = bundle.getString("title");
  21.         textView.setText(title);
  22.         return view;
  23.     }
  24. }
Add Comment
Please, Sign In to add comment