Android :: Force An Update In A Configuration Activity

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).

Android :: force an update in a configuration activity


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 View Related

Android :: Setting APK Configuration In Activity

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

Android :: AppWidget Configuration Activity Required?

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

Android :: Add Widget Configuration Activity To Launcher?

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

Android :: Save Configuration Value As Integer In Preference Activity?

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

Android :: Force Activity In Landscape Mode Without Activity Restart

Aug 21, 2009

I have a problem to start/create Activity in landscape mode. My Activity need to start in landscape mode and be used in landscape mode by users. So far, I used setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) to force screen orientation of my Activity to landscape mode in onCreate() method.

In addition to this screen mode requirement, my application need to start another background thread in onResume() method, and this thread takes some seconds in order to finish an initialization process, and it is not desirable to to stop/restart this thread's service during the initialization process.

However setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) forces my Activity restart in a very little while (means onCreate->onResume->onPause->onStop are executed twice at the first place). As a result, my background thread be stopped/restarted during the initialization process, and this makes me a mess at this moment.

View 3 Replies View Related

Android :: Current Activity Force Closes - Tries To Go To Previous Activity

Nov 5, 2010

The default behavior from my observation is if current activity force closes Android tries to go to previous activity on stack How can I control this behavior? I want force close to close all activities

View 2 Replies View Related

Android :: Force Tab Activity Creation

Jun 3, 2010

I have an Android application with a main activity that is the tabhost. I'm adding multiple tabs to the tabhost with an intent to several activities.

My problem is that these activities are not created (onCreate is not called) until I click on the tab. This is a problem because I need to register broadcastreceivers: there may be broadcasts that are sent -before- a particular tab is opened.

I tried to work around this by:

Setting my receivers as static and registering from somewhere else. This is not possible because I need to call into methods.

Calling into tabHost.setCurrentTabByTag(the_tag) and then switching back to my root tab. This only works sometimes and this is a very ugly solution imo.

Not using activities but just using views instead. Also not a very elegant solution because it turns my tabHost activity into one huge master class doing all kinds of unrelated things.

View 1 Replies View Related

Android :: Force Activity To Call Finalize

May 20, 2010

My application contains 2 activities A and B. B is opened with startActivity(intent) in A, when B is closed with finish(), I found the method finalize() of B is not called.

My question is: How to force Activity to call finalize() when it is closed with finish()?

View 5 Replies View Related

Android :: Force Application To Restart On First Activity

Mar 18, 2010

For an unknown reason, I can't get my application leaving properly so that when I push the home button and the app icon again I resume where I was in the app....But I would like to force the application to restart at the first activity...I suppose this has something to do with onDestroy() or maybe onPause() but I don't know what to do..

View 4 Replies View Related

Android : Force Activity To Run Other In Landscape Droid 1.5

Aug 6, 2010

I have an application which is in portrait mode. However, I want to run a particular activity in landscape mode. I have tried the following with no success.

View 2 Replies View Related

Android : Force An Activity To Reload Completely?

Jul 19, 2009

I have an application, where I need to change the language through a settings menu. Now this part works perfectly, but it doesn't change the language for activities that have gone through onCreate.

I got a TabHost, and 2 tabs in it, from the tabs you can get to settings.

Refreshing the TabHost isn't an issue, as it's fairly small, however both the 2 tabs are quite large views, and having a function to manually update all the strings seem unnecessarily difficult. Is there any way to force the activity to recreate itself and trigger a new onCreate?

I tried having a static function in the tabhost that clears all tabs and recreates them, this refreshes the tab titles, but not the content in the tabs.

View 5 Replies View Related

Android :: Can Update A List View In One Activity While Im In Another Activity

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

Android :: Why Force Close Before Activity Screen Is Drawn?

Jun 29, 2010

My app keeps force closing before it starts, eclipse returns no errors in my code and my xml is good.

package com.mhe.test.scan;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class main extends Activity {
/** Called when the activity is first created. */
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button myScanButton = (Button) findViewById(R.id.myScanButton); myScanButton.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE", "PRODUCT_MODE");
startActivityForResult(intent, 0);
} } );
} EditText totalbox = (EditText) findViewById(R.id.totalbox);
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
if (requestCode == 0) { if (resultCode == RESULT_OK) {
String contents = intent.getStringExtra("SCAN_RESULT");
// Handle successful scan totalbox.setText(contents)
} else if (resultCode == RESULT_CANCELED) {
// Handle cancel totalbox.setText("@string/bummer");
} } } }
Essentially it is supposed to call zxing Barcode Scanner to scan a barcode on a button click and return the result into an EditText field.

View 2 Replies View Related

Android :: Force An Activity To Display The Soft Keyboard

Jun 16, 2009

