phonegap: MainActivity.java - changing extends to "Droidgap" causes errors

4.7k views Asked by At

I'm trying to set up phonegap for 3 days now. The docs will only get me to the "phonegap add android" part which returns an error so I tried this tutorial from Adobe http://www.adobe.com/devnet/html5/articles/getting-started-with-phonegap-in-eclipse-for-android.html

This part:

Change the base class from Activity to DroidGap ; this is in the class definition following the word extends :

public class MainActivity extends DroidGap {

will cause two errors. One is resolved by simply changing protected to public on some function.

The error i can't resolve is this one:

"The Method getSupportFragmentManager is undefined for MainActivity".

The whole process of setting up phonegap is very frustrating, any help is very, VERY much appreciated.

1

There are 1 answers

0
Daniel Bank On

"The Method getSupportFragmentManager is undefined for MainActivity".

getSupportFragmentManager() is a public method in the FragmentActivity class. Your MainActivity would have to extend FragmentActivity in order for this to work. However it shouldn't be necessary to have this code if you are just trying to follow the "Getting started with PhoneGap in Eclipse for Android" tutorial.

When you create the Android Project, double-check that you have chosen to create a Blank Activity and that the Navigation Type for that activity is None (see pictures).

Create Activity Screen

Blank Activity Screen

See also:

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

Related SO Question: method getSupportFragmentManager() is undefined