how to answer an incoming call by button in android activity

I tried to make custom screen for receiving call in android , I make the screen activity , but I need to make button that its action answer to the call

I tried many ways , but didn't work on kitkat or lollipop

Thank you
RayanCoheenAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chris Harte2015 Top Expert (Most Article Points)Commented:
First question, are you using the ACTION_ANSWER intent in your manifest?

<activity 
    class=".MyCustomAnswerActivity"
    android:label="@string/mycustomanswer_title">
    
        <intent-filter>
             <action android:name="android.intent.action.ANSWER" />
        </intent-filter>

         ...
 </activity>

Open in new window


If yes then you are going to have to post the code for your activity.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RayanCoheenAuthor Commented:
No , I didn't

I will try then I will tell you

thank you for your answer :)
Chris Harte2015 Top Expert (Most Article Points)Commented:
It appears to have worked
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Android

From novice to tech pro — start learning today.