android-widget

Making UI elements relative to screen size?

风流意气都作罢 提交于 2019-12-24 15:18:32
问题 Lets say I wanted to make a relative view with two columns of buttons, left and right. Where each button takes up exactly 20% of the screen, separated by 10%, with the remaining border on the sides. But to do this for any screen size. DP I think won't work because how do you know the DP pixel count on each different screen? Basically how do you keep UI's relatively the same and fitting between all devices? 回答1: Short answer: LinearLayout . Long answer is here: Defining a percentage width for

How to Enable LongCLicks on my ListView?

孤街醉人 提交于 2019-12-24 14:07:34
问题 I'm trying to enable Long Clicks in my app and I can't get it to compile. I looked at the examples from previous questions here, but I can't get any of them to compile. My main activity is declared as: import android.widget.AdapterView.OnItemLongClickListener; public class LinearLayoutDemo extends ListActivity implements OnClickListener, OnItemClickListener, OnItemLongClickListener { In the onCreate() method, I put this: getListView().setOnItemLongClickListener(this); And for my ListView

Widget: onUpdate, onReceive - appWidgetManager - not working in v2.3.5 and v3.2.1

限于喜欢 提交于 2019-12-24 11:51:34
问题 I am new to Android applications and hence have a few questions. Using the code below, I am trying action on ImageButton. And it would be important to remember that this is a Widget , not an Activity. I searched online for examples on using ImageButton in a Widget and found very little information. However, this working example seems to have problems with different versions of Android. Now, the code works on old version (2.1-update1) of Android and not in new version of phone(2.3.5) or on

PendingIntent in Widget + TaskKiller

℡╲_俬逩灬. 提交于 2019-12-24 11:07:40
问题 I've developed an Application (called Instant Buttons) and the app has a widget feature. This widget uses PendingIntent for the onClick of the widget. My PendingIntent code is something like this: Intent active = new Intent(context, InstantWidget.class); active.setAction(String.valueOf(appWidgetId)); active.putExtra("blabla", blabla); //Some data PendingIntent actionPendingIntent = PendingIntent.getBroadcast(context, 0, active, 0); actionPendingIntent.cancel(); actionPendingIntent =

Android bottom bar menu onclick actions

泄露秘密 提交于 2019-12-24 10:59:34
问题 I want to have a common bottom menu bar through out the applications with every page. I have designed the bottom bar but i am confused with onClick event of the menu icons. whether i have to write the code for onClick listener with every activity class to make bar visible and working in every page or if there is any other way i can create a common bottom bar that lies with every page without writing the code of menu in every activity class. I tried to create through a creating a base class

Strange NullpointerException when trying to retrieve LinearLayout

混江龙づ霸主 提交于 2019-12-24 10:59:30
问题 This is a bit of a shot in the dark, but perhaps I'm making an obvious mistake; I have a LinearLayout defined in my main.xml, with an id "@+id/imageListContainer". There is nothing else in my main.xml, and the LinearLayout is completely plain (As eclipse inserts it for you from the GUI editor). <LinearLayout android:id="@+id/imageListContainer" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> </LinearLayout> I then want to populate the

Launching an activity from a widget with a configure activity

偶尔善良 提交于 2019-12-24 10:48:09
问题 Hi Everyone, I am having a problem with launching an activity from my home screen widget.And before some one marked this as a duplicate questions , please know that I have looked around and tried the solutions mentioned in other similar questions.Especially this one Launching activity from widget My problem is simple enough , I want to launch an activity from my home screen widget , and it is not working. Note : The Activity launches from the widget once(for the first time) after a fresh

Designing Layout like iphone in android

我怕爱的太早我们不能终老 提交于 2019-12-24 09:38:44
问题 I want to design something like this in android..See the Buttons Bar -> New Deals, NewCoupons, New Categories. Again see the top portion of that Buttons Bar -> Its something like horizontal scroll view. How to design such type of layouts in android. ? 回答1: See this class http://code.google.com/p/deezapps-widgets/ for implementing a horizontal scroll view. The buttons bar can be implemented using a TabWidget as Phonon suggests. To implement a button bar Call tabSpec.setIndicator(buildIndicator

AsynTask with RemoteViews in StackView Widget

删除回忆录丶 提交于 2019-12-24 07:19:52
问题 I've tried to search for information about StackView Widget and i've found a lot , but nobody used to get data from url . So the problem is , while i'm processing url , my RemoteViews are null , so they don't show nothing. Once the process is done i want to update that RemoteViews from asyntask (there are in the same class). How can i do that ? Or syncronize them ? Here's my code for Widget service: public class RSSService extends RemoteViewsService { private ManagerRSS mr; private Cursor c;

Android DatePicker fails on android 2.3.3

时光怂恿深爱的人放手 提交于 2019-12-24 05:18:26
问题 As I am new to Android development I am trying to display DatePicker dialog on Android 2.3.3 emulator,but while it is crashing. I am followed what am I missing to include in my code? But this code is working in Android 4.0. DatePickerFragment class public class DatePickerFragment extends DialogFragment implements OnDateSetListener{ @Override public Dialog onCreateDialog(Bundle savedInstanceState) { // Use the current date as the default date in the picker final Calendar c = Calendar