You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- <code>pn.Page</code> stores the Android <code>Activity</code> so components like <code>pn.Button()</code> and <code>pn.Label()</code> can construct their native counterparts.
833
869
- If you construct views before the <code>Page</code> is created on Android, a runtime error will be raised because no <code>Context</code> is available.</p>
<p>APIs are intentionally small and grow progressively in later releases. Properties and setters are kept consistent where supported by both platforms.</p>
883
+
<h2id="platform-detection-and-android-context">Platform detection and Android context<aclass="headerlink" href="#platform-detection-and-android-context" title="Permanent link">¶</a></h2>
884
+
<ul>
885
+
<li>Use <code>pythonnative.utils.IS_ANDROID</code> for platform checks when needed.</li>
886
+
<li>On Android, <code>Page</code> records the current <code>Activity</code> so child views can acquire a <code>Context</code> implicitly. Constructing views before <code>Page</code> initialization will raise.</li>
<spanclass="n">stack</span><spanclass="o">.</span><spanclass="n">add_view</span><spanclass="p">(</span><spanclass="n">pn</span><spanclass="o">.</span><spanclass="n">Label</span><spanclass="p">(</span><spanclass="s2">"Hello from PythonNative!"</span><spanclass="p">))</span>
<li>If <code>gradlew</code> fails due to JDK path on macOS, ensure <code>JAVA_HOME</code> is set (the CLI attempts to detect Homebrew <code>openjdk@17</code>).</li>
883
+
<li>Ensure an Android emulator or device is available for <code>installDebug</code>.</li>
0 commit comments