onclick

how to set an onclick listener for an imagebutton in an alertdialog

允我心安 提交于 2019-12-03 05:15:58
I have a layout with an ImageButton that is inflated in an AlertDialog, where/how should I set an onClick listener? Here's the code I tried using: ImageButton ib = (ImageButton) findViewById(R.id.searchbutton); ib.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast.makeText(TravelBite.this, "test", Toast.LENGTH_SHORT).show(); } }); Jaydeep Khamar Try to put like this in ur code e.g:-if your alertdialog's object is ad,then ImageButton ib = (ImageButton) ad.findViewById(R.id.searchbutton); ib.setOnClickListener(new View.OnClickListener() { @Override

onclick event pass <li> id or value

≡放荡痞女 提交于 2019-12-03 04:46:05
I want to pass <li> id or value in onclick event. here is my exiting code. <li onclick="getPaging(this.value)" id="1" value="1">1</li> <li onclick="getPaging(this.value)" id="2" value="2">2</li> here is the javascript code function getPaging(str) { $("#loading-content").load("dataSearch.php?"+str, hideLoader); } Anish Try like this... <script> function getPaging(str) { $("#loading-content").load("dataSearch.php?"+str, hideLoader); } </script> <li onclick="getPaging(this.id)" id="1">1</li> <li onclick="getPaging(this.id)" id="2">2</li> or unobtrusively $(function() { $("li").on("click",function

javascript onclick increment number

我与影子孤独终老i 提交于 2019-12-03 04:38:32
问题 With javascript, how can I do it so when i click a form button it adds 1 to a number? The number it increments could be in a form text field or something. Obviously it'd be on onclick but I'm not sure of the code. 回答1: Since you gave me nothing to start on, here is a simple example. jsFiddle Example implementation: function incrementValue() { var value = parseInt(document.getElementById('number').value, 10); value = isNaN(value) ? 0 : value; value++; document.getElementById('number').value =

How to use CrawlSpider from scrapy to click a link with javascript onclick?

僤鯓⒐⒋嵵緔 提交于 2019-12-03 04:34:20
I want scrapy to crawl pages where going on to the next link looks like this: <a href="#" onclick="return gotoPage('2');"> Next </a> Will scrapy be able to interpret javascript code of that? With livehttpheaders extension I found out that clicking Next generates a POST with a really huge piece of "garbage" starting like this: encoded_session_hidden_map=H4sIAAAAAAAAALWZXWwj1RXHJ9n I am trying to build my spider on the CrawlSpider class, but I can't really figure out how to code it, with BaseSpider I used the parse() method to process the first URL, which happens to be a login form, where I did

Implement onClick only for a TextView compound drawable

北城余情 提交于 2019-12-03 04:29:46
I need to have some text with a drawable on the left and I want to execute some code when the user clicks/touches the image (only the image, not the text), so I used a LinearLayout with a TextView and an ImageView which is clickable and launches an onClick event. The XML parser suggests me to replace this with a TextView with a compound drawable , which would draw the same thing with far less lines of XML .. My question is "can I specify I want to handle an onClick event only on the drawable of the TextView and not on the TextView itself? I've seen some solutions which involves writing your

How to toggle font awesome icon on click?

一个人想着一个人 提交于 2019-12-03 04:08:02
问题 I am using font awesome 'plus' icon on expandable categories list items. When they are in expanded state i want to show a 'minus' sign' HTML <ul id="category-tabs"> <li><a href="javascript:void"><i class="fa fa-fw"></i>Category 1</a> <ul> <li><a href="javascript:void">item 1</a></li> <li><a href="javascript:void">item 2</a></li> <li><a href="javascript:void">item 3</a></li> </ul> </li> </ul> Jquery $('#category-tabs li a').click(function(){ $(this).next('ul').slideToggle('500'); }); 回答1: You

Android: How to propagate click event to LinearLayout childs and change their drawable

回眸只為那壹抹淺笑 提交于 2019-12-03 03:49:51
问题 I would like to create a linear layout which would behave similarly to ImageButton. <LinearLayout android:id="@+id/container" style="?WidgetHomeIconContainer"> <ImageView android:id="@+id/icon" style="?WidgetHomeIcon" /> <TextView android:id="@+id/title" style="?WidgetHomeLabel" android:text="@string/title" android:textAppearance="?attr/TextHomeLabel" /> </LinearLayout> In styles of ImageView, TextView and LinearLayout, I set a selectors for all states. Now: when I click on ImageView (I tried

Android views expand animation

浪尽此生 提交于 2019-12-03 03:42:38
I'm trying to edit these source to create a simple function that will work on all of my views. @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); RelativeLayout mLayout1 = (RelativeLayout) findViewById(R.id.layout1); RelativeLayout mLayoutToBeExpanded1 = (RelativeLayout) findViewById(R.id.layout_exp_1); addAction(mLayout, mLayoutToBeExpanded); RelativeLayout mLayout2 = (RelativeLayout) findViewById(R.id.layout2); RelativeLayout mLayoutToBeExpanded2 = (RelativeLayout) findViewById(R.id.layout_exp_2); addAction(mLayout2,

how to pass this element to javascript onclick function and add a class to that clicked element

时光怂恿深爱的人放手 提交于 2019-12-03 03:25:20
问题 I had an html navigation code as below function Data(string) { //1. get some data from server according to month year etc., //2. unactive all the remaining li's and make the current clicked element active by adding "active" class to the element $('.filter').removeClass('active'); $(this).addClass('active'); } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="row" style="padding-left:21px;"> <ul class="nav nav-tabs" style="padding-left:40px;">

Play a moving waveform for wav audio file in html

匿名 (未验证) 提交于 2019-12-03 03:05:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: How to create a moving waveform for a audio file/tag in HTML? When play button is clicked,the audio HTML element must be played and a corresponding moving waveform for the same should be generated....how to implement this? <html> <head> <meta http-equiv = "Content-Type" content = "text/html; charset=iso-8859-1" /> <title id = 'title' > HTML Page setup Tutorial </title> <script src = 'riffwave.js' ></script> <script type = "text/javascript" > function myFunction () { var data = []; // just an array for ( var i = 0 ; i < 10000 ; i ++