Questions tagged [android-event]

On Android, there's more than one way to intercept the events from a user's interaction with your application. When considering events within your user interface, the approach is to capture the events from the specific View object that the user interacts with. The View class provides the means to do so. Questions that regard doubt about any type of events action (listeners and handlers), should use this tag to express themselves.

Within the various View classes that you'll use to compose your layout, you may notice several public callback methods that look useful for UI events. These methods are called by the Android framework when the respective action occurs on that object. For instance, when a View (such as a Button) is touched, the onTouchEvent() method is called on that object. However, in order to intercept this, you must extend the class and override the method. However, extending every View object in order to handle such an event would not be practical. This is why the View class also contains a collection of nested interfaces with callbacks that you can much more easily define. These interfaces, called event listeners, are your ticket to capturing the user interaction with your UI.

While you will more commonly use the event listeners to listen for user interaction, there may come a time when you do want to extend a View class, in order to build a custom component. Perhaps you want to extend the Button class to make something more fancy. In this case, you'll be able to define the default event behaviors for your class using the class event handlers.

For a more detailed information you can visit Google oficial webpage about Events at Google Developer - Events

318 questions
1
vote
1 answer

Hidden Spinner does not trigger event

I have a spinner in an Activity, the spinner is hidden initially, but when I load the items into it I initially set the selected item to the index 1, like this: spinner.setSelection(1); This triggers the item selected listener only if the spinner…
Escobar5
  • 3,941
  • 8
  • 39
  • 62
1
vote
1 answer

Handling application events

I am building a cross-platform app for Android and iOS. So far it's mostly Android and I am learning how to use j2objc to translate the code that will later be used by iOS. On the question of architecture the app - how does one go around passing…
0x4B1D
  • 923
  • 1
  • 9
  • 19
1
vote
4 answers

how to get the text of a edit text when after pressing a key

I want to search a ListView when user types a text in a EditText. after pressing a key I need to get the typed part of text to begin the search. so is there any method I can use?? simple help is highly appreciated.
1
vote
1 answer

How to do onBackPress dialog in fragment in android?

I was working on create a dialog that pop up to confirm whether the user exit the page. In the past I used the activity so it has no problem. I just need to put the dialog inside the override onBackPress function, and call finish() if the user…
1
vote
0 answers

pass onTouch event window manager

I need to get the onclick event only on the button, but when the user clicks on the view (windowManager), I want to pass the touch to the fragment behind. My problem is that I get the onclick of the button but I don't know how to pass the event to…
gadosa
  • 71
  • 2
1
vote
1 answer

Android: Error handling onClickListener

I have some activity handling the click event on any view public class MainActivity extends Activity implements OnClickListener{ ... } I have tried to override via this public void onClick(View v) { switch (v.getId()) { case…
LearningBasics
  • 660
  • 1
  • 7
  • 24
1
vote
1 answer

error thread exiting with uncaught exception

code : public class All_view extends ListActivity { // declare class variables private Runnable viewParts; private ItemAdapter m_adapter; Dbhelper mydb =new Dbhelper(this); ArrayList abc = new ArrayList(); Item it=new Item(); String…
1
vote
1 answer

Get accelerometer information (x y z coordinates) in android without access to events

I want to get the android's accelerometer (x y z coordinates) like this code: http://www.techrepublic.com/blog/software-engineer/a-quick-tutorial-on-coding-androids-accelerometer/ (function: onSensorChanged(SensorEvent event)) But I can't to catch…
1
vote
0 answers

How to detect swipe gesture AND button click on ListView

I have an ExpandableListView and I am using a SwipeDetector to know when a row of this list is swiped. The implementation of this dectetor comes from this post. Everything works fine. Then, I have added a Button on each row and I want to be able to…
G.T.
  • 1,557
  • 1
  • 12
  • 24
1
vote
0 answers

RadioGroup in a ScrollView setOnCheckedChangeListener

Friends, I have the following xml file:
Alan Ford
  • 365
  • 1
  • 4
  • 15
1
vote
1 answer

Generate Double Tap Event Android

How do i generate a double tap event on Android. This is the implementation that i have done. $event="/dev/event/event1" $x=$1 $y=$2 sendevent $event 3 57 2421 sendevent $event 3 58 232 sendevent $event 3 53 $x sendevent $event 3 54 $y sendevent…
Naresh Kumar
  • 277
  • 4
  • 18
1
vote
1 answer

Make Radio Button Draggable Android

I want to implement something like this where when I should be able to drag selecting icon from male to female and vise versa. Currently I am doing this by handling click even on text of male or female and replacing the image where the selecting…
user3726986
1
vote
2 answers

Android how to select id of autocompletetextview inside onitemclick overridden function

I have three autoCompleteTextView box as home , work , other . So in home autocomplete box i get a data from server and select one item and that item i stored to home_latlong string. Similarly i have to get value from other autocomplete work which i…
1
vote
1 answer

Get screen on/off event while application is not running

I am currently trying to figure out, how to get the screen on/off event in android. Currently, it works as long as my MainActivity is runnig. But as soon as I close the activity, somehow Sevice and the Receiver stop working aswell (I don't get any…
DonMushroom
  • 442
  • 3
  • 19
1
vote
4 answers

android - overriding back button causes volume buttons stop working

I'm trying to override Back button to stop an audio player and close media player activity, but I noticed that volume buttons are not working anymore. I imagine there is a mistake in overriding code. PS. in my MediaController I override hide()…