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 theApplication
context of the given context to initialize Python.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Application
getApplication()
Returns the Application context of the context which was passed to the contructor.String
getPath()
Returns the value to assign toPYTHONPATH
, ornull
to leave it unset.void
onStart(Python py)
Called after Python is started.void
redirectStdioToLogcat()
Redirects the native stdout and stderr streams to Logcat.
-
-
-
Constructor Detail
-
AndroidPlatform
public AndroidPlatform(@NotNull Context context)
Uses theApplication
context 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.stdout
andnative.stderr
respectively. 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.stdout
andsys.stderr
, which are always redirected as described here.
-
getPath
@NotNull public String getPath()
Description copied from class:Python.Platform
Returns the value to assign toPYTHONPATH
, ornull
to leave it unset. The default implementation returnsnull
.- Overrides:
getPath
in classPython.Platform
-
onStart
public void onStart(@NotNull Python py)
Description copied from class:Python.Platform
Called after Python is started. The default implementation does nothing.- Overrides:
onStart
in classPython.Platform
-
-