MCPcopy Index your code
hub / github.com/golang/mobile / load

Method load

app/GoNativeActivity.java:39–60  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

37 }
38
39 private void load() {
40 // Interestingly, NativeActivity uses a different method
41 // to find native code to execute, avoiding
42 // System.loadLibrary. The result is Java methods
43 // implemented in C with JNIEXPORT (and JNI_OnLoad) are not
44 // available unless an explicit call to System.loadLibrary
45 // is done. So we do it here, borrowing the name of the
46 // library from the same AndroidManifest.xml metadata used
47 // by NativeActivity.
48 try {
49 ActivityInfo ai = getPackageManager().getActivityInfo(
50 getIntent().getComponent(), PackageManager.GET_META_DATA);
51 if (ai.metaData == null) {
52 Log.e("Go", "loadLibrary: no manifest metadata found");
53 return;
54 }
55 String libName = ai.metaData.getString("android.app.lib_name");
56 System.loadLibrary(libName);
57 } catch (Exception e) {
58 Log.e("Go", "loadLibrary failed", e);
59 }
60 }
61
62 @Override
63 public void onCreate(Bundle savedInstanceState) {

Callers 2

onCreateMethod · 0.95
getRuneMethod · 0.80

Calls 1

eMethod · 0.45

Tested by

no test coverage detected