android-widget

setAlpha for RemoteViews problem

妖精的绣舞 提交于 2019-12-12 10:48:36
问题 I'm making an appwidget, and there's a bitmap on the widget of which I want to change it's transparency. In the service I have: RemoteViews remoteView = new RemoteViews(getApplicationContext().getPackageName(), R.layout.myWidget); remoteView.setInt(R.id.widgetPNG, "setAlpha", 50); But it doesn't work. The emulator shows "Problem loading widget" on the home screen. I'm pretty sure everything else is fine cos when i changed the line to change it's imageResource it runs perfectly: remoteView

how to make a progress bar show on top of a button in android

十年热恋 提交于 2019-12-12 10:45:11
问题 Ok this is something I can do in iOS in like five minutes.. but I can't seem to get it for android: i simply want to show a progress bar ontop of a button. I managed to render the progress bar just fine beside the button like so using this code <RelativeLayout android:id="@+id/readBookContainer" android:layout_below="@+id/image" android:layout_marginLeft="@dimen/margin_medium" android:layout_alignRight="@+id/ratingBar" android:gravity="center" android:layout_width="300dp" android:layout

Can a home widget have a Context?

坚强是说给别人听的谎言 提交于 2019-12-12 10:37:39
问题 In an activity it's (usually) easy to get the Context. What if I am working with a home widget class? These are classes that extends AppWidgetProvider, which don't contain a Context! 回答1: An instance of Context is passed to all the methods in AppWidgetProvider for you to use. 回答2: For those who can't access developer.android like me, here's where you can get context in app widget: Android provides context in onReceive method in widget class. @Override public void onReceive(Context context,

deflate view and inflate another

↘锁芯ラ 提交于 2019-12-12 10:19:47
问题 on the press of my "next" button I have a speech bubble run through a string array. After all the items finish displaying and the user clicks the "next" button once more I would like to deflate the current child view and inflate a new view. Right now it crashes after the string array finishes displaying on multiple clickings of the "next" button. How can I get this to work? package com.jibushi; import android.app.Activity; import android.content.res.Resources; import android.os.Bundle; import

Android Homescreen Widget becomes Unresponsive

倖福魔咒の 提交于 2019-12-12 10:17:25
问题 I have an Android home screen widget I am working on and everything works great, except after about 5 to 6 days the four buttons revert to their default state and become unresponsive. I do not understand why the buttons are becoming unresponsive. If I remove and add the widget again it works again. If I wait for about 24-48 hours, it will begin to work again for a period of time. I have tried to remove the android:updatePeriodMillis so that the widget does not update on its own (it is self

Is it possible to get the shortcut layout of Launcher and use it in our own widget?

我怕爱的太早我们不能终老 提交于 2019-12-12 10:03:13
问题 I've noticed that the appearience of Dropbox shortcut-like widget to specified folder is consistent with shortcut layout no matter which launcher we use: So I want to make such a widget that behaves and looks like shortcut and is consistent with user's launcher. Is it possible to get the shortcut layout of Launcher and use it in our own widget? 回答1: Aside from AppWidgets , Android also has a concept of Launcher Shortcuts that are often grouped under the "Widget" label. That Dropbox folder is

Methods to get position of view returns 0

拈花ヽ惹草 提交于 2019-12-12 08:33:06
问题 This question has been asked several times, but everyone gives the reason for why this occurs (i.e. calculation occurs before the layout is laid). But I need the solution for this. I tried getBottom(); , getTop(); , getLocationOnScreen(int[] location); . But all returns the value Zero (0). I even tried giving these in onStart(); , to give time for layout to be laid, but no luck. Here is my code: TextView tv; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate

Avoiding FAILED BINDER TRANSACTION error when updating lots of widget bitmaps

僤鯓⒐⒋嵵緔 提交于 2019-12-12 07:31:51
问题 I am coming across an error when I am updating my RemoteViews in my AppWidget. .. !!! FAILED BINDER TRANSACTION !!! This is caused because all the changes to the RemoteViews are serialised (e.g. setInt and setImageViewBitmap ). The bitmaps are also serialised into an internal bundle. Unfortunately this bundle has a very small size limit. I cannot use setImageResource as I am hoping to allow the user to download skins for the widget. Can anyone recommend a workaround for this problem? I am

NullPointerException in getView Of Adapter extends BaseAdapter

为君一笑 提交于 2019-12-12 04:47:52
问题 I am populating listview for search in tabwidget.My list contain an image and textview.Without TabWidget it works fines but in TabWidget it gives error .I have error in getview My locat is 08-07 16:24:44.300: E/AndroidRuntime(20166): FATAL EXCEPTION: main 08-07 16:24:44.300: E/AndroidRuntime(20166): java.lang.NullPointerException 08-07 16:24:44.300: E/AndroidRuntime(20166): at com.example.project.SearchDictionaryActivity$MyCustomAdapter.getView(SearchDictionaryActivity.java:392) 08-07 16:24

How can I integrate this Scrollable Tab library in Eclipse?

冷暖自知 提交于 2019-12-12 04:43:11
问题 I'm banging my head with this Scrollable Tab library , but didn't get success. The website itself have a little amount of details in it. My Questions are: How can I integrate is in my application in Eclipse ?: I tried to add it as library, but not working. I haven't seen any layout to draw this control. Also when I tried to integrate it, with just copy-paste scr, res, & lib folders, I get PageIndicator, CirclePageIndicator, LinePageIndicator cannot be resolver error . I had added external jar