小编use*_*293的帖子

错误:com.MyApp.Main类型的预期接收者,但得到了java.lang.Class <com.MyApp.Main>

我正在尝试将类导入MVEL的实现,我收到以下错误:

[错误:com.MyApp.Main类型的预期接收者,但得到了java.lang.Class]

这是设置MVEL的方法:

public void runCode() {
 final String theCode = "Main.sendText();";
        System.setProperty("java.version", "1.6");

        new Thread(new Runnable() {

        public void run() {

            ParserContext context = new ParserContext();
            context.addImport("Main", Main.class);                      
            Serializable compiled = MVEL.compileExpression(theCode, context); // compile the expresion

                HashMap vars = new HashMap();
                vars.put("x", new Integer(10));
                vars.put("y", new Integer(10));

                Integer result = (Integer) MVEL.executeExpression(compiled, vars);          
        }
    }).start();
}
Run Code Online (Sandbox Code Playgroud)

Main.class:

public void sendText(){
System.out.println("Success!");
}
Run Code Online (Sandbox Code Playgroud)

logcat的:

08-05 20:23:31.900: E/AndroidRuntime(19968): FATAL EXCEPTION: Thread-30751
08-05 20:23:31.900: E/AndroidRuntime(19968): [Error: expected receiver of type com.MyApp.Main, …
Run Code Online (Sandbox Code Playgroud)

android mvel

3
推荐指数
1
解决办法
4581
查看次数

如何将UIColor转换为Android颜色(packed int)?

我已经在移动开发方面做了很多事情,我自己搞清楚事情,但是我很难解决这个问题......

我正在使用此宏将Android color(packed int)转换为UIColor:

#define ANDROID_COLOR(c) [UIColor colorWithRed:((c>>16)&0xFF)/255.0 green:((c>>8)&0xFF)/255.0 blue:((c)&0xFF)/255.0  alpha:((c>>24)&0xFF)/255.0]
Run Code Online (Sandbox Code Playgroud)

但是我还需要将UIColor转换为Android颜色.很感谢任何形式的帮助!

android ios

2
推荐指数
1
解决办法
1393
查看次数

标签 统计

android ×2

ios ×1

mvel ×1