android


Can not access com.codename1.impl.android.AndroidNativeUtil From nativeInterface


Can not access com.codename1.impl.android.AndroidNativeUtil From nativeInterface in codenameone as this structure is not available in the CodenameOne.jar.
Do I need to import any other jar in classpath? Need to access the activity of codenameOne from the native interface by the below code:
private static Activity activity() {
return com.codename1.impl.android.AndroidNativeUtil.getActivity();
}
But I am getting this error while deploying:
Compiling with JDK Java compiler API.
/tmp/build313004297852547361xxx/MyApplication/src/main/java/com/mycompany/myapp/MyNativeImpl.java:46: error: cannot find symbol
private static Activity activity() {
^
symbol: class Activity
location: class MyNativeImpl
/tmp/build313004297852547361xxx/MyApplication/src/main/java/com/codename1/impl/android/AndroidImplementation.java:4684: error: cannot find symbol
if (android.support.v4.content.ContextCompat.checkSelfPermission(activity,
^
symbol: method checkSelfPermission(CodenameOneActivity,String)
location: class ContextCompat
/tmp/build313004297852547361xxx/MyApplication/src/main/java/com/codename1/impl/android/AndroidImplementation.java:7117: error: cannot find symbol
if (android.support.v4.content.ContextCompat.checkSelfPermission(activity,
^
symbol: method checkSelfPermission(CodenameOneActivity,String)
location: class ContextCompat
/tmp/build313004297852547361xxx/MyApplication/src/main/java/com/codename1/impl/android/AndroidImplementation.java:7122: error: cannot find symbol
if (!forceAsk && android.support.v4.app.ActivityCompat.shouldShowRequestPermissionRationale(activity,
^
symbol: method shouldShowRequestPermissionRationale(CodenameOneActivity,String)
location: class ActivityCompat
/tmp/build313004297852547361xxx/MyApplication/src/main/java/com/codename1/impl/android/AndroidImplementation.java:7135: error: cannot find symbol
android.support.v4.app.ActivityCompat.requestPermissions(activity,
^
symbol: method requestPermissions(CodenameOneActivity,String[],int)
location: class ActivityCompat
/tmp/build313004297852547361xxx/MyApplication/src/main/java/com/codename1/impl/android/AndroidImplementation.java:7152: error: cannot find symbol
return android.support.v4.content.ContextCompat.checkSelfPermission(activity,
^
symbol: method checkSelfPermission(CodenameOneActivity,String)
location: class ContextCompat
/tmp/build313004297852547361xxx/MyApplication/src/main/java/com/mycompany/myapp/MyNativeImpl.java:56: error: no suitable constructor found for Intent(MyNativeImpl,Class)
Intent intent = new Intent(this,
^
constructor Intent.Intent(String,Uri) is not applicable
(argument mismatch; MyNativeImpl cannot be converted to String)
constructor Intent.Intent(Context,Class) is not applicable
(argument mismatch; MyNativeImpl cannot be converted to Context)
Notice that it will mark it as inaccessible in the IDE but when you send the builds to the servers it should work just fine.
This is mentioned in the native interfaces tutorial.

Related Links

Android and Sails js application to talk to each other
What will be the value of TAG?
What is the difference between MeasureSpec.getSize(widthMeasureSpec) and getWidth()?
Paths on canvas: Small gap between oblique lines or straight lines not on one level? (FILL or FILL_AND-STROKE)
App not working in all devices
ListView ContextAction not following layout
Android Facebook sdk 4.0 : Null exception while getting facebook user information?
Get eNb adn SNR in LTE network
Android Facebook SDK Login work only for my account
My Imageview Stops moving after scaling on Max level
how to prevent my app for video recording [closed]
Cordova location permission triggers onResume every time
Get value of selected radio button which is saved in Firebase, and set it as default state in user profile
file is encrypted or is not a database: , while compiling: select count(*) from sqlite_master;
Android - Video Image is cut from the right side in GLSurfaceView
Find all #Suppress annotation and //noinspection comment that the Lint tool of Android Studio generated before

Categories

HOME
beautifulsoup
eclipse
search
facebook-oauth
jpa
hyperlink
google-spreadsheet
angular-formly
case
pascal
solaris
vscode-extensions
javacc
tivoli
permissions
babeljs
maxscript
bookmarks
rcloud
openstreetmap
distribution
plist
eip
docx
heat
glyphicons
dynamic-sql
standards
joptionpane
strongname
jackson-modules
entity-relationship-model
handler
tpm
google-earth
anki
kudu
autolisp
simplecv
getpixel
lubridate
parse-tree
google-knowledge-graph
modernizr
connection-pool
password-protection
bc
metawidget
datacachefactory
print-css
linter
dotnet-httpclient
mongotemplate
openblas
carrot2
semantic-logging
sundials
py2neo
jtree
vibrate
iotivity
tinkerpop3
vorpal.js
shopping
hadoop-partitioning
sciruby
r-package
microsoft-reporting
batik
viola-jones
mirror
xmltype
openbabel
variadic-templates
ghcjs
encryption-asymmetric
build-script
rcaller
jquery-slider
maven-scm
amslidemenu
light
gtm-oauth2
printdialog
mongohq
nevron
workitem
joomla-template
cascadingdropdown
fragmenttransaction
monotouch.dialog
boost-msm
predicatebuilder
node-redis
flex-mobile
ikimagebrowserview
promotion-code
winmain
massive
dataform
inline-formset
diagrams
load-time
maven-1
isapi-extension
scrollbars
cfwindow
tui
sun
sifr3
great-circle

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App