I have a Main activity which extends SherlockActivity
The following code seems to be giving me trouble
PopularFragment fragment = new PopularFragment();
FragmentManager fragmentManager = getFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.content_frame, fragment)
.commit();
I get the error "Type mismatch: cannot convert from android.app.FragmentManager to android.support.v4.app.FragmentManager
"
I tried getSupportFragmentManager() but that gives me this error "The method getSupportFragmentManager() is undefined for the type Main.DrawerItemClickListener
"
I am playing with the new android navigation drawer, in my libs/ folder I only have support library v13
my fragments imports are import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.support.v4.app.FragmentManager;
How do I solve this issue? Thanks!
You should extend SherlockFragmentActivity
not SherlockActivity
. And call getSupportFragmentManager
instead of getFragmentManager
.
I don't know if it is a good practice, But I have changed with newFragment.show(this.getFragmentManager(), "datePicker");
And the datePicker is working.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With