}
===============================================================================================
package com.example.fragment39a;
import com.example.fragment39a.BookContent.Book;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
public class BookDetailFragment extends Fragment{
private BookContent.Book model;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//接收传来的数据getArguments
Bundle bun=getArguments();
model = (Book) bun.get("data");
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v=inflater.inflate(R.layout.bookdetail, null);
TextView tv1=(TextView) v.findViewById(R.id.textView1);
TextView tv2=(TextView) v.findViewById(R.id.textView2);
if(model!=null){
tv1.setText(model.getBookTitle());
tv2.setText(model.getBookContent());
}
return v;
}
}