我正在使用片段代替制表符而在上面我正在显示列表视图,如果我点击特定列表coloumn然后新的fragmentActivity启动由于新活动启动了标签(片段)消失但我希望标签(片段)也应该保留在新屏幕中,我应该怎么做..
活动代码如下。
公共类FriendsFragment扩展了ListFragment {
public static String[] friendsaddoptions=new String[]{
"Fox User","FaceBook","Email","Twiter","SMS"
};
ListView listview;
Friends_Names_List_Adapter friendsnameslistadapter;
JSONArray dataJsonObject;
Button add;
Button back;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view=inflater.inflate(R.layout.friends_list, container,false);
listview=(ListView)view.findViewById(android.R.id.list);
add=(Button) view.findViewById(R.id.button_add);
back=(Button)view. findViewById(R.id.button_back);
back.setVisibility(View.INVISIBLE);
FriendsFragmentData dataobserver=new FriendsFragmentData();
ServerManager.getInstance().addObserver(dataobserver);
ServerManager.getInstance().readLoopForFriends_Names_List(AppConstances.Friends_Names_List);
if(friendsnameslistadapter==null)
friendsnameslistadapter=new Friends_Names_List_Adapter(getActivity(), new JSONArray());
listview.setAdapter(friendsnameslistadapter);
add.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) { /*Intent in=new Intent(getActivity().getBaseContext(), FriendsNamesAddActivity.class);
startActivity(in);*/
ArrayAdapter< String> adapter=new ArrayAdapter<String>(getActivity().getBaseContext(), R.layout.friends_add_listitem,R.id.friends_add_option,friendsaddoptions);
listview.setAdapter(adapter);
if(adapter!=null)
back.setVisibility(View.VISIBLE);
listview.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View view, int position,
long id) {
Intent intent=new Intent(getActivity().getBaseContext(),FoxUserActivity.class);
startActivity(intent);
}
});
if(adapter!=null)
{
add.setVisibility(View.INVISIBLE);
}
}
});
如何将FragmentActivity作为屏幕的一部分启动,以便每个活动都可以看到标签(片段)。