Your activity is a Context. R/
On Fri, Dec 12, 2008 at 8:16 PM, bparker <[email protected]> wrote: > > Where does your context ("ctx") come from? I'm curious because I want > to do the same thing, but getting a correct context to pass to > Toast.makeText is the only part I can't figure out. > > On Dec 3, 2:49 pm, vekexasia <[email protected]> wrote: >> hi, on my onCreate() Activity function i wrote this: >> <-- >> CambioCellula myCellula=new CambioCellula(); >> ... >> TelephonyManager x=(TelephonyManager)this.getSystemService >> (Context.TELEPHONY_SERVICE); >> x.listen(myCellula, PhoneStateListener.LISTEN_CELL_LOCATION); >> --> >> Where CambioCellula is my class defined like this excerpt >> <-- >> public class CambioCellula extends PhoneStateListener { >> .... >> public void onCellLocationChanged(CellLocation location) { >> GsmCellLocation myLocation=(GsmCellLocation)location; >> Log.d("X","Y"); >> Toast.makeText(ctx, "Found New Cells >> "+myLocation.getCid(),Toast.LENGTH_LONG ).show(); >> } >> >> } >> >> --> >> The program works when the screen is on .. But when i shut down the >> Screen ( with a short press of the end-call button) it seems to >> doesn't >> work.. >> >> IS this an sdk problem? Am i doing something wrong? >> Are you familiar with this kind of "bugs" ? >> Thanks Andrea. > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] 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 -~----------~----~----~----~------~----~------~--~---

