0

I am making an flash application an i want to have a On/Off button in the notification bar and on that button click i want to perform some action. What i am doing is this...

    Intent switchIntent = new Intent(this, switchOffButtonListener.class);

    PendingIntent pendingSwitchIntent = PendingIntent.getBroadcast(this, 0,
            switchIntent, 0);

    remoteViews.setOnClickPendingIntent(R.id.closeOnFlash,
            pendingSwitchIntent);

but i want to do this how can i do this

  //switchOffButtonListener notificationOnOff= new switchOffButtonListener(flash,soundFlashing,closeOnFlash);

    Intent switchIntent = new Intent(this, notificationOnOff);

    PendingIntent pendingSwitchIntent = PendingIntent.getBroadcast(this, 0,
            switchIntent, 0);

    remoteViews.setOnClickPendingIntent(R.id.closeOnFlash,
            pendingSwitchIntent);

i know intent only take class not the object but i want to pass the classes object into the onRecieve f BroadCast Reciever and want to use them there can anyone help me how i can do this, i read links but wasn't able to apply. Sorry if this is a silly question i am new to Android Programming so please help me out even it's foolish to ask.

Syed Raza Mehdi
  • 4,067
  • 1
  • 31
  • 47

1 Answers1

1

Serialize object may help in your case. It will convert your object into String. Just serialize your object and pass it.

Below link may help you. How to send an object from one Android Activity to another using Intents?

Community
  • 1
  • 1
Vishal
  • 355
  • 3
  • 18