Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 29457

use custom application class in native module android library

$
0
0

I have created an android native module and trying to call some method of this module after bridging with react native module.

RN World:

NativeModle.ModuleName.someMethod()

Android world:

@ReactMethod
fun someMethod(){
  context.startActivity(new Intent(MainActivity.class,context));
}

But in my android native module i have a CustomApplication class which provide necessary things to function other class like some FileProvider , SharedPreferenceProvide etc. While calling Mainactivity the code in Mainactivity also requires some things from CustomApplication class . But as the android native module is a library module (application tag is neglected in library module) I am not able to provide some things to Mainactivity class causing NullPointerException.

Solution could be: Not keeping any application class and provide it through some other manner . But I have no much idea about library development . Suggest me the best idea to achieve this scenario.


Viewing all articles
Browse latest Browse all 29457

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>