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

  • SEARCH
  • Home
  • 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 8338387
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:34:42+00:00 2026-06-09T04:34:42+00:00

I’m working on my final project ,please help me ,i have to submit it

  • 0

I’m working on my final project ,please help me ,i have to submit it till end of next week
im working on an app that filter incoming calls based of context, at first i want to take incoming number and pass to an Activity to search number on dataBase and return the result ,i dont know how to get variable from a broadcastReceiver and pass to it again ,i mean get and pass variable to just 1 broadcastReceiver so i decided to use 2 BroadCastReceiver ,on of them take the incoming number and pass to my mainclass and my mainCalss search incoming number on database and pass the result to filterCall broadcast class,but i faced with problem .please help me,tHX

This is my callActivity Broadcast class that take incoming number and pass to my Mainclass

    public class CallblockingActivity extends  BroadcastReceiver {


          Context context = null;
          private static final String TAG = "Phone call";
          private ITelephony telephonyService;
          String incommingNumber;
           Intent intent;
           String n;

        @Override

          public void onReceive(Context context, Intent intent) {
                   Log.v(TAG, "Receving....");
                   TelephonyManager telephony = (TelephonyManager) 
                   context.getSystemService(Context.TELEPHONY_SERVICE);  
                     try {
                         Class c = Class.forName(telephony.getClass().getName());
                         Method m = c.getDeclaredMethod("getITelephony");
                         m.setAccessible(true);
                         telephonyService = (ITelephony) m.invoke(telephony);           
                         Bundle b = intent.getExtras();
                         incommingNumber = b.getString(TelephonyManager.EXTRA_INCOMING_NUMBER);
                         Log.v(TAG, incommingNumber);
                         Intent i = new Intent(context, Mainclass.class);
                         i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                         i.putExtra("n",incommingNumber);
                         context.startActivity(i);
                         Log.v(TAG, incommingNumber);

                     }
                     catch (Exception e) {
                      e.printStackTrace();
                     }

            }

  }   

And this is my mainClass that take incoming number from CallBlockingActivity broadcast class and search on database and return a boolean value

 public class Mainclass  extends Activity{
Context context = null;
Boolean isit= false;
String TAG;

   public void onCreate(Bundle savedInstanceState) {
        Log.v(TAG,"onCreate");
        super.onCreate(savedInstanceState);
       setContentView(R.layout.main);


       Intent b= getIntent();
        String incomiingnumber1= b.getStringExtra("n");
        Log.v(TAG,incomiingnumber1 + "incomenuber from broadcast receiver");
        DataBaseBON searching= new DataBaseBON(Mainclass.this);
       searching.open();
        isit= searching.searchnumber(incomiingnumber1);
        String ss= new Boolean(isit).toString();       
       Toast.makeText(getApplicationContext(), ss, Toast.LENGTH_SHORT);
       Log.v(TAG, ss+ "yeeeeeeees it is it");
       searching.close();

      //  I think My problem is here
       Intent in = new Intent(context, FilterCall.class);
       Bundle bb = new Bundle();
       bb.putString("keyvalue", "ss");
       in.putExtras(bb);
       startActivity(in);

   }

}

And this is my Filter BroadcastClass that reject the call or set the phone on silent mode.

public class FilterCall  extends BroadcastReceiver {

private ITelephony telephonyService;
String TAG;
@Override
public void onReceive(Context context, Intent intent) {
    // TODO Auto-generated method stub


    Log.v(TAG, "Filtering...");
    TelephonyManager telephony = (TelephonyManager) 
    context.getSystemService(Context.TELEPHONY_SERVICE);  
      try {
         Class c = Class.forName(telephony.getClass().getName());
         Method m = c.getDeclaredMethod("getITelephony");
          m.setAccessible(true);
          telephonyService = (ITelephony) m.invoke(telephony);          

          String result = intent.getStringExtra("keyvalue");


                if (result=="true") {
                try {
                    telephonyService.silenceRinger();
                    telephonyService.endCall();
                } catch (RemoteException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }


           }


      }
      catch (Exception e) {
       e.printStackTrace();
      }

 }

}

