package com.sf.manager.eventbus2;

import android.app.Fragment;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import de.greenrobot.event.EventBus;

public class ItemDetailFragment extends Fragment
{

    private TextView tvDetail;

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        // register 订阅事件
        EventBus.getDefault().register(this);
    }

    @Override
    public void onDestroy()
    {
        super.onDestroy();
        // Unregister 取消订阅
        EventBus.getDefault().unregister(this);
    }

    /** List点击时会发送些事件，接收到事件后更新详情 */
    public void onEventMainThread(Item item)
    {
        Log.e("eve", "Item");
        if (item != null)
            tvDetail.setText(item.content);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState)
    {
        View rootView = inflater.inflate(R.layout.fragment_item_detail,
                container, false);
        tvDetail = (TextView) rootView.findViewById(R.id.item_detail);
        return rootView;
    }
}

@@ -319,17 +319,17 @@
 Fragment
-%0A
+ 
 %7B%0A%0A    p
@@ -412,36 +412,32 @@
 edInstanceState)
-%0A   
  %7B%0A        super
@@ -586,20 +586,16 @@
 estroy()
-%0A   
  %7B%0A     
@@ -705,16 +705,23 @@
 %0A    /**
+%0A     *
  List%E7%82%B9%E5%87%BB%E6%97%B6
@@ -737,16 +737,21 @@
 %E5%88%B0%E4%BA%8B%E4%BB%B6%E5%90%8E%E6%9B%B4%E6%96%B0%E8%AF%A6%E6%83%85
+%0A    
  */%0A    
@@ -784,22 +784,19 @@
 ead(
-Item item)%0A   
+String str)
  %7B%0A 
@@ -820,16 +820,35 @@
 %22, %22Item
+  do in other class
 %22);%0A    
@@ -855,20 +855,19 @@
     if (
-item
+str
  != null
@@ -901,20 +901,11 @@
 ext(
-item.content
+str
 );%0A 
@@ -1002,37 +1002,8 @@
 ner,
-%0A                            
  Bun
@@ -1025,20 +1025,16 @@
 ceState)
-%0A   
  %7B%0A     
@@ -1084,17 +1084,17 @@
 t.fragme
-n
+m
 t_item_d
@@ -1103,24 +1103,8 @@
 ail,
-%0A               
  con

Update ItemDetailFragment.java