diff --git a/scripts/android/afterPluginInstall.js b/scripts/android/afterPluginInstall.js index 1067ebe..93309ce 100644 --- a/scripts/android/afterPluginInstall.js +++ b/scripts/android/afterPluginInstall.js @@ -34,7 +34,7 @@ module.exports = function(context) { manifestRoot = manifest['manifest']; packageName = manifestRoot['$']['package']; - newActivity = activity.replace('${mypackage}', packageName); + newActivity = activity.replaceAll(/\$\{mypackage\}/g, packageName); newActivityPath = utilities.getAndroidSourcePath(context) + "/" + packageName.replaceAll("\\.", "/") + '/MainActivity.java'; console.log(newActivityPath); diff --git a/src/android/MainActivity.java b/src/android/MainActivity.java index b6a819e..2fbb3e2 100644 --- a/src/android/MainActivity.java +++ b/src/android/MainActivity.java @@ -49,12 +49,12 @@ public void onCreate(Bundle savedInstanceState) FragmentManager fm = getSupportFragmentManager(); - currentFragment = (CordovaFragment) fm.findFragmentByTag("${mypackage}"); + currentFragment = (uk.co.reallysmall.cordova.plugin.fragment.CordovaFragment) fm.findFragmentByTag("${mypackage}"); if (currentFragment == null) { currentFragment = new uk.co.reallysmall.cordova.plugin.fragment.CordovaFragment(); FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); - ft.add(android.R.id.content, currentFragment,${mypackage}); + ft.add(android.R.id.content, currentFragment,"${mypackage}"); ft.commit(); } }