I am faced with this problem:

    08-05 16:58:50.468: W/IInputConnectionWrapper(1500): showStatusIcon on inactive   InputConnection
    08-05 16:58:50.958: V/(1500): Filtering...
  08-05 16:58:51.118: V/Phone call(1500): Receving....
 08-05 16:58:51.118: V/Phone call(1500): +60172214866
 08-05 16:58:51.138: V/Phone call(1500): +60172214866
   08-05 16:58:51.168: V/(1500): onCreate
 08-05 16:58:51.248: V/(1500): +60172214866incomenuber from broadcast receiver
 08-05 16:58:51.278: I/Database(1500): SQLiteDatabase open path:  /data/data/com.vahid.davoudi/databases/databasebon.db
 08-05 16:58:51.338: V/(1500): trueyeeeeeeees it is it
   08-05 16:58:51.338: I/Database(1500): SQLiteDatabase close path:  /data/data/com.vahid.davoudi/databases/databasebon.db
 08-05 16:58:51.348: A/dalvikvm(1500): Exception!!! threadid=1: thread exiting with         uncaught exception (group=0x4001d858)
 08-05 16:58:51.388: E/AndroidRuntime(1500): FATAL EXCEPTION: main
 08-05 16:58:51.388: E/AndroidRuntime(1500): java.lang.RuntimeException: Unable to start  activity ComponentInfo{com.vahid.davoudi/com.vahid.davoudi.Mainclass}:  java.lang.NullPointerException
   08-05 16:58:51.388: E/AndroidRuntime(1500):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
 08-05 16:58:51.388: E/AndroidRuntime(1500):    at  android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
  08-05 16:58:51.388: E/AndroidRuntime(1500):   at android.app.ActivityThread.access$2300(ActivityThread.java:125)
 08-05 16:58:51.388: E/AndroidRuntime(1500):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
  08-05 16:58:51.388: E/AndroidRuntime(1500):   at android.os.Handler.dispatchMessage(Handler.java:99)
   08-05 16:58:51.388: E/AndroidRuntime(1500):  at android.os.Looper.loop(Looper.java:123)
  08-05 16:58:51.388: E/AndroidRuntime(1500):   at android.app.ActivityThread.main(ActivityThread.java:4627)
  08-05 16:58:51.388: E/AndroidRuntime(1500):   at java.lang.reflect.Method.invokeNative(Native Method)
  08-05 16:58:51.388: E/AndroidRuntime(1500):   at java.lang.reflect.Method.invoke(Method.java:521)
  08-05 16:58:51.388: E/AndroidRuntime(1500):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
  08-05 16:58:51.388: E/AndroidRuntime(1500):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
  08-05 16:58:51.388: E/AndroidRuntime(1500):   at dalvik.system.NativeStart.main(Native Method)
  08-05 16:58:51.388: E/AndroidRuntime(1500): Caused by: java.lang.NullPointerException
  08-05 16:58:51.388: E/AndroidRuntime(1500):   at android.content.ComponentName.<init>(ComponentName.java:75)
      08-05 16:58:51.388: E/AndroidRuntime(1500):   at android.content.Intent.<init>(Intent.java:2690)
  08-05 16:58:51.388: E/AndroidRuntime(1500):   at com.vahid.davoudi.Mainclass.onCreate(Mainclass.java:39)
 08-05 16:58:51.388: E/AndroidRuntime(1500):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
  08-05 16:58:51.388: E/AndroidRuntime(1500):   at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
   08-05 16:58:51.388: E/AndroidRuntime(1500):  ... 11 more
  08-05 17:03:51.408: W/PrintK(1500): m.vahid.davoudi(1500) sends SIGKILL to        m.vahid.davoudi(1500)

And this is my manifest

 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.vahid.davoudi"
android:versionCode="1"
android:versionName="1.0" >

<uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-sdk android:minSdkVersion="8" />

 <application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <activity
        android:name=".Mainclass"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>


    <activity
        android:name=".CallBlockingOrginalActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name=".ViewDatabase"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.VIEWDB" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

    <receiver  android:name=".CallblockingActivity">
        <intent-filter   >
            <action android:name="android.intent.action.PHONE_STATE" />
        </intent-filter>
    </receiver>

    <receiver  android:name=".FilterCall">
        <intent-filter  android:priority="100" >
            <action android:name="android.intent.action.PHONE_STATE" />
        </intent-filter>
    </receiver>
  </application>

 </manifest>
  • 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-09T04:34:43+00:00Added an answer on June 9, 2026 at 4:34 am

    You have a nullPointerException at line 39 of Mainclass.java

    It is possible that “b” returns null

    Intent b = getIntent();
    

    add

    if(b != null) {
        //code involving the use of b
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,

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.