[SOLVED] Problem with widget and activity launched from it

Put your problem here if it does not fit any of the other categories.

[SOLVED] Problem with widget and activity launched from it

Postby slajeune » Thu Dec 17, 2009 9:15 pm

***** UPDATE *****

Seems I still have issues coding in Java. It had nothing to do with the appwidget code or the launching of the activity but matching strings! Anyways, everything is working fine.

Cheers,
Stephane.

******************

First of all, this is my first post an I have read quite a bit of VERY good info on this board! Please note that I am a newb in terms of Android coding.

Ok, here is the issue that I am having. I have a widget (AppWidgetProvider) that consists of the provider and a broadcastreceiver. Pretty much everything is in the broadcastreceiver code wise.

On the widget view, I have 4 clickable zones: 3 buttons and 1 textview. Everything works find until the following situation:

- click on the prefs button, this broadcasts an intent that starts a configuration Activity
- Configure the widget
- Click ok and go back to the widget
- At this point, the widget works flawlesly
- reboot the phone
- the textview on the widget doesn't display anything (event thought the data is there and updates are being pushed to the remoteviews)
- here is the kicker, open the prefs again, configure the widget
- the data re-appears on the widget

?!?!?! I am baffled. Would this have anything to do with the application being in a new context when the configuration activity is lauched?

This is how I launch the configuration Activity:

Intent intent_pref = new Intent("ca.sopht.android.mailwidget.LAUNCH_PREF");
//intent_email.setData(curURI);
intent_pref.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent_pref);

This is the code when the Activity starts:

public void onCreate(Bundle icicle) {
super.onCreate(icicle);
Context context = MailWidgetPrefs.this;
prefs = context.getSharedPreferences("MailWidgetPref", 0).edit();
setResult(RESULT_OK);
setContentView(R.layout.prefs);

mRadioGroup = (RadioGroup) findViewById(R.id.LanguageGroup);

findViewById(R.id.btnOk).setOnClickListener(mOnClickListener);

prefs.putString("LANG", "English");
prefs.commit();

}

If anybody sees anything way off or have any leads, that would be greatly appreciated!

Cheers,
Stephane.
slajeune
Freshman
Freshman
 
Posts: 4
Joined: Thu Dec 17, 2009 8:59 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 24 guests