My activity contains an editable text view and I would like to automatically show the soft keyboard when the activity start. Anyone knows how to do it?

I tried this:

CODE:.....................

View 2 Replies View Related

Android :: Force Dialog Themed Activity To Be Modal

Feb 11, 2010

A button on our screen causes an activity to be shown that has a "dialog" theme. We are having an issue were if you click the button quickly twice in a row, the dialog activity is opened twice.

Typically I would expect that when a new activity is started, the underlying activity is immediately stopped, and thus accepts no further input.

However, since the dialog themed activity does not take over the whole screen, I think the underlying activity is only paused, not stopped and thus the buttons are still accessible.

Which brings me to my question... Is there a way to force the dialog themed activity into a modal state where the user can't click the buttons on the activity below?

I could probably manually accomplish this by disabling everything in onPause, and reenabling it in onResume, but this seems like a lot of work!

View 1 Replies View Related

Android :: Activity To Register - Wait / Force Close Notification

Jul 2, 2009

Is there any way for an activity to register for being notified if a wait/force close dialog is shown or alternatively if the user selects force close, a way to detect that in ondestroy()?

View 6 Replies View Related

Android :: Force Browser Activity To Close After Passing Control

Sep 21, 2009

So I read through the SDK docs and I thought that calling a new activity(browser) as part of a task (myTask) will mean that activity* (browser) will close when a user closes the task (myTask) But I am left with a browser window.

Here is my scenario (in sudo code);

CODE:..........

Question 1: What is the cleanest way to ensure that when a user closes my app, any outside activities called will be closed to.

Question 2: Does a callback URl start a new Task, or use one in the stack if available?

View 3 Replies View Related

Android :: Force RecognizerIntent Activity To Stay Cached/in Memory

Feb 16, 2010

I was wondering if it is possible to force the RecognizerIntent Activity (or any other Activity) to stay cached so that the launch time would be faster.

View 2 Replies View Related

Android :: Changing Locale - Force Activity To Reload Resources

Apr 15, 2010

I have a language setting in my application. When the language is switched, I would like all the textviews etc to change language immediately. Currently I just change the locale in the configuration, so the language has changed when the user restarts the activity.

Solution to my problem would be to make each textview load the new resources each time the language is changed. Is there a better solution? Perhaps a neat way to discretely restart the activity? Or maybe just force reload of the resources?

View 2 Replies View Related

Android :: Update Activity Textview After Changes From Another Activity

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

Android :: Notify Activity / Service Of Force-close Request Right Before It Gets Killed?

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

Android :: Force Widget To Update

May 1, 2010

I respond to a button press on my appwidget in the onreceive method. When the button I pressed, I want to force the widget to call the onupdate method.

View 2 Replies View Related

Android : Way To Force Update A View?

May 22, 2009

I have a List activity which use cursor adapter. When an item of database is changed, I hope the corresponding view of this list can update and get new data from database. I know the time when database is changed, but how to update view?

View 7 Replies View Related

Create New Activity Or Update View Of Existing Activity?

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

Android : Need To Start Bluetooth Settings Activity Force Closes With Null Pointer Exception

Nov 19, 2010

I'm trying to bring up the standard window for Bluetooth Settings (with Device name, Discoverability etc). However, general approach with startActivity(intent) ends with NullPointerException pointing to BluetoothSettings.java onCreate:135. Checking with the Android code, I've found that at line 135 they get some extras from the intent. So I prepare the same extras (names I've found in android core BluetoothDevicePicker interface) and issue it -- the same effect with NullPointerException. Might be the wrongs names of the extras I prepare? So is there a way I can see those extras (with names especially) from the intent the system itself submits when I open Bluetooth Settings manually acting like a user. Code...

View 1 Replies View Related

Android :: Force Device Reboot After Update?

Nov 2, 2009

What is the best way to let my users perform an application update?

Is there any way to force device reboot after the update? I'm asking this because my application registers some behavior on boot.

Please note, the application would not be published in the Market.

Update:

My app will be preinstalled on a set of ~100 handsets. Should I periodically call a webservice that will inform the device about upgrade available, and then, redirect to an .apk file within a webkit view?

View 1 Replies View Related

Android :: App Force Close When SetText In An Update Method

Nov 13, 2010

I have an android app I am just experimenting things on and I cannot seem to figure out why my app force closes when I update a TextView via a while loop. When I comment out the updateText method it runs fine.

CODE:....................

View 3 Replies View Related

Android :: Launcher Pro Been Force Closing Often / Sluggish Since Update?

Jun 27, 2010

I noticed that LauncherPro has been acting weird. It'll constantly restart (the icons would disappear then reappear in 5 seconds), it'll lag at redrwaing the widgets/icons when rotating the screen, and it'll force close on me once or twice a day.

View 38 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved