android-widget

Setting programmatically the pixel size of a remote ImageVIew?

女生的网名这么多〃 提交于 2019-12-25 05:16:40
问题 Let's say that I have a layout that contains <ImageView android:id="@+id/my_id" android:layout_width="123px" android:layout_height="345px" android:padding="0dip" android:scaleType="fitXY" /> which is used in an AppWidget and is set via a RemoteViews. How can I programmatically set the width and height in pixels (overriding the 123 and 345 in the above xml)? (motivation: this image view shows a dynamic png file that is set at runtime via a file URL. If the layout_width and layout_height above

how to Add a Button on the home screen in android?

懵懂的女人 提交于 2019-12-25 04:37:19
问题 I want to add a button on the home screen and want to code in the click event of that button. I have an application which has an activate button,As soon as this activate button is clicked i want that a Button gets created on the home screen and i want to code some database queries in its click event.I have already created that application,Now i want to place the button on the home screen.How do i do that. Thanks in Anticipation. 回答1: I don't think you can create a button on the Home Screen on

ProgressBar update from within Handler

北战南征 提交于 2019-12-25 04:14:13
问题 I have a syncing service that I want a progress bar for, because it takes >1 minute to sync all the data and I don't want to use indeterminate progress. I have a Handler for the syncing functions and am referencing and correctly updating the progressBar's progress but the UI does not update. Handler handler = new Handler() { @Override public void handleMessage(Message msg) { //Sync calls updateProgress(getContext()); } }; public static void updateProgress(Context c){ layout = (LayoutInflater)

How to create a TimePicker from class which do not extends Activity, Android?

浪子不回头ぞ 提交于 2019-12-25 02:58:27
问题 I'm trying to create TimePicker dialog from a class that doesnt extends the Activity class. I need TimePicker in a class called EnterTime which has Context attribute containing Activity Context. All examples of TimePicker on the WEB are basic ones written in Activity class and that's why they confusing me. I want time picker which works good on Android lower then 3.0. I don't use XML layout. So basically I need suggestion where to put onCreateDialog() , how to retrieve chosen time, etc. I've

changing image on listview at runtime in android

爱⌒轻易说出口 提交于 2019-12-25 02:44:26
问题 I am using a LinearLayout to display some Text and image. I have the images at drawable/ and i am implimenting this with ListActivity with some onListItemClick functionality. now i wants to change the image for the rows which are processed by onclick functionality to show the status as processed. can some one help me in this issue to change the image at runtime. the following is my implimentation. public class ListWithImage extends ListActivity { /** Called when the activity is first created.

Widget that retrieve data from several html pages

偶尔善良 提交于 2019-12-25 02:44:05
问题 I retrieve some data from html after several step (login, click on link, run javascript, etc.) using webview, like described here: how to get html content from a webview? putting more actions in cascade. I don't use thread, mainly when an action (login for example) is done, it's called onPageFinished and this fire another webview.loadUrl and so on to another onPageFinished till all the actions are executed. I want to create a widget that show this result, that fire this chain of webview

Widget that retrieve data from several html pages

好久不见. 提交于 2019-12-25 02:44:02
问题 I retrieve some data from html after several step (login, click on link, run javascript, etc.) using webview, like described here: how to get html content from a webview? putting more actions in cascade. I don't use thread, mainly when an action (login for example) is done, it's called onPageFinished and this fire another webview.loadUrl and so on to another onPageFinished till all the actions are executed. I want to create a widget that show this result, that fire this chain of webview

Android - Once click off/on location services

血红的双手。 提交于 2019-12-25 01:41:14
问题 I use a few apps that use the location services within Android, but for the most part I would like to keep these three off until I need them: Use Wireless Networks Use GPS Satellites Location and Google Services I would like to design an app that can one click toggle these three. So I have have two questions. Is there a way to do that, or is the only way to toggle them is by using: android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS And then doing it manually? And.... If a few apps are

Application widget with bundle?

耗尽温柔 提交于 2019-12-25 01:26:56
问题 Hey guys, I have application widget, and I want to send some data to the intent that is attached to PendingIntent, by clicking the widget. here's my code final int N = appWidgetIds.length; for (int i = 0; i < N; i++) { int appWidgetId = appWidgetIds[i]; Intent intent = new Intent(context, UpComingBDays.class); if(bdaysAmount != 0){ Bundle bundle = new Bundle(); bundle.putIntegerArrayList("WIDGETIDS", tempAllIDS); intent.putExtras(bundle); System.out.println("bund insertedddddddddddddd........

How to make an AlertDialog disappear?

人盡茶涼 提交于 2019-12-25 01:01:25
问题 I am trying to integrate Twitter with my application and I thought to add an AlertDialog which will appear after users press a button and this AlertDialog will ask the users if they want to post a tweet(The tweet will be the same for all users, like a promo tweet). My question is if there is any way to make the Alert Dialog disappear after a few moments, like 5 seconds. I found this but I am not completely sure how it works. I would appreciate any help. 回答1: Declare your Handler that will