Communication between AppWidgetProvider and Configuration Activity

by Justin Anderson » Thu, 19 Nov 2009 16:03:07 GMT


Sponsored Links
 ou will have to have some form of default value for this to work, but here
is how I do it:

When I want to read from SharedPreferences I do this:
SharedPreference prefMgr =
PreferenceManager.getDefaultSharedPreferences(this);
m_curPage = prefMgr.getInt(getString(R.string.wgt_pref_cur_screen_key), 0);

When I want to write to it I do this:
SharedPreference prefMgr =
PreferenceManager.getDefaultSharedPreferences(this);
Editor editor = m_prefMgr.edit();
editor.putInt(this.getString(R.string.wgt_pref_cur_screen_key), m_curPage);
editor.commit();

You don't actually pass an object. SharedPreferences essentially abstracts
out reading to and writing from a file....

Thanks,
Justin

----------------------------------------------------------------------
There are only 10 types of people in the world...
Those who know binary and those who don't.
----------------------------------------------------------------------


On Thu, Nov 19, 2009 at 12:41 AM, Susan <ska...@gmail.com> wrote:

> > >



Communication between AppWidgetProvider and Configuration Activity

by Justin Anderson » Thu, 19 Nov 2009 23:27:46 GMT


 've never used the widget configuration, but if my memory serves me
correctly, you shouldn't need to request an update at the end of your
configuration activity...

Isn't the widget's onUpdate() method called by default by Android after the
configuration activity finishes?

Thanks,
Justin

----------------------------------------------------------------------
There are only 10 types of people in the world...
Those who know binary and those who don't.
----------------------------------------------------------------------


On Thu, Nov 19, 2009 at 1:10 AM, Susan <ska...@gmail.com> wrote:

> > > > >


Sponsored Links


Communication between AppWidgetProvider and Configuration Activity

by David McNicol » Fri, 20 Nov 2009 04:36:02 GMT


  have been working with widgets a wee bit lately, onUpdate() is called when
the configuration completes.


On Thu, Nov 19, 2009 at 3:27 PM, Justin Anderson <janderson....@gmail.com>wrote:

>> > > > >



Other Threads

1. E/AndroidRuntime( 321): java.lang.VerifyError: de.stefandahmen.android.TourList

Hi,

my TourList.java is very small:

//imports and package

public class TourList extends ListActivity
{
   File dir = Environment.getExternalStorageDirectory();
    String[] fileList = dir.list(new FilenameFilter() {
        public boolean accept(File d, String name) {
           return name.endsWith(".gpx");
        }
    });

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.tourlist);

        if (fileList.length>0)
                setListAdapter(new ArrayAdapter<String>
(this,android.R.layout.simple_list_item_1,fileList));
        else
                Toast.makeText(getBaseContext(),
                    "Keine Tour vorhanden!",
                    Toast.LENGTH_SHORT).show();
    }

    public void onListItemClick (ListView lv, View v, int pos, long
id)
    {
        Intent intent = new Intent(TourList.this, NavTrack.class);
        intent.putExtra("pos", pos);
        intent.putExtra("fileList", fileList);
        startActivity(intent);
    }
}

Where can there be an error? Or is it a problem, that i work with sdk
1.6 and the handy has sdk 1.5 installed?? But another app works fine
on sdk 1.5 handy and 1.6 emulator??

--~--~---------~--~----~------------~-------~--~----~

2. Kenapa hny announce2 tak ada yg nongol2 kecuali htc...eom

--~--~---------~--~----~------------~-------~--~----~
Google Groups "Indonesian Android Community [id-android]" group.

To post to this group, send email to id-android@googlegroups.com

To request to subscribe to this group, please visit the following page:
 

3. Multi-window Support

4. modify active intentfilter

5. OOT: Tiket Gratis Pesta Blogger 2009 untuk Komunitas Blogger / Online

6. Trouble with Ringtone.getTitle() in 1.6

7. stop camera click sound programmatically in android