[email protected] wrote:
> 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

Look at your Java stack trace for the exception (via adb logcat, DDMS,
or the DDMS perspective in Eclipse), and it will probably indicate where
things are going wrong.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_Android Programming Tutorials_ Version 1.0 Available!

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to