android-event

How to handle ListView Item LongPress gesture

瘦欲@ 提交于 2020-01-23 11:52:53
问题 i have small issues in event handling , i have List view custom adapter data , each row having date , title , price . when i click on row i need to display details page but when i long press on price , date or title i need to sort the list view. i need to use gesture for on Long Press. please refer below code what i have tried. Custom Adapter View public EventAdapterView(Context context, List<EventUtil> eventList) { this.mContext = context; this.mEventUtil = eventList; mLayoutInflater =

How to exit the android application on backpress?

倖福魔咒の 提交于 2020-01-11 07:37:06
问题 The situation could be like say, I've 5 activities. Say Main activity, Activity 1, Activity 2, Activity 3 and Activity 4. One can use the Activity 1,2,3 & 4 directly with the help of buttons so inserted on Main Activity layout. Situation: User enters into the Main Activity, and presses a button to enter into Activity 2. Then he back presses and comes back to Main Activity. from there he now enters Activity 3 with the help of another button and similarly when he presses back button he enters

A method for waiting for sensor data

空扰寡人 提交于 2020-01-11 07:13:59
问题 I have a class which initiates a sensor listener when it is started. This listener writes the latest sensor value to a variable when an event is triggered. The class goes on to do some logic, and at some point, will check this variable and proceed depending on the value. My issue is that there's no guarantee that there is any value when the variable is read, since Android sensor listeners only trigger an event when the sensor value changes (and don't necessarily trigger an event as soon as

Show Dialog using PendingIntent

ぐ巨炮叔叔 提交于 2020-01-10 02:01:17
问题 I am working on Calender Events reminder . There is no native Calender events reminder in Android so user install different calender apps. Now these apps can be different on reminding events like on reminder notifications can be shown. Now I want that I set an event programmatically in these event calender apps and on time reached not show any notification rather a pop up message will be shown with alarm like sound. At that I using a code from that site . Its working but it showing reminders

Android LinearLayout make button doesn't work

天大地大妈咪最大 提交于 2019-12-24 08:57:05
问题 I have many buttons in my layout and they work well. I want to put the two buttons on the same row, so I make a LinearLayout horizontal, but when I do that, the second button's click event doesn't work. It doesn't show me my textview <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <Button android:id="@+id/bAnswerQuestoinShowChoices" android:layout_width="wrap

android: EXDATE format when adding a calendar event

╄→гoц情女王★ 提交于 2019-12-24 08:48:43
问题 Can someone explain how to use EXDATE when adding event to android calendar? The documentation is pretty unclear about the format in which the EXDATE should be put. I tried many formats, these are some of them: values.put(Events.EXDATE, "TZID=Europe/London:20130116T080000"); values.put(Events.EXDATE, "20130116T080000Z"); values.put(Events.EXDATE, "20130116T080000"); values.put(Events.EXDATE, "20130116"); but none of them works. Any idea how to make an event not appear on a particular date, if

android create textViews in tableRows programmatically

雨燕双飞 提交于 2019-12-24 06:45:37
问题 I have these three lists with the same number of elements List<String>competitoinsIDs = new LinkedList<String>(); List<String>marks = new LinkedList<String>(); List<String>numOfQuestions = new LinkedList<String>(); I want to put the first element of each list in a tablerow , then the second element of each list in another tablerow, would you help me please, this is the xml <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout

OnKey event dispatched twice when I type some text into a textbox. How to prevent?

 ̄綄美尐妖づ 提交于 2019-12-24 06:31:15
问题 during my debug sessions I found a strange thing occurring. I have an EditText control for which I defined the current activity as OnKeyListener to perform validation while user types. Code txtPhoneNumber.setOnEditorActionListener(this); txtPhoneNumber.setOnKeyListener(this); txtPhoneNumber.setOnFocusChangeListener(this); @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { String phoneNumber = ((TextView) v).getText().toString(); if (phoneNumber != null && !""

Android : Set reminder functionality

爱⌒轻易说出口 提交于 2019-12-24 04:19:52
问题 I am developing an application with reminder functionality. The code i used is as follows to set the reminder and event: private void addReminder(int statrYear, int startMonth, int startDay, int startHour, int startMinut, String title){ // Convert start of begin time of reminder in milliseconds. Calendar beginTime = Calendar.getInstance(); beginTime.set(statrYear, startMonth, startDay, startHour, startMinut); long startMillis = beginTime.getTimeInMillis(); // String to access default google

Android - Listener for catching changes in a View's properties (e.g. android:layout_marginTop)

こ雲淡風輕ζ 提交于 2019-12-23 09:26:07
问题 In Android, can you create a Listener for catching changes in a View's properties (width / height / margin / position relative to top of the screen)? I want to trigger an event when layout_marginTop="10dp" is changed to a different value. 回答1: What about implementing a OnLayoutChangeListener that gets called when a View is moved due to Layout Change new View().addOnLayoutChangeListener(new OnLayoutChangeListener() { @Override public void onLayoutChange(View v, int left, int top, int right,