For being able to start an activity you need a context.
One possibility is to pass a reference of your application context to
your class from which you want to call startActivity. Something like
class A extends Activity {
void yourMethodA(){
...
B b = new B(getBaseContext() );
...
}
}
class B{
Context mContext=null;
public B(Context context){
mContext = context;
}
void yourMethod(){
.....
i = new Intent(mContext, YourActivity.class);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
....
startActivity(i);
}
}
Also check out the API getApplicationContext()
--
Roman Baumgaertner
Sr. SW Engineer-OSDC
·T· · ·Mobile· stick together
The views, opinions and statements in this email are those of the
author solely in their individual capacity, and do not necessarily
represent those of T-Mobile USA, Inc.
On Sep 9, 4:57 am, "kapil.k" <[email protected]> wrote:
> i am reading the sms body from
>
> class SmsRx extends Brodcast receiver{/...../}
>
> I want to start some activity after receiving sms but as this class is
> not activity i am unable to start my new activity.so can you please
> tell me what shoul i do so that i can start activity after receiving
> the sms.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---