android - Troubles with overlay window -


i'm writing android application simulates mouse. used code pocketmagic.com cursor overlay , on droid maxx (4.4.4) works on minix neo x5 mini (4.4.2) (set top box) doesn't here's code

mview = new overlayview(this);     windowmanager.layoutparams params = new windowmanager.layoutparams(             windowmanager.layoutparams.wrap_content,             windowmanager.layoutparams.wrap_content,             windowmanager.layoutparams.type_system_overlay,//type_system_alert,//type_system_overlay,             windowmanager.layoutparams.flag_not_focusable | windowmanager.layoutparams.flag_not_touchable |                     windowmanager.layoutparams.flag_layout_in_screen, //will cover status bar well!!!             pixelformat.translucent);     params.gravity = gravity.left | gravity.top;     params.settitle("cursor");     windowmanager wm = (windowmanager) getsystemservice(window_service);     wm.addview(mview, params); 

and

class overlayview extends viewgroup { private paint mloadpaint; boolean mshowcursor;  bitmap cursor; public int x = 0,y = 0;  public void update(int nx, int ny) {     x = nx; y = ny; } public void showcursor(boolean status) {     mshowcursor = status; } public boolean iscursorshown() {     return mshowcursor; }  public overlayview(context context) {     super(context);     cursor = bitmapfactory.decoderesource(context.getresources(), r.drawable.ic_cursor);      mloadpaint = new paint();     mloadpaint.setantialias(true);     mloadpaint.settextsize(10);     mloadpaint.setargb(255, 255, 0, 0); }  @override protected void ondraw(canvas canvas) {     super.ondraw(canvas);     //canvas.drawtext("hello world", 0, 0, mloadpaint);     if (mshowcursor) canvas.drawbitmap(cursor,x,y,null); }  @override protected void onlayout(boolean arg0, int arg1, int arg2, int arg3, int arg4) { }  @override public boolean ontouchevent(motionevent event) {     return true; } 

}

try decreasing api level , min sdk requirement , see if works.


Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -