关于Unity调用android jar 求大神看下代码

需要用unity去调用android的jar jar里面是个浮动框的代码 浮动框的图片打包在assets里面

public class TTest extends UnityPlayerActivity {
    
    InterFace inter;
    Put p = new Put();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }
    public void Input(){    
           p.Dosome(null, inter);
    }
}

一下是浮动框代码

public Put extend Activity{
public void Dosome(Activity activity,Inter inter){
        Log.i("TEST","------>")        
display = Put.this.getWindowManager().getDefaultDisplay();
        mWM = (WindowManager) Put.this.getSystemService(Put.this.WINDOW_SERVICE);
        ivCursor = new ImageView(Put.this);
        try {
            Drawable drawable = Drawable.createFromStream(Put.this.getAssets().open("tom.jpg"), "tom");
            ivCursor.setImageDrawable(drawable);
            //ivCursor.setBackground(new BitmapDrawable(BitmapFactory.decodeStream(activity.getAssets().open("Tom.jpg"))));
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        //ivCursor.setImageResource(MResource.getIdByName(activity.getApplication(),"drawable","tom"));
        mParams = new WindowManager.LayoutParams();// 对ivCursor对象的参数描述对象
        mParams.height = WindowManager.LayoutParams.WRAP_CONTENT;
        mParams.width = WindowManager.LayoutParams.WRAP_CONTENT;
        mParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;// 设置成不能获取焦点
        mParams.type = LayoutParams.TYPE_PHONE;
        // 设置图片格式,效果为背景透明
        mParams.format = PixelFormat.RGBA_8888;
        mParams.gravity = Gravity.TOP | Gravity.LEFT;
        mParams.x = 0;// 相对于屏幕原点的x轴距离
        mParams.y = 0;// 相对于屏幕原点的y轴距离
        System.out.println("<-----");
        mWM.addView(ivCursor, mParams);
    }

}

就这样值打出第一个log 就完事了 那个浮动框也没显示 这是怎么回事啊 求大神帮忙解释下啊

查看回复