Package com.chaquo.python.android
Class AndroidPlatform
- java.lang.Object
-
- com.chaquo.python.Python.Platform
-
- com.chaquo.python.android.AndroidPlatform
-
public class AndroidPlatform extends Python.Platform
Platform for Chaquopy on Android.
-
-
Constructor Summary
Constructors Constructor Description AndroidPlatform(Context context)Uses theApplicationcontext of the given context to initialize Python.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ApplicationgetApplication()Returns the Application context of the context which was passed to the contructor.StringgetPath()Returns the value to assign toPYTHONPATH, ornullto leave it unset.voidonStart(Python py)Called after Python is started.voidredirectStdioToLogcat()Redirects the native stdout and stderr streams to Logcat.
-
-
-
Constructor Detail
-
AndroidPlatform
public AndroidPlatform(@NotNull Context context)Uses theApplicationcontext of the given context to initialize Python.
-
-
Method Detail
-
getApplication
@NotNull public Application getApplication()
Returns the Application context of the context which was passed to the contructor.
-
redirectStdioToLogcat
public void redirectStdioToLogcat()
Redirects the native stdout and stderr streams to Logcat. They will appear with the tags
native.stdoutandnative.stderrrespectively. This may be useful for debugging the Python startup process, or seeing messages produced by non-Python libraries.This method has no effect on stdin. It also has no effect on Python's
sys.stdoutandsys.stderr, which are always redirected as described here.
-
getPath
@NotNull public String getPath()
Description copied from class:Python.PlatformReturns the value to assign toPYTHONPATH, ornullto leave it unset. The default implementation returnsnull.- Overrides:
getPathin classPython.Platform
-
onStart
public void onStart(@NotNull Python py)Description copied from class:Python.PlatformCalled after Python is started. The default implementation does nothing.- Overrides:
onStartin classPython.Platform
-
-