android - Cannot Find MainActivity for Intent Inside Cordova PlugIn -
I write my own Cordova plugin for Android I am working inside a standalone Android project. Although I can not get my activity to start from the plugin java file. It keeps firing errors which it can not get main activity (symbol can not be found). I hope this is an easy fix that I am missing
Android Manifest:.?
& lt; XML version = "1.0" encoding = "utf-8" & gt; & Lt; Manifest xmlns: Android = "http://schemas.android.com/apk/res/android" package = "com.myapp.testplugin" & gt; & Lt; Android Android: allowBackup = "true" android: icon = "@ drawable / Aisi_lancr" android: label = "@ string / app_name" android: theme = "@ style / Aepthym" & gt; & Lt; Activity Android: "MainActivity" name = Android: windowSoftInputMode = "adjustResize" Android: label = "@ string / app_name" & gt; & Lt; Intent-Filter & gt; & Lt; Action Android: name = "android.intent.action.MAIN" /> & Lt; Category android: name = "android.intent.category.LAUNCHER" /> & Lt; / Intent-Filter & gt; & Lt; / Activity & gt; & Lt; / Application & gt; & Lt; Usage-permission Android: name = "android.permission.WRITE_EXTERNAL_STORAGE" /> & Lt; / Reveal & gt; Plug-in Java:
package com.myapp.testplugin; Import org.apache.cordova.CordovaWebView; Import org.apache.cordova.CallbackContext; Import org.apache.cordova.CordovaPlugin; Import org.apache.cordova.CordovaInterface; Import android App Import android.content.Context; Import android.content.Intent; Import android.util.log; Import Android Prozar Settings; Import android.widget.Toast; Import org.json.JSONArray; Import org.json.JSONException; Import org.json.JSONObject; Public class testplugin cordova plugin {extends to public static final string tag = "test plugin"; / ** * creator * / public testplugin () {} / ** * sets the reference to the command, it can be used to work as if to get the file path related to activity. * * @ Param Cordova main activity reference * @param WebView CordovaWebView is running in Cordova * / Public Zero Initialize (CordovaInterface Cordoba, CordovaWebView WebView) {super.initialize (Cordoba, WebView). Log D. (Tag, "int test plugin"); } @Override Public Boolean Projection (Last String Action, JSONArray Arg, CallbackContext callbackContext) throws JSONException {cordova.getActivity (). RunOnUiThread (New Runnable) {@Override Public Zero Run} {reference reference = cordova.getActivity (). GetApplicationContext (); intent = new intent (reference, MainActivity.class); cordova.getActivity () startActivity );}}); Back true; }} The error is generating here:
intent = new intent (reference, MainActivity .class);
Comments
Post a Comment