onclick

Android: replace sound of onclick

拥有回忆 提交于 2019-12-25 06:38:21
问题 I have this code: Button boton = (Button) findViewById(R.id.boton); boton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } }); when I push my button (in Android 4.0.3) I ear a basic sound (a simply click); Can I replace it with a personal sound? Or I can use only MediaPlayer to play a costum sound? 回答1: Try this: public class MyActivity extends Activity { public MyActivity(Bundle onSavedStateInstance) { MediaPlayer mp = MediaPlayer.create(this, R.raw

How do I reference the main activity's onClick from within the onClick method of a dialog… or can I?

谁都会走 提交于 2019-12-25 05:27:09
问题 I am trying to do something unusual. I have a main activity with a menu attached to the menu button. One item in the menu opens a dialog to pick a control that is added to the main activity. I have it working so it adds the control, and saves it in a database (so it will be remembered for the next run). I need to set the button's onClickListener to the main activity's onClick. public class MyMainActivity extends Activity implements View.OnClickListener, View.OnTouchListener { private Context

How to play animated GIF from the beginning onclick function

天大地大妈咪最大 提交于 2019-12-25 05:01:34
问题 I have two divs : one for the static image(jpg) and the other one for the animated image (gif) Like this: <div class="badge-animated-container-static gif-post "><img class="badge-item-img" alt="Nunca dos viajes" src="http://127.0.0.1:4001/wordpress/wp-content/uploads/2013/11/nevertwotrips.jpg" /> <span class="play">Play</span></div> <div class="badge-animated-container-animated hide"><img class="badge-item-animated-img" alt="Nunca dos viajes" src="http://127.0.0.1:4001/wordpress/wp-content

php之JavaScript

孤街浪徒 提交于 2019-12-25 04:52:23
JS对于大小写敏感 作用:增加跟html页面的交互性。 应用:验证表单、创建cookies(可插入html页面的编程代码)js插入页面后可由所有现代的浏览器执行。应用于<body></body>或者<head></head>之间。 使用JS 引入标签<script></script> /* 实例测试教程 JS可以写入输出流 JS可以对事件作出反应onclick(“ '' ”); <html> <head> <style type="text/css"> h1{ color:red; margin:2cm 2cm 3cm 2cm; font-size:20px; } hr{ color:#ff000;} p{ color:green; } body{ background-color:yellow; background-image:url(""); } </style> </head> <body> <h1 id="demo"> JS可以对事件作出反应 </h1> <button type="button" onclick="alert('fresh time')">click here</button> <hr > <p>bandeng </p> <p>qianpai weiguan </p> <script> function myFunction() { x=document

Adding to SharedPreference value with multiple onclicklistener

限于喜欢 提交于 2019-12-25 04:52:19
问题 I have multiple on click listeners implemented in the code. But, I want each click from seperate images to be saved in a "ticker" in shared preferences. So, if there are 2 clicks on image 1, 4 clicks on image 2, and 6 clicks on image 3, it totals up to be 12 "clicks" counted in shared prefs. The problem is, every onClickListener seems to overwrite the other, instead of stacking. Any ideas on how to accomplish this? Image1.setOnClickListener(new View.OnClickListener() { SharedPreferences pref

OnClick and onTouch

拥有回忆 提交于 2019-12-25 04:19:46
问题 I have a activity where I have two imagesViews. This to imagesViews has onClickListener, because I need to know which imageView was clicked. After when I click choosen picture I get result which picture was clicked. I Know need the same result but I need to know where exacly I click on this image. I need precise coordinates where this imageView was clicked. I know that in onTouch method I have functions like I need. Can I change onClick method on onTouch? Or in onClick can get precise

ImageButton onlongpress causes onclick as well

回眸只為那壹抹淺笑 提交于 2019-12-25 04:17:32
问题 i have an application with an imagebutton that has both an onclick and an onlongclick listener. However, when the button is long pressed, both of these listeners are executing. Any suggestions? d1.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { selectMode = true; dockNum = 1; sd1.open(); d1.cancelLongPress(); return false; } }); ...d1.setOnClickListener(this); ...case R.id.d1: if(d1s.equals("empty")) { selectMode = true; dockNum = 1; sd1.open(

Android: display the array of values one after the other according to the button click

为君一笑 提交于 2019-12-25 03:38:08
问题 I have an array of 12 integer values and I want to display it one after the other like Initially on application run I am displaying 6 values. on the button click I want to display the other 6 values one by one prevbutton-> value1 value2 value3 value4 value5 value6 -> nextbutton so on next button click it should be like this. next 6 values should be displayed like this prevbutton -> value2 value3 value4 value5 value6 value7 -> nextbutton this should be continued up to the 12 values and reverse

基于jQuery 3D旋转明星人物展示特效

做~自己de王妃 提交于 2019-12-25 02:38:47
分享一款基于jQuery 3D旋转明星人物展示特效。这是一款来自百度换肤活动的明星旋转展示效果。效果图如下: 在线预览 源码下载 实现的代码。 html代码: <div class="s-skin-wrap" data-d=""> <div class="s-skin-inner"> <div class="s-skin-content"> <div class="s-star-wrap" id="s-skin-tshow"> <div class="s-star-list" id="s-star-list"> <ul style="padding: 0px; position: relative;" class="clearfix roundabout-holder"> <li data-scale="0.7509" style="position: absolute; left: -37px; top: 129px; z-index: 3; transform: scale(0.7509); opacity: 0.75;" class="s-star-item s-star-p1 roundabout-moveable-item" data-index="0" data-starid="1016" data-starname="林心如"> <img src="info/413

Jquery click function not loading new content

佐手、 提交于 2019-12-25 02:14:28
问题 For some reason jquery does not load the new html into the #textoPequeno div. It actually removes the old content, that as far as it gets. Here's the html code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head> <link href="css/style.css" media="screen" rel="stylesheet" type="text/css"> <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.min.js"></script>