Android :: Dynamically Enabling / Disabling Widget Does Not Work / How To Fix?
Feb 3, 2010
We would like to enable or disable widgets via code. When we say "disable" we mean that a widget which is registered in an application should not show up in the list of widgets available to the user when they try to add a widget to their home screen. This question has been asked, unfortunately, many times without answer. There was one response by Dianne Hackborn to a separate widget question which suggested that it was possible to use the package manager to disable widgets.
View 2 Replies
Feb 6, 2010
We would like to enable or disable widgets via code. When we say "disable" we mean that a widget which is registered in an application should not show up in the list of widgets available to the user when they try to add a widget to their home screen. This question has been asked, unfortunately, many times without
answer.
View 1 Replies
View Related
Jul 6, 2010
I am new to Android development and have trouble enabling / disabling the wifi & audio services. I get the appropriate manager instance using the getSystemService method. But I don't get any error when enabling wifi using:
wifiMgr.setWifiEnabled(true);
But the wifi is simply not turned on! Similarly I use
mAudio.setRingerMode(AudioManager.RINGER_MODE_SILENT);
or
mAudio.setRingerMode(AudioManager.RINGER_MODE_NORMAL);.....................
View 1 Replies
View Related
Feb 1, 2010
I have written code to enable and disable various things programatically like Wifi, Ringer modes, Airplane modes. All things that you would see in a power toggle widget. The one that I have not found out how to do is bluetooth. It appears that in SDK level 3 (OS 1.5) there is no pretty bluetooth manager class. Has anyone pinpointed any good source examples on enabling and disabling bluetooth that will also be forwards compatible with users running 2.0 (Droid) / 2.1 (Nexus)? I have found a few partial examples in my google searches that I could not get to actually run.
View 1 Replies
View Related
Aug 3, 2009
I have an application that has multiple activities with the intent action.MAIN (category LAUNCHER), so that multiple shortcuts appear in the "Applications" list. Is it possible to disable some of these activities at run-time (so that the corresponding shortcuts disappear from the "Applications" list)?
View 3 Replies
View Related
Aug 5, 2010
I have an app which displays a large amount of text for the user to read. I've found that when reading while lying down, I get annoyed that the screen rotates even though my head and the screen are aligned. I do not want to set this to be permanently in portrait mode, so I think this would preclude an approach of setting the android:screenOrientation="portrait" in the manifest. Ideally, I would like to enable/disable automatic orientation changes via a preference page.
View 1 Replies
View Related
Sep 17, 2010
I asked this a while back and didn't get anything useful. I'm hoping now that Android has advanced a few releases, that there will be more options. Here are the things I'm trying to accomplish: Prompt for a PIN when you uninstall a particular app. This would have been set at install time by the user. Disable certain services (text, phone). What would be even better is if I could be selective about it instead of just turning the radios off. For example:
a. intercept outgoing call, is it to one of a few allowed numbers?, yes
=> allow it, no => deny
b. intercept incoming call, is it from one of a few allowed numbers, yes =>...........................
View 1 Replies
View Related
Jan 25, 2009
In one of my applications I am dynamically enabling the GPS system setting based on a user's request. My problem is that I also have a LocationListener which doesn't pick up this change. If the device is restarted or the system settings Activity is brought up the LocationListener kicks in -- the onProviderEnabled() method is called. So.. it seems pretty obvious that I'm not notifying the system correctly of my changes. I have tried sending a broadcast from both the normal context and the application context. I thought this would be fairly straight forward, but it has proven to be rather frustrating. I put together a small test activity to demonstrate my problem.
Here is my test Activity: package com.example;
import android.app.Activity; import android.content.Context;
import android.content.Intent; import android.location.Location;
import android.location.LocationListener; import android.location.LocationManager;
import android.os.Bundle; import android.provider.Settings; import android.util.Log;
public class TestActivity extends Activity {
LocationListener locListener; LocationManager locManager;
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
setContentView(R.layout.test_activity); locListener = new MyLocationListener();
locManager = (LocationManager)getSystemService (Context.LOCATION_SERVICE);
locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locListener);
if(!locManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
Settings.System.putString(getContentResolver (),
Settings.System.LOCATION_PROVIDERS_ALLOWED, LocationManager.GPS_PROVIDER);
Intent intent = new Intent(Intent.ACTION_PROVIDER_CHANGED);
sendBroadcast(intent); } }
private class MyLocationListener implements LocationListener {
public MyLocationListener() { Log.d("test", "MyLocationListener()");
} public void onLocationChanged(Location loc) {
Log.d("test", loc.getLatitude() + "/" + loc.getLongitude());
} public void onProviderDisabled(String provider) {
// TODO Auto-generated method stub Log.d("test", "*** onProviderDisabled (" + provider + ") ***");
} public void onProviderEnabled(String provider) {
// TODO Auto-generated method stub Log.d("test", "*** onProviderEnabled (" + provider + ") ***");
} public void onStatusChanged(String provider, int status, Bundle extras) {
// TODO Auto-generated method stub Log.d("test", "*** onStatusChanged ***");
Log.d("test", "provider = " + provider + " status = " + status);
} } }
View 5 Replies
View Related
Sep 2, 2009
I would like to know how to dynamically change the my option menu items status from disable to enabled.at first all my menu items are set to disabled and when click the menu key , they are shown as gray and disabled.when my other task finished, i want to enable all the menu items, change them from gray to dark color from the screen.do you know how can i implement this?
View 8 Replies
View Related
May 25, 2010
I'm trying to listen to podcasts on My HTC desire whilst walking the dog, but because of the darned music player widget being operable through the lockscreen, it keeps pausing or skipping! Can i turn this blasted widget off?The skipping is not down to the Headphones issue on this one, i've solved that.
View 5 Replies
View Related
May 28, 2010
I am currently learning about widgets in Android. I want to create a WIFI widget that will display the SSID, the RSSI (Signal) level. But I also want to be able to send it data from a service I am running that calculates the Quality of Sound over wifi. Here is what I have after some reading and a quick tutorial: public class WlanWidget extends AppWidget Provider {RemoteViews remoteViews; AppWidgetManager appWidgetManager; Component Name thisWidget; WifiManager wifiManager; public void onUpdate(Context context, AppWidgetManager appWidget Manager, int[] appWidgetIds) { timer timer = new Timer(); timer.schedule AtFixed Rate(new WlanTimer(context, appWidgetManager), 1, 10000); The above seems to work ok, it updates the SSID on the widget every 10 seconds. However what is the most efficent way to get the information from my service that will be already running to update periodically on my widget? Also is there a better approach to updating the the widget rather than using a timer and timertask?
View 12 Replies
View Related
Nov 8, 2010
I am a new developer in android, and I see some examples about activity, but I don't know How can I create the widget dynamically?
View 2 Replies
View Related
May 28, 2010
I am currently learning about widgets in Android.I want to create a WIFI widget that will display the SSID, the RSSI (Signal) level.But I also want to be able to send it data from a service I am running that calculates the Quality of Sound over wifi.Here is what I have after some reading and a quick tutorial:public class WlanWidget extends AppWidgetProvider{
RemoteViews remoteViews;
AppWidgetManager appWidgetManager;
ComponentName thisWidget;
WifiManager wifiManager;
public void onUpdate(Context context, AppWidgetManager appWidgetManager,
int[] appWidgetIds) {
Timer timer = new Timer();
timer.scheduleAtFixedRate(new WlanTimer(context, appWidgetManager), 1, 10000);
private class WlanTimer extends TimerTask{
remoteViews remoteViews;
AppWidgetManager appWidgetManager;
ComponentName thisWidget;
public WlanTimer(Context context, AppWidgetManager appWidgetManager) {
this.appWidgetManager = appWidgetManager;
remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget);
thisWidget = new ComponentName(context, WlanWidget.class);
wifiManager = (WifiManager)context.getSystemService(Context.WIFI_SERVICE);
@Override
public void run() {
remoteViews.setTextViewText(R.id.widget_textview,
wifiManager.getConnectionInfo().getSSID());
appWidgetManager.updateAppWidget(thisWidget, remoteViews);
}The above seems to work ok, it updates the SSID on the widget every 10 seconds.However what is the most efficent way to get the information from my service that will be already running to update periodically on my widget?Also is there a better approach to updating the the widget rather than using a timer and timertask? (Avoid polling)UPDATE As per Karan's suggestion I have added the following code in my Service: RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget);
ComponentName thisWidget = new ComponentName( context, WlanWidget.class );
remoteViews.setTextViewText(R.id.widget_QCLevel, " " + qcPercentage);
AppWidgetManager.getInstance( context ).updateAppWidget( thisWidget, remoteViews );This gets run everytime the RSSI level changes but it still never updates the TextView on my widget, any ideas why?
View 2 Replies
View Related
Apr 2, 2010
How do I add a View dynamically in an android widget? I realize that the RemoteViews works as a container of updates, but the RemoteViews.addView is only available on API level 7 (and I want my widget to work on HTC Hero phones, which has API level 3).
View 1 Replies
View Related
Jul 4, 2009
I am working a widget... I'd like to change my widget background image dynamically, is it possible? I tried theme & style, it doesn't want to work. It doesn't show any background image (see code sample below). I tried RemoteViews.setImageViewResource on an ImageView filling the widget, but i doesn't strech my 9patch image correctly (and it doesn't seems to change background, it add another image). Is there a solution? Additionnal question : is it possible to use an external (sdcard) 9patch image as background? if yes: how?
View 2 Replies
View Related
Sep 22, 2010
Is there a way to dynamically change the size of a widget? Can an app have multiple widgets?
View 3 Replies
View Related
Nov 11, 2010
Is there a good way to add new image resources(from SD card) to a gallery widget at runtime?
View 1 Replies
View Related
Mar 5, 2010
I am writing a home screen widget. Is it possible to add a View, e.g. ImageView, to a home screen widget through RemoteViews? I want to generate the views for the home screen widget dynamically.
updateViews = new RemoteViews(context.getPackageName(), R.layout.widget_news);
updateViews.setTextViewText(R.id.widget_title, mTitle);
updateViews.setImageViewBitmap(R.id.widget_picture,
BitmapFactory.decodeByteArray(image, 0, image.length));
My code is like above. But we I call updateViews.addView(aView), my IDE didn't allow me to do that and give me an compile error.
View 1 Replies
View Related
Dec 9, 2009
Code...
I cannot find any information on how to change or hide the background image.
View 7 Replies
View Related
Sep 23, 2009
Setting the background color programatically of an android TextView doesn't seem to work.
I'm I missing something!
CODE:.............
I also have this file (colors.xml) in my res/values folder
CODE:................
Also, setting the text color causes the TextView to disappear.
CODE:..................
View 4 Replies
View Related
Nov 4, 2010
I'm trying to do my first widget but it seems not to work in the emulator: when I try to add the widget to the wallpaper, I've got the following message: "Application is not installed on your phone".
View 2 Replies
View Related
Oct 7, 2009
I am having trouble getting a selector to work inside a button on an app widget.
My app widget xml looks like this:
CODE:......
My_selector.xml in my drawable directory looks like this:
CODE:.............
The button doesn't change appearance....
View 3 Replies
View Related
Aug 19, 2010
I tried google and forum search on this but can't find it. I read somewhere that the Power bar is a resource hog, and I'd be better off with individual widgets for each. Problem is, I can't figure out how to make a WiFi widget work through tasker. I get the icon, and set it to be WiFi toggle, but it doesn't actually do anything.
View 1 Replies
View Related
Dec 21, 2009
I was interested in developing a clock widget for the homescreen and upon reading Home Screen Widgets tutorial, I wondered if there is a pre-existing Service I could reference for updating the current time rather than re-inventing the wheel?I download the Retro Clock application on my android phone and noticed that when I click it, it pops up the Alarm Clock settings, but with the default Google Analog Clock widget, upon click does nothing.Is that because the Retro Clock widget implements the Alarm Clock service? If so, how can I go about referencing that service? Or do I have this all wrong and misunderstood?
View 4 Replies
View Related
Feb 5, 2010
Actually this question applies to any widget that requires data from a remote server.
The answer would be pure speculation, but how do you think the widget gets its data? For those that don't know, the widget shows a history of your friends' latest status updates.
Some answers that I can think of:
The widget polls the API directly
The widget grabs data from some
service that's running in the
background, which polls the server
Somehow Facebook implemented push on
Android which I don't think exists
The widget somehow detects that the
user is using the screen and grabs
the data on demand
View 4 Replies
View Related
May 4, 2010
So I gave in and decided to download Handcent. I wasn't overly impressed with the HTC Message Widget and have heard such great things about Handcent. But, I'm having trouble getting the widget to work right. I have a blank home screen and added the Handcent SMS Widget to it. I thought that should make a full-screen widget like the other do. But instead it is just putting a tiny little Handcent icon as if it was a shortcut to the program (which essentially is what it is because if I click on it then Handcent opens). I have done this multiple times to make sure I was putting the widget and not the program there.
View 5 Replies
View Related
Oct 8, 2012
I like the look and functionality of the youtube widget because it shows your subscription uploads in order. but does it automatically refresh itself? How do new videos pop up?
View 1 Replies
View Related
Jun 7, 2010
My weather on my clock widget won't find my current location. It can find other major cities like New York and nearby Cleveland, but it can't zero in on my little town, which it always has before.
My wife's is working and shows our town, but mine just sits there blank with the town name saying no information is found.
I deleted the widget off the screen and readded it. I pulled the battery. Neither worked.
View 8 Replies
View Related
Aug 23, 2009
New to Android and to Hero but what I see I like a lot after swapping my iphone for this device.
I have bought an Orange branded Hero which has been unlocked and I have it working on O2.
I have 2 questions:
When I open the browser I get a message saying it won't connect to Orange WAP from a none orange device. I have set up the MMS and O2 WAP APN's and everything else seems to work even the browser works when I hit the search key. I should also add that I have changed the browser home page to O2 - any ideas?
2nd, I can't get the HTC mail widget to work with Googlemail. Googlemail works fine from it's own widget though.
Other than that, loving the phone and looking forward to really seeing what it can do - I might have a look at this "rooting" that everyone seems to talk about.
View 1 Replies
View Related
Aug 26, 2010
I recently flashed the Cyanogenmod 6.0.0-RC3 ROM onto my Moto Droid, and also installed a Simple Black Bar theme from their forum. Now, my Weahter and Toggle Widget app doesn't show up on the list of widgets when I long press my screen. I reinstalled it, and it worked, but then any time after that when I reboot my phone or unplug it from my computer, it will fail to load, and again won't show up on the widget list. Is this a bug in RC3? How can I go about fixing this?
View 6 Replies
View Related