Question

I'm try to implement a call log in my Android app, which reads the system call log and shows on my app. There's a button to make a call to someone in my app with the code of:

startActivity(new Intent(Intent.ACTION_CALL,Uri.parse("tel:"+dataList.get(arg2).get("number"))));  

When I press the button, my app will lose focus of the screen and it will jump to the calling page. When the call finishes, I want the call log in my app could be refreshed, I mean, the call just now should be added to my list. So I add refreshing functions in the onResume() of my Activity.

But it weirdly turned out the list didn't refresh when the call finishes(the screen automatically turns back to my previous page of my app, say the list).

So here comes my question, shouldn't be the onResume() function be called when the call finishes? Meanwhile, the onPause() wasn't called either, when jumping to the calling page. I'm pretty sure they weren't called cuz I add system.out.println() at the beginning of onResume() and onPause(), and I saw nothing.

Could anyone here help me with this problem? Thanks for all your read and help.

Was it helpful?

Solution

Make sure you correctly override the onPause() and onResume() methods. (no parameters, void return type)

You will also need to call through to the super method in each case, too. That is:

@Override
public void onPause()
{
    super.onPause();
    // your code here
}

@Override
public void onResume()
{
    super.onResume();
    // your code here
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top