change content frame.
i wanted to change the content_frame with new content. keep getting no viewfound for id ....
my samplelistframgment.java onclick
public void onListItemClick(ListView l, View v, int position, long id) {
MainActivity parent = (MainActivity) getActivity();
parent.getSupportFragmentManager()
.beginTransaction()
.replace(R.id.content_frame, new Setting()) //NewFragment is what I wanted to replace on the front menu
.commit();
parent.toggle();
/*Toast.makeText( getActivity(), Integer.toString(position) + " okwww ", Toast.LENGTH_SHORT).show();
*/
}
setting.java
public class Setting extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.setting, null);
}
}
am i doing this right.. any example on changing the contect_frame
Hi! I'd like to help you if the problem still persist. Can you provide more details? What is your layout for an activity? I did the same inside example project and it works fine:
@Override
public void onListItemClick(ListView l, View v, int position, long id)
{
getActivity().getSupportFragmentManager()
.beginTransaction()
.replace(R.id.content_frame, new Settings())
.commit();
((BaseActivity) getActivity()).toggle();
}
hi. sorry for the late reply.. i tried implementing your suggestion .. i Failed. i don't have proper example to base upon. Do you have a proper example for implementing slidingMenu which the menu is on the left side of the app. And with proper onlistitemclick action . btw i keep getting No view found for id 0x7f050036 for fragment Setting
Check the new example app. There are 2 examples of this behavior.