Monday 15 September 2014

android - Starts new activity after previous automatically -


Hello! I have an application that reads call logs, incoming SMS and outgoing SMS.

When the application launches for the first time, it displays the call log and then hears for incoming and outgoing SMS. I have three classes: main activity, incoming SMS. Java and outgoing SMS.

The main activity starts normally and everything looks fine, but incoming and outgoing SMS functions do not start. My incoming and outgoing SMS classes are 100% correct and if I prepare and run as a new project then works fine but they do not work together.

I want all these processes to be triggered together, here is my code.

MainActivity.java

  Public category main Increases activity activity {@ Override Protected Zero to Create (Bundled Saved Instance) {super.onCreate (savedInstanceState); SetContentView (R.layout.activity_main); GetCallDetails (); } @SuppressWarnings ("deprecation") Private Zero getCallDetails () {// left code here} @Override Public Boolean on CreateOptionsMenu (menu menu) {// expand the menu; It adds the item to the Action Bar if it exists GetMenuInflater (). Flow (R. menu activation_men, menu); Back true; Public class incoming SMS broadcasts expands the receiver (public reference to zero (reference reference, intention intent) {final bundle bundle = intent.}  getExtras (); Last SMS Manager SMS = SMSManager.Get Default ( ); // blank off code here}}   

Outgoing SMS.Java

  public class extends outgoing SMS activity {Last SMS Manager SMS = SmsManager.getDefault (); ContentReserve ContentRoad; ContentObserver smsContentObserver; @Orrrrrrrrrrrrrrrrrrrrr Public override () {super.onResume Pars ("Content: // sms / sent"); cursor c = getContentResolver (). Query (SMSURI, new string [] {"address", "date", "body", "type"}, empty, Zero); string [] column = new string [] {"address", "date", "body R "," type "}; c.moveToNext (); remaining code here @ override public boolean self-determination () {return true; }}; ContentResolver.registerContentObserver (Uri.parse ("content: // sms"), true, sms contact observer); } @ Override Public Empty OnDesto () {Super. Onsteroy (); ContentResolver.unregisterContentObserver (smsContentObserver); }}    

You can go to OutgoingSms.java and The main activity. Java . In addition, you can notify your main activity to incoming SMS , when a new SMS is received. You can see more details here:



No comments:

Post a Comment