I to display phone call history when a user clicks a button. Can this be done with an intent? Which intent should I use?
Asked
Active
Viewed 350 times
0
-
Possible duplicate of [Open another application from your own (intent)](https://stackoverflow.com/questions/2780102/open-another-application-from-your-own-intent) – Phil3992 May 22 '17 at 14:29
-
Welcome to Stack Overflow! I made some minor edits. I changed the title of your question to better describe the underlying question. – Jon May 23 '17 at 18:27
1 Answers
1
You can do this using Intent
with action Intent.ACTION_VIEW
and type CallLog.Calls.CONTENT_TYPE
;
Try this:
yourButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intentCallLog = new Intent();
intentCallLog.setAction(Intent.ACTION_VIEW);
intentCallLog.setType(CallLog.Calls.CONTENT_TYPE);
startActivity(intentCallLog);
}
});
Make sure you have added the permission android.permission.READ_CALL_LOG
into your AndroidManifest.xml
file.
<uses-permission android:name="android.permission.READ_CALL_LOG" />
READ_CALL_LOG: Allows an application to read the user's call log.
Note: If your app uses the READ_CONTACTS permission and both your
minSdkVersion
andtargetSdkVersion
values are set to15
orlower
, the system implicitly grants your app this permission. If you don't need this permission, be sure yourtargetSdkVersion
is16
orhigher
.
See documentation.
Hope this will help~

Ferdous Ahamed
- 21,438
- 5
- 52
- 61