android-widget

android update widget appearance

不羁的心 提交于 2019-12-08 09:16:35
问题 I want to change one of the visual elements of an android widget when the user clicks it. This is in the widget's xml <ImageView android:id="@+id/bg" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="false" android:layout_marginLeft="20dp" android:layout_marginTop="18dp" android:src="@drawable/seal" /> I want to change the src based on an ID, so from the widget I plan to send the remoteView a click listener Intent bgSwitch = new Intent

Why i am not able to create the Notification in OnReceiver of BroadcastReceiver?

≡放荡痞女 提交于 2019-12-08 09:06:24
问题 I am going to create the notification and want to show it on the onReceiver of the BroadcastReceiver. But i am not able to do it. why ? The code for my class is: public class AlarmNotificationReceiver extends BroadcastReceiver{ //private Intent intent; private NotificationManager notificationManager; private Notification notification; @Override public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub long value1 = intent.getLongExtra("param1", 0); String

Error : Your TabHost must have a TabWidget whose id attribute is 'android.R.id.tabs

半城伤御伤魂 提交于 2019-12-08 08:39:32
问题 I'm new to Android and developing. I'm using Tab host widget. What I'm doing is I made 3 Java classes and corresponding xml files. Each Java class can load its xml. When someone presses the tab then it redirects to above Java classes. Please find the below code that I used.Now im getting Errors please find below code I used. CompareActivity.java package com.example.comparison.lk; import android.os.Bundle; import android.app.ActionBar; import android.app.Activity; import android.app

Partially left aligned and partially right aligned text in a TextView. Why isn't this working?

纵然是瞬间 提交于 2019-12-08 08:32:53
问题 I'm having an issue with an textview in which i have some text that is supposed to be left aligned and some text that is supposed to be right aligned. Here´s my attempt. String LeftText = "LEFT"; String RightText = "RIGHT"; String resultText = LeftText + " " + RightText; SpannableString styledResultText = new SpannableString(resultText); styledResultText.setSpan(new AlignmentSpan.Standard(Alignment.ALIGN_OPPOSITE), LeftText.length() + 1, LeftText.length() + 2 + RightText.length(), Spannable

App widget with listview

筅森魡賤 提交于 2019-12-08 07:18:54
问题 I have some problem. I'm working with Android 2.2 and now I want to create widget with ListView. But after a lot of time as I seeking answer, I was discovered that it's impossible for this version. But maybe anyone know how I can realise similar effect? How I can to realize the effect of scrolling in App Widget in Android 2.2? Thanks in advance. 回答1: I found solution for this question. I can use android-support library. 来源: https://stackoverflow.com/questions/8846743/app-widget-with-listview

How to connect an android widget to my android application? both are my Android applications

∥☆過路亽.° 提交于 2019-12-08 07:16:28
I want to combine my widget and one of my android application.. Is it possible to do that? My plan is, once user open up my android widget, the widget will directly open up my android application? Is there any way how? I made some method here from my widget class: public class ExampleAppWidgetProvider extends AppWidgetProvider { public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { for (int i = 0; i < appWidgetIds.length; i++) { int appWidgetId = appWidgetIds[i]; Intent intent = startActivity(new Intent("com.xxx.yyy.widget.FlamingoActivity"));

Rotate ImageView in widget

谁都会走 提交于 2019-12-08 06:53:09
问题 I'm creating a widget where I need to rotate an ImageView. The ImageView resides insides a layout which in turn is described in a RemoteView. Is this possible? In my regular application Activity gained a reference to the ImageView using findViewById() and then calling setRotate(), but as RemoteView isn't an activity findViewById() isn't available. I can see that it has been done before in this app: https://market.android.com/details?id=com.lanteanstudio.compass 回答1: If you are using

EditText on demand widget

三世轮回 提交于 2019-12-08 05:40:36
问题 I'd like to have a TextView display text, and when you click/longclick on it, a textbox should "show up" and allow editing of said text. When you're done editing (onkey enter i suppose) it should revert back to a textview with the updated text... I'm wondering if it's feasable to implement such a widget or should I hack a workaround? Tips and suggestions are very welcome. If you need further idea of what I mean, just go to your e.g. (windows) skype profile and see for yourself. EDIT:

alternating colors of spinner items

浪子不回头ぞ 提交于 2019-12-08 05:22:49
问题 Can I make the items to show up in alternating colors in spinner control 回答1: Yes, you can. If you are following the Spinner Tutorial then you can subclass your adapter (passing a List of your items) to produce an alternating color effect: ArrayAdapter<CharSequence> adapter = new ArrayAdapter(this, R.layout.simple_spinner_item, myList) { @Override public View getDropDownView(int position, View convertView, ViewGroup parent) { View view = super.getDropDownView(position, convertView, parent);

How to connect an android widget to my android application? both are my Android applications

天涯浪子 提交于 2019-12-08 04:32:43
问题 I want to combine my widget and one of my android application.. Is it possible to do that? My plan is, once user open up my android widget, the widget will directly open up my android application? Is there any way how? I made some method here from my widget class: public class ExampleAppWidgetProvider extends AppWidgetProvider { public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { for (int i = 0; i < appWidgetIds.length; i++) { int appWidgetId =