android-widget

How do I specify EditText inputType as number and password?

℡╲_俬逩灬. 提交于 2019-12-28 16:31:12
问题 I have the following: <EditText android:inputType="number" android:password="true" .... </EditText> I'm getting a warning that "android:password" is deprecated and that I should use inputType instead. Is there a way to specify inputType as number and password? 回答1: Set android:inputType="numberPassword" See this Link 回答2: you should use TYPE_CLASS_NUMBER. EDIT: As this answer android:inputType="textPassword|number" ignore textPassword and only accept number but not password . So you should

Implementing OnClickListener for dynamically created buttons in Android

孤街浪徒 提交于 2019-12-28 05:35:17
问题 I dynamically created buttons through code rather than from XML. The code is as below : dynamicview = (LinearLayout)findViewById(R.id.llayout); LinearLayout.LayoutParams lprams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); for(int i=0;i<nob;i++){ Button btn = new Button(this); btn.setId(i+1); btn.setText("Button"+(i+1)); btn.setLayoutParams(lprams); dynamicview.addView(btn); } I am not finding a way in which I can implement

Wrong item being passed to activity from widget

久未见 提交于 2019-12-25 11:58:13
问题 I have a widget that is using a collection. What I need is to pass an id, from the widget, to an activity in my app when one of the rows of the widget ListView is selected. For some reason, when I debug activity, the wrong id is being sent. I've narrowed it down to something with the position. If I pass the position to my activity when I debug, it is the wrong position It may just be my misunderstanding of how a widget with a collection works, since it's my first one. Widget Service public

Android Widget+Service

谁说胖子不能爱 提交于 2019-12-25 08:13:55
问题 I have a music player which plays music using a service,all the broadcast receivers within that service are defined inside the service and not externally. I am totally new to widgets so i had been seeing a few tutorials.But they didn't help me much I am totally new to pending intents soo.I am so confused right now please help me out... All i want to do is just trigger the broadcast inside the service using the button of the widget ... Here is the copy pasted code which i had been trying to

Can I use two spinners to retrieve data from a javascript file that i have named dist.js

*爱你&永不变心* 提交于 2019-12-25 08:12:19
问题 What I want to achieve is to use to spinners to select from town and then to town and then to retrieve the distance and time of travel that i have defined in my dist.js file. It works great when i use html in webview. but I don't want to use webview. Therefore how can i get the two spinners to calculate this? Okay have tried but still nothing works. here is my code so far. Can you tell what i am doing wrong? import java.io.BufferedReader; import java.io.InputStream; import java.io

Make a toggle button to widget

喜你入骨 提交于 2019-12-25 08:04:00
问题 How do I add a button to a widget, not for opening an activity or something? Just for toggling for example Wi-Fi :) Could it be done by a ImageButton or something like that? I just can't figure out how to add an onClickListener. 回答1: I have updated my answer now that I understand you are trying to write an AppWidget. AppWidgets support only a limited set of Views and ToggleButton is not one of them. The list of Views supported by AppWidgets can be found here: http://developer.android.com

Can't access DatePicker.ValidationCallback in my code

醉酒当歌 提交于 2019-12-25 06:22:56
问题 I have a simple DatePickerFragment that extends DialogFragment. I'm wanting to set a validation callback so I can prevent "OK" being selected if an invalid date is picked. I first tried setMaxDate and that grays out the invalid choices but still allows them to be selected and OK to be pressed. So I was hoping setting the validation callback would be the solution. abstract public class DatePickerFragment extends DialogFragment implements DatePickerDialog.OnDateSetListener { public

Can't access DatePicker.ValidationCallback in my code

女生的网名这么多〃 提交于 2019-12-25 06:22:08
问题 I have a simple DatePickerFragment that extends DialogFragment. I'm wanting to set a validation callback so I can prevent "OK" being selected if an invalid date is picked. I first tried setMaxDate and that grays out the invalid choices but still allows them to be selected and OK to be pressed. So I was hoping setting the validation callback would be the solution. abstract public class DatePickerFragment extends DialogFragment implements DatePickerDialog.OnDateSetListener { public

removing whitespace in android Switch which is devoted to text

﹥>﹥吖頭↗ 提交于 2019-12-25 06:04:56
问题 (we all know) There are three parts in android Switch Widget ... Text - Thumb - Track. My question is how can we completely remove this text part if we don't want to use any text because it's ruining the balance of the layout 回答1: You simply have to not provide any text: <Switch android:id="@+id/switch1" android:layout_width="wrap_content" android:layout_height="wrap_content" /> 回答2: Use negative margin for the switch as follows and see if it works: <Switch android:id="@+id/switch1" android

Android having tabs at the bottom of screen?

有些话、适合烂在心里 提交于 2019-12-25 05:25:13
问题 I am trying to place tabs on the bottom of the screen and have each tab display a different activity. However from what I have read you can only use this on phones 3.0+. When most phones I know are around 2.3 this seems a little ridiculous. Anyone have any ideas? 回答1: This can be implemented using the android usual tab,just you have to do is add some extra codes in the xml.I hope this piece of code will help you for getting it done... <TabHost android:layout_width="fill_parent" android:layout