java - VR-Like App / Issues doubling the output -
i'm doing app testing few images (do / or not) scientific project. isolate person tested he/she vr-glasses (cardboard) person can see images , keyboard klick "good" or "bad".
due i'm a) @ stage 1 learning android developing , b) not using vr-sensors camera, acceration etc. goal create app show 2 images on 50/50 shared screen side side.
for first approach, i've used 5 images in dravable directory, , animated them animationdrawable.
i have few questions far:
to show same image 2 times side side, had use 2 animationdrawable side side - not elegant , efficient. there better way double output of one-time-happening animation?
public class gameactivity extends activity {
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.game); getwindow().addflags(windowmanager.layoutparams.flag_keep_screen_on); imageview myanimation = (imageview) findviewbyid(r.id.spin_animation); final animationdrawable myanimationdrawable = (animationdrawable) myanimation.getdrawable(); myanimation.post( new runnable() { @override public void run() { myanimationdrawable.start(); } }); imageview myanimation1 = (imageview) findviewbyid(r.id.spin_animation1); final animationdrawable myanimationdrawable1 = (animationdrawable) myanimation1.getdrawable(); myanimation1.post( new runnable() { @override public void run() { myanimationdrawable1.start(); } }); } @override public void onwindowfocuschanged(boolean hasfocas) { super.onwindowfocuschanged(hasfocas); view decorview = getwindow().getdecorview(); if (hasfocas) { decorview.setsystemuivisibility( view.system_ui_flag_layout_stable | view.system_ui_flag_layout_hide_navigation | view.system_ui_flag_layout_fullscreen | view.system_ui_flag_hide_navigation // hide nav bar | view.system_ui_flag_fullscreen // hide status bar | view.system_ui_flag_immersive); } }
doing so, lot of "skipped [30-60] frames! application may doing work on main thread.". why that?
is there way randomise output of animationdrawable, or need strategy that?
best!
Comments
Post a Comment