android-widget

Android Creating Array of widgets in the XML and reading in activity

≯℡__Kan透↙ 提交于 2019-12-12 01:27:12
问题 In my project i have several TextBoxes which i have to fill dynmically. I have the values to be filled in a list, and i want to apply setText to the text boxes at the time of iterating list. Is this possible to have the name of widget as array type like textbox[1], textbox[2]....... Here in the xml it do not give any error but in the activity class while reading it gives error, findViewById(R.id.textbox[1] //textbox cannot be resolved or is not a field. Is there any other way of manipulating

Multiple, configurable widgets - update issue

江枫思渺然 提交于 2019-12-11 23:24:43
问题 When I'm adding single widget I can configure it properly and it's updated as supposed to after initial configuration. But when I add second and next instances of widget with the same or different configuration onUpdate is not triggered. Well, to be specific onUpdate is executed just before Configuration is set, when Configuration Activity is on top, so it works like: 1 widget - OK 2 widgets - First OK, Second not updated 3 widgets - First OK, Second OK, Third not updated and so on. Behavior

Uncheck ToggleButton after some period of time

故事扮演 提交于 2019-12-11 23:08:32
问题 I want my ToggleButton to be unchecked after some period of time when i check it. I am using Timer and TimerTask but my application always force close when i try to do this. This is the code: public class Vjezba5Activity extends Activity { TimerTask TimerTask11; Timer timer1 = new Timer(); /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final ToggleButton TB1 =

ListAdapter lifecycle and screen rotation for canceling a AsyncTask

本小妞迷上赌 提交于 2019-12-11 23:06:55
问题 I have a asynctask that I cancel when the view is destoried via onDestoryView(). This problem is I do "downloader.cancel(true);" and it wont cancel. In fact, it will return false. Currently, it references the ListAdapter to add items to it. However when I turn the screen to landscape, the ListAdapter is null during the onPostExecute. I cannot figure out when the ListAdapter becomes null. I have tried both onDestory and onDestoryView to cancel the asynctask before the ListAdapter becomes null

Can't call setFormat24Hour of a TextClock in a Widget

a 夏天 提交于 2019-12-11 22:19:58
问题 I'm trying to dynamically update the format24Hour of my Widget's TextClock. To do so I'm using RemoteViews like so: RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.clockwidget); views.setString(R.id.textclock, "setFormat24Hour", formatString24.toString()); appWidgetManager.updateAppWidget(appWidgetId, views); This however causes my Widget to show "Problem loading Widget" and logcat shows 03-31 17:37:19.872: W/AppWidgetHostView(1408): updateAppWidget couldn't find any

Electricity meter-like view - Android

僤鯓⒐⒋嵵緔 提交于 2019-12-11 21:13:15
问题 I am trying to include a widget / view in my Android app that displays a number and when the number is incremented, the new number slides into view as if each digit was on a rolling dial. In the UK (at least), electricity meters work in this way. Examples would be: See app image of https://play.google.com/store/apps/details?id=ie.esb.app.android See screenshots of http://www.appszoom.com/android_applications/lifestyle/using-the-power-meter-in-tokyo_vvfi.html A Google image search for "android

Android Widget Update service, multiple onclick listeners

♀尐吖头ヾ 提交于 2019-12-11 21:05:58
问题 I have the following widget service which updates a text view when I click on my one button. UpdateWidgetService: ipublic class UpdateWidgetService extends Service { private static final String LOG = "widgetService"; private static final String MyOnClick1 = "myOnClickTag1"; private static final String MyOnClick2 = "myOnClickTag2"; private static final String MyOnClick3 = "myOnClickTag3"; static LocationClient mLocationClient; @Override public void onStart(Intent intent, int startId) { Log.i

Cursor control in EditText

試著忘記壹切 提交于 2019-12-11 20:49:10
问题 Ok, this is about to drive me nuts. I'm still a newbie (and maybe an idiot) but this one has had me running in circles. I'm trying to implement cursor control in an editText via soft buttons (left, right, up down). From what I've researched, it looks like I need the methods in the Selection object like moveUp(), moveLeft(), extendUp() etc. but they all need a "text.layout" object and I don't know how to get one. Am I on the right track? Help? 回答1: It sounds like you want to use a

Horizontal ScrollView full Scroll focus right with ViewTreeObserver

柔情痞子 提交于 2019-12-11 20:39:17
问题 I am adding the objects into the horizontal scrollview dynamically and when i add the code below works fine to move extreme right, now the problem is when i try to scroll back to left side via swapping finger the code below again runs and horizontal scrollview scrolls to the right corner again, its a bit annoying, anyone has some alternate solution, I ve tried the Postdelayed() but it doesnt work properly for me ViewTreeObserver viewTreeObserver = hScrollView.getViewTreeObserver(); if

Android -How do i make the Spinner to show the item after selecting the Items from the Spinner?

亡梦爱人 提交于 2019-12-11 20:04:26
问题 This is my code: package com.testotspeech; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.Locale; import android.app.Activity; import android.os.Bundle; import android.speech.tts.TextToSpeech; import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemSelectedListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import