Android :: Widget Configuration Activity - Update Request
Sep 18, 2010
I'm having an issue with a config activity for a widget. According to the dev docs, if I specify a configuration activity than the onUpdate method of the AppWidgetProvider doesn't get called until after you request an update once you've completed the configuration activity. For me its happening in reverse, the onUpdate method of the AppWidgetProvider gets called first, followed by the configuration activity. Then the onUpdate method is never called after completion of the config activity even though I request it explicitly. I tried with level 4 and level 7 API, same result. Here is some of the source:
Manifest:
<?xml version="1.0" encoding="utf-8"?> <manifest
xmlns:android="http://schemas.android.com/apk/res/android"
package="com.chris.android.swidget"
android:versionCode="1" android:versionName="1.0">
<application android:icon="@drawable/app_icon" android:label="@string/app_name">
<activity android:name=".SWidgetConfigure">
<intent-filter> <action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter> </activity>
<receiver android:name=".SWidgetProvider" android:label="@string/ widget_name">
<meta-data android:name="android.appwidget.provider" android:resource="@xml/swidget_info"/> <intent-filter> <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter> </receiver>
<service android:name=".service.PUpdateService" />
</application> <uses-sdk android:minSdkVersion="4" />
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
swidget_info.xml: <?xml version="1.0" encoding="utf-8"?> <appwidget-provider
xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="294dp" android:minHeight="72dp"
android:updatePeriodMillis="86400000"
android:initialLayout="@layout/swidget_layout"
android:configure="com.chris.android.swidget.SWidgetConfigure" >
</appwidget-provider>
I can include source of the onUpdate method from the AppWidgetProvider activity and the onCreate method of the configuration activity if necessary, but they are both being called find its just the order they show up on the emulator is wrong.
View 5 Replies
Oct 17, 2010
I have a widget with a configuration activity.
Currently the configuration launches when you click on the widget.
I want to add the configuration as an app icon to the launcher.
The problem is that when the configuration launches on click, I get a specific widget id , so each widget instance can have a different configuration.
What will happen if I start the activity from the launcher?
I wont be able to show multiple configurations on the same activity.
View 1 Replies
View Related
Sep 29, 2010
I'm writing a widget with a configuration activity which calls the following method when its OK button is clicked:
CODE:..............
This is almost verbatim from the documentation. widget_id holds the widget ID that was dug up during the activity's onCreate().
When I place an instance of the widget on the home screen, I've verified that I get the expected sequence of events:
onReceive() gets an ACTION_APPWIDGET_ENABLED if it's the first one.
onUpdate() gets called (in which I detect that the widget isn't configured and draw something as a default action).
The configuration activity appears.
When I press OK, the ok() method above gets called.
The method gets all the way through to the finish() and the configuration activity goes away, but there's no call to onUpdate() or onReceive() after this point. (The widget itself has no updatePeriodMillis.) I end up with a widget on the screen that has the results of my default action but never gets updated.
If I set the widget up without a configuration activity, it gets updated when created and everything works as expected (just without the configured bits).
View 1 Replies
View Related
Sep 22, 2009
I have been looking for a way to update a widget asynchronously, for example, when the phone receives a text message. I have a broadcast receiver set up with code that runs upon receiving a message. I also have an AppWidgetProvider that is set up and running. It seems like the *only* way a widget can be updated is upon its interval, or when the user interacts with it. Is there any way to update a widget upon a system event?
View 6 Replies
View Related
Nov 1, 2010
I have a widget, its setup so that when I click on it, it opens some settings in an activity.
CODE:................
This configures some settings for the application. What I want to achieve is to have the widget update its view to reflect the changed settings when the Activity I launch closes. Using the update interval or any other type of polling isn't appropriate for this.
I've seen a couple places here and in the android docs this code used:
CODE:...................
But I don't know how to get the mAppWidgetId value. I tried following the example for a widget configuration activity here http://developer.android.com/guide/topics/appwidgets/index.html, but in the following code,
CODE:............
Extras is always null, so I never get the AppWidgetID.
View 1 Replies
View Related
Nov 8, 2010
I have added a widget and instead of updating it every xxx minutes, i want to update it only if in my activity something is changed. But how can i call the onUpdate Routine of my widget from my activity?
View 3 Replies
View Related
Aug 11, 2010
I know it's possible, but I can't figure out a way to trigger an update of my widget from the main activity. Isn't there some general intent I can broadcast?
View 1 Replies
View Related
Aug 26, 2009
In Java ME we can set .jad configuration in description file and we can get this values in midlet by getAppProperti(""); So in Android we can set apk configuration (eclipse) apk configuration. But when I set this! my file default properties change and my projet signal some error. So in activity when can add System.setProeprty("name","values"). My problem I wan to specify the server IP and some code in apk only for this apk file. Each apk can have his code and server IP.
View 2 Replies
View Related
Sep 26, 2010
My widget launches a configuration screen when chosen to be put on screen. That works fine.
I wanted to be able to touch a part of the widget to return to that configuration screen.
I have created 2 pending intents in my widget's service but only one works. The code is below...
For the life of me i cannot understand how i can launch again the configuration activity.
View 1 Replies
View Related
Apr 15, 2009
I'm playing around with the new AppWidget API, I get the impression from the docs that I don't need an android:configuration attribute in my AppWidgetProviderInfo xml resource. Curiously though, when I try to add my AppWidget to the home screen, I just get a black textview that reads "Problem loading widget".
View 2 Replies
View Related
Sep 16, 2010
Is there a way how I can tell the Preference Activity that value should be saved as integer? So far my all values are saved as strings... I can limit input to integers via XML easy:
<EditTextPreference android:key="SomeKey" android:numeric="integer" />
but it is still saved as string and later trying to getInt("SomeKey") on preferences object I always get java.lang.ClassCastException: java.lang.String.
Is there a way that EditTextPreference value would be saved not as string? Or maybe I should use some other type of Preference for numeric input?
View 7 Replies
View Related
Aug 31, 2010
I think that it would be too complex to open a database. Does using shared preferences make my app's data size become big. Is there a temporary storage place for my data or should I delete the data in the shared preferences for that widget.
View 1 Replies
View Related
Jul 12, 2009
I'd like to report a bug we just found while writing a widget.
Summary: There is a widget installed, that defines a configuration activity. If the user changes the orientation while they are in the configuration activity, and they finish that activity in a different orientation that they started, the widget does NOT appear in the home screen after the configuration is done.
How to reproduce: have a minimal widget, with a configuration activity that contains a button, which correctly updates the App Widget when it is clicked (as explained in http://developer.android.com/guide/topics/appwidgets/index.html#Confi...). Add a new instance of the widget, so the config screen shows up. Change the orientation once. Click on the button. Your widget does not appear in the home screen. (Ouch.)
If this has already been reported, or if there's a better way to submit a bug report.
View 4 Replies
View Related
Feb 11, 2010
I am starting an activity with startActivityForResult(intent,requestcode). And i am receiving result onActivityResult() call back .
The target acivity which gets the intent should get the request code And based upon the request it has to do the specified operation.
How can target activity get the request code, which is passed to startActivityForResult().
View 2 Replies
View Related
Oct 4, 2010
Is there a way to notify an activity/service of a force-close request right before it gets killed?
I mean when the user hits the force close button in Menu>Settings>Applications>Manage applications>app name>Force Close.
View 2 Replies
View Related
Jun 13, 2010
I registered a PendingIntent to requestLocationUpdates(provider, minTime, minDistance, PendingIntent). But when my broadcast receiver receives this intend, how do I remove this request with removeUpdates(PendingIntent)? The receiver doesn't hold a reference to the original PendingIntent.
View 1 Replies
View Related
Jul 8, 2010
this Android code worked fine before, but i'm having problems for some reason. here is the request i'm trying to make: https://www.google.com/reader/api/0/token. i'm getting 400:Bad Request as a response, and i'm not sure why. isn't this the correct URL for requesting a token? the auth token is being passed as a header in all requests now, and i can request feed list, and it works just fine, so there's nothing wrong with the auth code. what gives? in addition, i can request a token in a normal browser, like Chrome, and get a token as a response body. so the request itself is not the problem. i just can't figure out what is wrong with my requests in code...
View 1 Replies
View Related
Nov 27, 2010
I have a Verizon Droid incredible which is rooted and running android 2.2. I keep getting an OTA update request from verizon which I keep dismissing but it comes back like 10 times a day. It's really annoying so I tried to just run the update and it freezes. Then I'm back to the annoying update message. How do I make it go away for good?
View 24 Replies
View Related
Sep 13, 2010
Has anyone else had a software update request on the x10 in the last few days that hasn't actually worked, followed onscreen instructions but didn't do anything. Now the phone is cancelling calls, ringing random people on my past call list and going very slow.
I'm based in the uk and use t mobile as my network provider, contacted them but informed me i'd have to go through sony ericsson itself, spoke to somebody on work experience by the sounds of things, couldn't be bothered to help me, the best advice I actually received was to turn off phone, remove battery, restart phone, try to download the software update of the settings menu, did this but had the connect to your pc and try this message, the guy just said thats all that can be done to resolve this.
View 8 Replies
View Related
Jan 10, 2010
I hav an app that is like a relational database. There is a main app activity that users manage things with. There is also a widget that will display important info and add data to the database. When the widget is clicked, a configure class displays a way for the user to edit data. When the configure activity is done, the widget is updated and instead of going back to the home screen, the apps main activity is started. I can't find where the main activity is being called from. Wouldn't I have to create an intent and start Activity() to get this behavior? When done updating, I want the home screen and not my app.
View 3 Replies
View Related
Aug 17, 2012
I am developing an Android app for a website. I'm trying to get some information from the website by sending a cookie using a HttpGet request. I don't know where I am going wrong with the request. I am using AsyncTask to send the request to the server. The request also uses a token which I receive when I login to the webpage. All this is clear in the code below. This is part of the process in the doInBackground() function of the Asynctask:
BufferedReader in = null;
JSONObject token = Login.getToken(); // Token received after login, used in the cookie
try {
r = token.get("session_token").toString();
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
[code]...
View 1 Replies
View Related
Aug 21, 2013
I own a Xiaomi MI2S, running MIUI-3.8.16 @ Android version 4.1.1.JRO03L with Baseband version CEFWMAZM-2.0.128 017.
From my phone provider (Tele2) i have to dial a 1 (one) before my PIN-code when traveling abroad.
The code is accepted, I can be called and i can send and receive SMS messages.
However i cannot make phone-calls...
The error (?) is "DIAL request modified to SS request" and (very short) "not connected"
View 2 Replies
View Related
May 1, 2010
I can create a static widget without thinking, I can even create a widget like the analogue clock widget that will update itself, however, I can not for the life of me figure out how to create a widget that reacts to when a user clicks on it. Here is the best code sample that the developer documentation gives to what a widget activity should contain (the only other hint being the API demos, which only creates a static widget):
public class ExampleAppWidgetProvider extends AppWidgetProvider {
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
final int N = appWidgetIds.length;
// Perform this loop procedure for each App Widget that belongs to this provider
for (int i=0; i<N; i++) {
int appWidgetId = appWidgetIds[i];
// Create an Intent to launch ExampleActivity
Intent intent = new Intent(context, ExampleActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, intent, 0);
// Get the layout for the App Widget and attach an on-click listener to the button
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.appwidget_provider_layout);
views.setOnClickPendingIntent(R.id.button, pendingIntent);................
View 2 Replies
View Related
Aug 21, 2010
Alright the markets up and running again, when I open app brain it says there's an update for flash player 10.1, when i go to update it says "request page cannot be found". I also noticed when I search for flash player in the MARKET nothing will come up, but it comes up when I search through app brain any advice?
View 12 Replies
View Related
Oct 4, 2010
I currently have a tab layout with 2 tabs, one tab with a list view and one with the option make strings so I can add them in the list view. Both tabs have their own activity because this made the code much more structured, and I dont have to repeat my self later.
Lets say im in the tab that offer me to create an string, and i press the update list button, how do I update the list view without startActivity()? If i use startActivity(), it starts List.java, and instead of displaying the list in the list view tab, it takes full screen, which defies the purpose of the tab view. In other words, the startActivity() steals the focus from the tab view of the list, and sends it fulscreen.
I want to update the activity in my list view tab, without starting a new activity that goes to fullscreen, and doesnt update the one in the tab.
View 2 Replies
View Related
Nov 19, 2010
I have an Android activity that, onCreate(), will query a database and display the query results in textviews on the UI.The problem that I am having is at some point, users can open another activity and update the database. When they go back to the original activity, I would like for the text views to update with the new database information (so, I will re query the database and display the info).Another thing that I am willing to do is to take the new input from the user (in the new activity) and directly update the textview in the existing activity (without having the existing activity re-query the database). But I'm not sure how to do something like that either.Can someone please inform me on the best way to go about doing this? The only solution that I have found so far has to do with broadcast receivers, but I'm not sure if that is best suited for what I have to do.
View 2 Replies
View Related
Dec 24, 2012
I am working on developing an app and I am not sure when should I use a new activity and when should I update the existing view.
For example, lets say I have a view that shows a multiple choice question.Now, when the user selects his choices and clicks on say "Evaluate", I want to show the same question view but along with the right answers and explanations for each option. So does that mean, I should send an Intent upon a click on Evaluate or I should just update the view (i am not sure how)?
If I send an intent and show a new screen, how can the user go back to the next question without displaying the answers? If I don't create an new activity, how can I update the existing view that is already displayed?
View 4 Replies
View Related
Nov 27, 2010
data monitor widget missing after update to 2.1-xperia x8...any ideas?
View 1 Replies
View Related
Aug 9, 2009
My activity have to use List and Tab widget, one is left side,the other is right side, I means layout, but use List must to extends ListActivity, and use Tab widget must to extends TabActivity?
View 7 Replies
View Related
May 30, 2009
I've read through the Application Fundamentals three times today (and I had done so before), but I still can't quite wrap my ahead around the task concept. Or I guess I thought I understood it, but usually, the results I am seeing don't match up to what I would expect to happen (maybe a tool to see the current tasks/activities etc. for debugging purposes would be a nice addition).
I have multiple widgets from my provider in the Launcher desktop, and each is using a PendingIntent with a different URI as data (so they should be separate intents) to open an Activity.
I want there to be only once concurrent instance of this Activity that the user can access. So clicking the widget (1) , pressing HOME (2), clicking a different widget (3), pressing BACK (4) should bring the user back to the Desktop.
Now I did manage to do this using launchMode="singleTask" - the existing instance is brought to the top, onNewIntent() is called and I am pretty satisfied with it.
However, supposedly there are other ways to achieve an equivalent effect (say with having the activity restarted), and I'd like to understand why I don't seem to be able to get them to work: In every case, instead of seeing the home screen after step (4) (after pressing BACK), I see the *previous* instance of the Activity.
For example, if I read this correctly:
"There's another way to force activities to be removed from the stack. If an Intent object includes the FLAG_ACTIVITY_CLEAR_TOP flag, and the target task already has an instance of the type of activity that should handle the intent in its stack, all activities above that instance are cleared away so that it stands at the top of the stack and can respond to the intent. If the launch mode of the designated activity is "standard", it too will be removed from the stack, and a new instance will be launched to handle the incoming intent." http://developer.android.com/guide/topics/fundamentals.html
Then simply using using the following code to start my Activity from my widget should do what I want, no?
CODE:............
So in (3) My activity should be launched using FLAG_ACTIVITY_NEW_TASK by the launcher, which due to process affinity would find the existing task (which would consist of a single instance of my Activity), and launch the new instance on top of it. This explains what I am seeing. Why doesn't FLAG_ACTIVITY_CLEAR_TOP cause the existing instance in the task to be replaced?
Even setting android:launchMode explicitely to "standard", as mentioned in the doc quote above, this doesn't seem to change things.
I also tried android:finishOnTaskLaunch="true", but the behaviour is the exact same was just described with FLAG_ACTIVITY_CLEAR_TOP (which seems to be the exact same as when doing neither and really starting an activity without any special attributes).
I should mention that If I click the same widget in (3) as I clicked in (1), i.e. using the same PendingIntent twice, I do get the previous instance brought to the front (not restarted), but again, regardless of whether FLAG_ACTIVITY_CLEAR_TOP or finishOnTaskLaunch are being used.
I find this especially strange since the docs about tasks don't seem to mention the intent itself being relevant at all. Application Fundamentals does at one point say "For the default "standard" mode, a new instance is created to respond to every new intent", but it's not clear what "new intent" means then. Is triggering a PendingIntent multiple times through a widget not multiple "new" intents then?
I also tried various combinations of the other related options, but pretty much got nowhere.
View 2 Replies
View Related