ok i tried it like u said but it crashing here it is how i tried please
check n tell me how to correct it
class someactivity extends extends Activity
{
*public* *void* onCreate(Bundle savedInstanceState) {
//.......................
call();
}
public void call()
{
SmsReceiver *b* =*new* SmsReceiver(getBaseContext());
// or i tried
SmsReceiver *b* =*new* SmsReceiver(getApplicationContext())
}
}
--------------------------------------------------------------------
// now in class SmsReceiver
*
public* *class* SmsReceiver *extends* BroadcastReceiver
{
*static* Context *mContext*=*null*;
*public* SmsReceiver(Context baseContext)
{
*mContext* = baseContext;
}
@Override
*public* *void* onReceive(Context context, Intent intent)
{
//.........................................
Intent i = *new* Intent(*mContext*, neww.*class*);
i.setFlags(Intent.*FLAG_ACTIVITY_NEW_TASK*);
//startActivity(i); cant be used directally so used
Activity nn = new Activity();
nn.startActivity(i);
//or
context.startActivity(i);
}
}
but application crashesh as soon as it receives the sms.so please guys help
me sort out this.thank you
On Wed, Sep 9, 2009 at 11:12 PM, Roman ( T-Mobile USA) <
[email protected]> wrote:
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---