touch-event

Lock ontouch listener

那年仲夏 提交于 2019-12-12 03:09:35
问题 I want to lock the ontouch listener when the animation is being played. this is my code. public class MainActivity extends Activity implements OnTouchListener { boolean gifIsPlaying; long PLAYING_TIME_OF_GIF = 111; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); GIFWebView view = new GIFWebView (this, "file:///android_asset/imageedit_ball.gif"); gifIsPlaying = true; new Handler().postDelayed(new

Disable Hold Box on ie11 W8.1 Touch Device

被刻印的时光 ゝ 提交于 2019-12-12 01:38:52
问题 When using my Windows Touch Device, holding down on an area results in a an expanding box appearing which extends to about two centimetres squared. Letting go will then result in the right click menu appearing. The problem is that I want to disable the box and the menu from appearing. I have managed to prevent the context menu from appearing, but I am still left with the box. I believe the box is interfering with other functionality I have on the page. Any help much appreciated, Thanks UPDATE

Making onTouchEvent play nice with OnItemClickListener

谁都会走 提交于 2019-12-11 20:43:48
问题 I have implemented a custom TextView class so that I can handle touch and touch release events for TextView s that exist in a GridView . I got that to work well. However, I also had set up OnItemClickListener for the GridView so I can handle that event and run code in the main fragment - on click wouldn't be appropriate to handle in the custom TextView class itself. But now that I have implemented both of those they are conflicting and the event to release the touch is not being triggered now

Issue With Sound Manager Playing Random Files

随声附和 提交于 2019-12-11 18:09:09
问题 I am trying to use the SoundManager to randomly play a 30 second sound bite while simultaneously starting an animation sequence (flashing graphic) triggered by an onTouch event. For whatever reason, the sound bite is clipped after about 5 seconds of playback and I can't figure out why. Any thoughts? Also after testing, it appears that the will not play until a minute or so after the initial onTouch event. public class Soundboard extends Activity { private SoundManager mSoundManager; /**

Android SurfaceView onTouchEvent not getting called

雨燕双飞 提交于 2019-12-11 11:30:32
问题 I'm developing a game using SurfaceView which listens to touch events. The onTouchEvent method in SurfaceView works fine for many of the devices, but in some devices, sometimes it doesn't get called (Moto X Style is the one) and my app also stops responding. I guess that this might be due to the overloading of main thread due to which onTouchEvent is starving. Could some Android experts over here give me some tips to reduce the load on main thread if it's getting overloaded, or there might be

How to detect multiple files selection with touch screen on mobile devices

╄→尐↘猪︶ㄣ 提交于 2019-12-11 10:53:16
问题 I need to count the number of selected files during a multiple selection by clicking on a input type="file" element of a form. I'm writing the code on my laptop and everything is working fine with this code: function counter() { var inputUploader = document.querySelector('input[type="file"]'), chosenFiles = inputUploader.files, filesCount = chosenFiles.length > 1 ? chosenFiles.length : chosenFiles.length; alert(filesCount); } <form> <div> <input id="inputUploader" type="file" name="x"

Same touch listener is called multiple times

隐身守侯 提交于 2019-12-11 07:32:44
问题 I have multiple ImageViews on my screen. Whenever the user moves his finger over one or multiple of them, I want the ones the finger touched, to be removed and create new ImageViews. @Override public boolean onTouch(View view, MotionEvent motionEvent) { ((ViewGroup) view.getParent()).removeView(view); createNewImageViews(); return true; } The problem is, that my app crashes. I think the reason is, that a touchlistener is called again, that already deleted its view and tries to delete it again

How to check if the screen hasn't been clicked in Android?

半城伤御伤魂 提交于 2019-12-11 03:19:23
问题 I know that if you want to check if someone clicked on something, you would do if(event.getAction() == MotionEvent.ACTION_DOWN) But I want to check if the screen hasn't been clicked at all. What is the code I would produce in order to do this? Also, as a side note, would it be a good idea to have all the classes in an Android app extend the View classes? 回答1: Create a boolean variable called istouched and use onTouchLisener on your top most View actually its a Window that's where your View s

How to test touch events using desktop browser?

匆匆过客 提交于 2019-12-11 01:57:40
问题 I want to write some test cases for touch events. In my code I have the following logic to decide whether it is on touch devices. if(document.documentElement.ontouchstart !== undefined) { //content that I want to write test cases about } Now I want to fake document.documentElement.ontouchstart not to be undefined , so the inside logic will be executed. I tried using Sinon.js 's stub to assign an empty function to document.documentElement.ontouchstart . But it will throw an error indication

wpf microsoft surface app — touch won't trigger

邮差的信 提交于 2019-12-10 23:57:07
问题 I'm building out my first touch application on a Microsoft Surface Pro 3 device, in Visual Studio 2010 with the Surface SDK 2.0, and I'm having trouble with touch events. Click events are firing just fine, but none of the touch, previewtouch, or manipulation events are firing. I can't find any question posted online regarding such a simple issue with touch. In surface app code examples, I can't figure out what I'm doing differently. Any ideas? Thanks XAML: <s:SurfaceWindow x:Class=