oops sorry I forgot to post code so it can help people...

this updates and then notifies a list adapter which has an observer.

    /**
     * Background task to verify the create user action. When the
action comes back
     * it could inform the client to sync all data if the username and
passwird match
     * or that there was a validation error like the user already
exists, or that
     * this is a new user and that it successfuly created it
     *
     */
    private class PostActionTask extends UserTask<Object, Void,
ActionResult> {
        public ActionResult doInBackground(Object... params) {
                ActionResult result =
                        new ActionResult();
                result.setActionStatus("FAILED");

                Action actionToRun = (Action)params[0];

                try {
                        result  =
                                RpcActionClient.executeAction(
                                        actionToRun,
                                        
MomentaryNowApp.getString("app_momentary_now_server"),
                                        
MomentaryNowApp.getInteger("app_momentary_now_server_port"),
                                        
MomentaryNowApp.getString("app_momentary_action_endpoint"),
                                        null) ;

                } catch (IOException e) {
                        Log.e(TAG, "IOException:"+e.getMessage());
                } catch (HttpException e) {
                        Log.e(TAG, "HttpException:"+e.getMessage());
                } catch (URISyntaxException e) {
                        Log.e(TAG, "URISyntaxException:"+e.getMessage());
                }
                return result;
        }

        @Override
        public void onPostExecute(ActionResult result) {
                Log.d(TAG, "result:"+result.getActionStatus());
                if(result.getActionStatus().equals("SUCCESS"))
                {
                        SharedPreferences sharedPreferences =
                                PreferenceManager.getDefaultSharedPreferences(
                                                getApplicationContext());

                        SharedPreferences.Editor editor = 
sharedPreferences.edit();
                        editor.putBoolean("isValidPrincipal", true);
                        editor.putInt("contactVisibility", 0);
                        editor.putFloat("visibilityRadius", 0.0f);

                        editor.commit();
                        UserInfoListItem item =
                                mListManager.get(LIST_ITEM_SYNC);
                        item.setStatus("complete");
                        item.setProgressVisible(false);
                        mListManager.refresh();


                } else if(result.getActionStatus().equals("VALIDATION ERROR")) {
                        Log.d(TAG, result.getActionStatus());
                        UserInfoListItem item =
                                mListManager.get(LIST_ITEM_SYNC);
                        item.setStatus("error");
                        item.setProgressVisible(false);
                        mListManager.refresh();


                } else if(result.getActionStatus().equals("SYNC")) {
                        Log.d(TAG, result.getActionStatus());
                        finish();
                }
        }
    }


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to