gpt4 book ai didi

java - 在 Activity 中调用 Runnable 类

转载 作者:行者123 更新时间:2023-12-02 07:55:33 24 4
gpt4 key购买 nike

我有一个可运行类,是否可以在 Activity 中调用此可运行类?

这是我的类(class):

public class TstClass implements Runnable {

static boolean m_bret = false;
static String m_szconfig = "-i";
private int n_stat;
public native String unimplementedStringFromJNI();


static {
try {
System.out.println ( "[AdDBCache] Module load try ffmpeg : " + System.getProperty("java.library.path"));
System.loadLibrary("tstjni");
System.out.println ( "[AdDBCache] Module load success");

} catch ( Exception e ) {
System.out.println ( "[AdDBCache] Module load err : " + System.getProperty("java.library.path"));
}
}

private static synchronized final native int mod_run (String name, String sztoken );

public void set_config ( String sz_config ) {
m_szconfig = sz_config;
}


public void run_core ( String sz_file, String sz_token ) {
m_bret = false;
n_stat = mod_run ( m_szconfig, sz_token );
m_bret = true;
}


public void run () {
run_core ("", "");
}

}

Logcat 错误:

03-14 17:53:11.405: E/AndroidRuntime(2605): FATAL EXCEPTION: Thread-8
03-14 17:53:11.405: E/AndroidRuntime(2605): java.lang.UnsatisfiedLinkError: mod_run
03-14 17:53:11.405: E/AndroidRuntime(2605): at com.parsapp.actionmovie.ffmpeg.mod_run(Native Method)
03-14 17:53:11.405: E/AndroidRuntime(2605): at com.parsapp.actionmovie.ffmpeg.run_core(ffmpeg.java:31)
03-14 17:53:11.405: E/AndroidRuntime(2605): at com.parsapp.actionmovie.ffmpeg.run(ffmpeg.java:37)
03-14 17:53:11.405: E/AndroidRuntime(2605): at java.lang.Thread.run(Thread.java:1096)

最佳答案

您尝试过以下方法吗?您遇到什么问题了吗?

TstClass tst = new TstClass();
new Thread(tst).start();

文档:http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/Thread.html

关于java - 在 Activity 中调用 Runnable 类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9707104/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com