hiiiiiiii

by divya » Tue, 14 Dec 2010 04:54:46 GMT


Sponsored Links
 add me to this group

-- 



Re: hiiiiiiii

by peeyush varshney » Wed, 15 Dec 2010 02:36:49 GMT


 You are already with this group.








-- 
Thank & Regards
Peeyush Varshney

-- 


Sponsored Links


Other Threads

1. Synchronizing activity with service state

I've got an activity that lets a user start and stop a service, which
then hangs around putting up notifications periodically. I have a
toggle button for turning the service on and off, and I need it to
have the correct state whenever the user runs the activity, depending
on whether the service is already running or not.

Since there doesn't appear to be a way to directly query whether or
not the service is running, my solution was to have the service class
set a boolean "preference" to true in its onCreate() method, and set
it to false in its onDestroy(). The launcher activity in turn checks
the preference set by the service in its onCreate() and sets the
toggle's state accordingly.

service class:
private void savePreference(boolean state) {
        SharedPreferences settings = getSharedPreferences(PING_PREFS,0);
        SharedPreferences.Editor editor = settings.edit();
        editor.putBoolean(KEY_RUNNING, state);
        editor.commit();
}
onCreate() {
    ...
    savePreference(true);
}
onDestroy() {
    ...
    savePreference(false);
}

and the toggle button does:
private OnClickListener mTogListener = new OnClickListener() {
         public void onClick(View v) {
            // Perform action on clicks
            if (tog.isChecked()) {
                Toast.makeText(TimepieController.this, "ON",
Toast.LENGTH_SHORT).show();
                startService(new Intent(TimepieController.this,
                                        PingService.class));
                mStarted = true;
            } else {
                Toast.makeText(TimepieController.this, "OFF",
Toast.LENGTH_SHORT).show();
                        stopService(new Intent(TimepieController.this,
                                        PingService.class));
                        mStarted = false;
            }
        }
};

So it seems to me like this ought to work, however, after I stop the
service if I leave the launcher activity with the "Back" button and
then return, the toggle button is set back to on again. If I leave the
launcher activity with the "Home" button when I return the toggle
button remains off.

Is there some better/more correct way to synchronize the state of the
toggle button with the service? If not, any ideas on what is going
wrong? Why would the way I leave the app effect the state of the
preference? Does stopping the service not necessarily call the
service's onDestroy()?

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

2. Am I being banned from the list?

Hi,

It's the 2nd post for which I'm getting:

-------------------

The original message was received at ...

 ---- The following addresses had permanent fatal errors ----
<min...@hanmail.net>
 (552 5.2.2 minokr: mbox is over quota)

Final-Recipient: RFC822; min...@hanmail.net
Action: failed
Status: 552 5.2.2 minokr: mbox is over quota


---------- Forwarded message ----------
From: Stoyan Damov <stoyan.da...@gmail.com>
To: android-developers@googlegroups.com
Date: Wed, 11 Mar 2009 22:57:26 +0200
Subject: [android-developers] Re: Risk of upgrading to 1.1?

I have released my game on 19th of February, built against SDK 1.1 but
no minSdkVersion, and tested on my G1 w/ 1.1, i.e. it should be
working on 1.0 devices. So far I haven't got a report that it's not
working on any device, other than the intermittent "Force Close"
issues after an update.

Bottom line is, don't worry, install 1.1 and build against SDK 1.1 - I
haven't had any problems. Surely I haven't used any feature from 1.1,
not that there are many.

Do read http://developer.android.com/sdk/android-1.1.html to get more
confidence.

Cheers

---------

So, am I being banned or what?

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

3. Trackball doesn't give me click events, but touch screen does

4. access parent's protected variable when extend a android class!

5. access parent's protected variable when extend a android class!

6. NinePatchDrawable constructor

7. Change height of notification?