Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8677265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:24:51+00:00 2026-06-12T20:24:51+00:00

I’m trying to make an new incoming call screen in android, when i get

  • 0

I’m trying to make an new incoming call screen in android,

when i get an incoming call my app starts – but crashes immediately, and the default incoming call screen is coming up.

what am i doing wrong?

my code:

AndroidManifest.xml :

<?xml version="1.0" encoding="utf-8" ?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.myfirstapp"
      android:versionCode="7"
      android:versionName="7">
    <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="10"></uses-sdk>
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
    <uses-permission android:name="android.permission.MODIFY_PHONE_STATE"/>
    <uses-permission android:name="android.permission.CALL_PHONE" />

    <application android:label="@string/app_name" android:icon="@drawable/ic_launcher">
        <receiver android:name=".MyPhoneBroadcastReceiver" android:enabled="true">
            <intent-filter android:priority="99999">
                <action android:name="android.intent.action.PHONE_STATE" />
            </intent-filter>
        </receiver>
        <activity
            android:name=".Call" >
        </activity>
    </application>
</manifest>

MyPhoneBroadcastReceiver.java:

package com.example.myfirstapp;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;

public class MyPhoneBroadcastReceiver extends Activity{

    public void onReceive(final Context context, Intent intent) {
            Intent main_intent = new Intent(this, Call.class);
            context.startActivity(main_intent);
    }


}

Call.java:

package com.example.myfirstapp;

import android.app.Activity;
import android.os.Bundle;

public class Call extends Activity{

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    }

}

the log is:

 10-14 20:59:51.056: E/AndroidRuntime(1826): FATAL EXCEPTION: main
 10-14 20:59:51.056: E/AndroidRuntime(1826):
 java.lang.RuntimeException: Unable to instantiate receiver
 com.example.myfirstapp.MyPhoneBroadcastReceiver:
 java.lang.ClassCastException:
 com.example.myfirstapp.MyPhoneBroadcastReceiver cannot be cast to
 android.content.BroadcastReceiver 10-14 20:59:51.056:
 E/AndroidRuntime(1826): at
 android.app.ActivityThread.handleReceiver(ActivityThread.java:2210)
 10-14 20:59:51.056: E/AndroidRuntime(1826): at
 android.app.ActivityThread.access$1500(ActivityThread.java:130) 10-14
 20:59:51.056: E/AndroidRuntime(1826): at
 android.app.ActivityThread$H.handleMessage(ActivityThread.java:1271)
 10-14 20:59:51.056: E/AndroidRuntime(1826): at
 android.os.Handler.dispatchMessage(Handler.java:99) 10-14
 20:59:51.056: E/AndroidRuntime(1826): at
 android.os.Looper.loop(Looper.java:137) 10-14 20:59:51.056:
 E/AndroidRuntime(1826): at
 android.app.ActivityThread.main(ActivityThread.java:4745) 10-14
 20:59:51.056: E/AndroidRuntime(1826): at
 java.lang.reflect.Method.invokeNative(Native Method) 10-14
 20:59:51.056: E/AndroidRuntime(1826): at
 java.lang.reflect.Method.invoke(Method.java:511) 10-14 20:59:51.056:
 E/AndroidRuntime(1826): at
 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
 10-14 20:59:51.056: E/AndroidRuntime(1826): at
 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) 10-14
 20:59:51.056: E/AndroidRuntime(1826): at
 dalvik.system.NativeStart.main(Native Method) 10-14 20:59:51.056:
 E/AndroidRuntime(1826): Caused by: java.lang.ClassCastException:
 com.example.myfirstapp.MyPhoneBroadcastReceiver cannot be cast to
 android.content.BroadcastReceiver 10-14 20:59:51.056:
 E/AndroidRuntime(1826): at
 android.app.ActivityThread.handleReceiver(ActivityThread.java:2205)
 10-14 20:59:51.056: E/AndroidRuntime(1826): ... 10 more
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T20:24:52+00:00Added an answer on June 12, 2026 at 8:24 pm

    Ok, in order to make my new page in the front i need to make it sleep for a while…
    so the new code will be:

    public class MyPhoneBroadcastReceiver extends BroadcastReceiver{
    
        public void onReceive(final Context context, Intent intent) {
    
    
            Thread pageTimer = new Thread(){
                public void run(){
                    try{
                        sleep(1000);
                    } catch (InterruptedException e){
                        e.printStackTrace();
                    } finally {
                        Intent i = new Intent();
                        i.setClass(context, Call.class);
                        i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                        context.startActivity(i);
                    }
                }
            };
            pageTimer.start();
        }
    }
    

    But – the original incoming call program is still running in the background…

    Is there any way to replace it instead opening new app ontop of it?

    Thanks!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.