Android how to call a method of MainActivity in SmsReceiver Class
Posted
by
GeneticSmart
on Stack Overflow
See other posts from Stack Overflow
or by GeneticSmart
Published on 2012-11-01T10:43:48Z
Indexed on
2012/11/01
11:00 UTC
Read the original article
Hit count: 160
android
I'm very new to Android Programming, It would be really great if someone can help me in this.My project contains two JAVA files.
MainActivity.java extends Activity
SMSReceiver.java extends Broadcastreceiver
The SMSreceiver.java has the code which displays any incoming SMS
in toast. Can you please tell me how to call a function in MainActivity
whenever a particular SMS is received. For eg: when I receive sms called as starttemp it should call a function starttemp.
I have searched a lot and found that intents are a way to do this and we cannot call these methods directly. Please can anyone help me in this? And it would be really great if someone can send me working code.
© Stack Overflow or respective owner