i have a ListView in NewsFragment. and i have another Fragment named MansetFragment. I want to parse an xml source in MansetFragment and insert it in NewsFragment. just like here. http://hizliresim.com/Lp6p4Z (The Yellow area is the MansetFragment) it works with static image but it doesnt show when i parse the source. here is my code
my question how i can insert the MansetFragment as the header of my listview ?
Java:
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View theView = inflater.inflate(R.layout.fragment_news, container, false);
lstNews= (ListView) theView.findViewById(R.id.lstNews);
headerView = (View)inflater.inflate(R.layout.news_header, null, false);
lstNews.addHeaderView(headerView);
headerView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() { @SuppressLint("NewApi")
@Override public void onViewDetachedFromWindow(View v) {}
@SuppressLint("NewApi")
@Override public void onViewAttachedToWindow(View v) { getChildFragmentManager().beginTransaction().add(R.id.headerContainer, mansetFragment).commit(); }
});
Log.i("FRAGMENTXXX ", "NEWS ONCREATEVIEW"); return theView;
}
my question how i can insert the MansetFragment as the header of my listview ?