Solved

How can the parent activity knows when the child activity has finished

Posted on 2014-11-03
4
280 Views
Last Modified: 2014-11-20
Hi,
I am making a sample android app. In this when we click on call button the mobile dials a number.
here is the code :
Intent phoneIntent = new Intent(Intent.ACTION_CALL);
        phoneIntent.setData(Uri.parse("tel:" + Number));
         startActivity(phoneIntent);

This code starts a new activity which calls at the given Number. And the call finishes in about 30 seconds.
I want to execute a piece of code when the call gets finished

How can the parent activity know if the child activity (the calling one) has finished ?

Thanks
0
Comment
Question by:Rohit Bajaj
  • 2
4 Comments
 
LVL 17

Expert Comment

by:Chris Harte
ID: 40419167
0
 
LVL 16

Expert Comment

by:krakatoa
ID: 40420186
I don't know Android, but I would have thought that you'd need a reference held by the caller that it could use to determine when the child process had finished.
0
 

Author Comment

by:Rohit Bajaj
ID: 40420944
Hi MunterMan,
But i dont have access to onStop() method of the activity which i started. As this is the activity which will call a particular number from mobile
0
 
LVL 17

Accepted Solution

by:
Chris Harte earned 500 total points
ID: 40421577
I think you are going to have to use the activity manager. This can test to see whether your activity is still running.

http://developer.android.com/reference/android/app/ActivityManager.html
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Windows 10 IE Certificate Issue 10 47
HashTable highest marks enumeration alternative 9 39
tomcat not starting 6 45
Pay to 支付宝 12 30
A short article about problems I had with the new location API and permissions in Marshmallow
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question