Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot find symbol method getSupportFragmentManager()

Tags:

java

android

And in main activity I have this

public void showTimePickerDialog(View v) {
    DialogFragment newFragment = new uSharedUtility.TimePickerFragment();
    newFragment.show(getSupportFragmentManager(), "timePicker");
}

But I am getting this error:

Error:(566, 26) error: cannot find symbol method getSupportFragmentManager()

After searching I find out that I can make this go away by extending from FragmentActivity

But currently my MainActivity is extending from public class Main extends ListActivity due to some earlier requirements.

Is there any other way I can solve this issue excepting for changing extending classes.?


1 Answers

getSupportFragmentManager() is method of FragmentActivity. Your Parent activity should have extends FragmentActivity

Check this

http://developer.android.com/reference/android/support/v4/app/FragmentActivity.html

like image 141
Ganesh AB Avatar answered May 17 '26 10:05

Ganesh AB