This repository was archived by the owner on Nov 17, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
docs/core-concepts/android-runtime/advanced-topics Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,9 @@ The core modules ship with a default `android.support.v7.app.AppCompatActivity`
108
108
const superProto = android.support.v7.app.AppCompatActivity.prototype;
109
109
android.support.v7.app.AppCompatActivity.extend("org.myApp.MainActivity", {
110
110
onCreate: function(savedInstanceState) {
111
+ // Set the isNativeScriptActivity in onCreate (as done in the original NativeScript activity code)
112
+ // The JS constructor might not be called because the activity is created from Android.
113
+ this.isNativeScriptActivity = true;
111
114
if(!this._callbacks) {
112
115
frame.setActivityCallbacks(this);
113
116
}
@@ -144,9 +147,14 @@ The core modules ship with a default `android.support.v7.app.AppCompatActivity`
144
147
145
148
@JavaProxy("org.myApp.MainActivity")
146
149
class Activity extends android.support.v7.app.AppCompatActivity {
150
+ public isNativeScriptActivity;
151
+
147
152
private _callbacks: AndroidActivityCallbacks;
148
153
149
154
public onCreate(savedInstanceState: android.os.Bundle): void {
155
+ // Set the isNativeScriptActivity in onCreate (as done in the original NativeScript activity code)
156
+ // The JS constructor might not be called because the activity is created from Android.
157
+ this.isNativeScriptActivity = true;
150
158
if (!this._callbacks) {
151
159
setActivityCallbacks(this);
152
160
}
You can’t perform that action at this time.
0 commit comments