8 messages in com.googlegroups.android-developersRe: How to start a new Activity from ...| Subject: | Re: How to start a new Activity from a IntentReceiver?![]() |
|---|---|
| From: | hackbod (hack...@gmail.com) |
| Date: | 01/30/2008 12:14:37 AM |
| List: | com.googlegroups.android-developers |
The notification manager calls startActivity() on the intent, not broadcastIntent(). You must implement an activity to receive it.
On Jan 29, 11:01 pm, Preetu <pree...@gmail.com> wrote:
hi i m working with the Intentreceiver.
i want to lunch my application when the intent fired as my status bar icon clicked.
my code is here
in my Checklist class which is drived from the Activity
NotificationManager nm = NotificationManager.from(itla.getcontext());
switch(item.getId())
{
case 0 :
for( count=0; count<numberOfContacts;
count++ )
{
IconifiedTextView viewItem =
(IconifiedTextView)itla.getItem(count);
if((viewItem.isChecked()))
{
viewItem.setIcon(getResources().getDrawable(R.drawable.smile_online)); LaunchIntent.setAction("android.intent.action.VIEW");
LaunchIntent.addCategory("android.intent.action.DEFAULT"); //***********Notification************ Notification note=new Notification(R.drawable.smile_online,"Online",LaunchIntent,"online",null);
nm.notifyWithText(viewItem.getIconId(),viewItem.getText(),NotificationManager.LENGTH_SHORT, note); //NotificationManager.from(itla.getcontext());
//************Notification************
} }
break;
now i made another class work extends from Intentreceiver
public void onReceiveIntent(Context receivedContext, Intent receivedIntent) { if ( receivedIntent.getAction().equals("android.intent.action.VIEW") ) { Bundle extras=new Bundle();
this.checklist=(CheckList)receivedContext.getSystemService(Context.NOTIFICATION_SERVICE);
Intent i = new Intent(receivedContext,
checklist.getClass());
i.setLaunchFlags(Intent.NEW_TASK_LAUNCH);
i.putExtras(extras);
receivedContext.startActivity(i);
//showAlert("Menu", "Plz select the Menu", "ok", null,
false,
null);
}
}
the onReciveintent does not fire why ?




