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 8104609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:53:56+00:00 2026-06-05T23:53:56+00:00

okay, the full error is 06-19 01:07:57.421: E/AndroidRuntime(4478): java.lang.RuntimeException: Error receiving broadcast Intent {

  • 0

okay, the full error is

06-19 01:07:57.421: E/AndroidRuntime(4478): java.lang.RuntimeException: Error 
receiving broadcast Intent { act=android.net.wifi.SCAN_RESULTS } in 
com.blucalc.netfind.WiFiScanReceiver@40521ba0

com.blucalc.netfind is my package
WiFiScanReceiver is the class its crashing in.

the class is here:

package com.blucalc.netfind;

import java.util.List;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.wifi.ScanResult;

public class WiFiScanReceiver extends BroadcastReceiver {
    NetworkfinderActivity netfinder;

    public WiFiScanReceiver(NetworkfinderActivity netfinder) {
        super();
        this.netfinder = netfinder;
    }

    @Override
    public void onReceive(Context c, Intent intent) {
        System.out.println("onReceive(Context=" + c.toString() + "Intent="
                + intent.toString());
        List<ScanResult> results = netfinder.wifi.getScanResults();
        netfinder.processResults(results);
    }

}

NetworkfinderActivity is the main class thing.

the really strange thing about the error is, it only happens on the second time this function is called. whether thats because of the different data i dont know, i can’t test.

can someone please help me?

edit1:
as requested, androidmanifest.xml

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

    <uses-sdk android:minSdkVersion="7" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name=".NetworkfinderActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

</manifest>

here’s the main class. where all the fun happens.

//some code borrowed from http://marakana.com/forums/android/examples/40.html
package com.blucalc.netfind;

import java.util.ArrayList;
import java.util.List;

import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.IntentFilter;
import android.os.Bundle;
import android.net.wifi.*;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.*;


public class NetworkfinderActivity extends Activity {
    /** Called when the activity is first created. */
    WifiManager wifi;
    BroadcastReceiver receiver;
    List<FrameLayout> netlist;
    LinearLayout ll;
    Button b;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        System.out.println("start of main constructor");
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        //a couple interface elements I want to access
        ll = (LinearLayout)findViewById(R.id.networkList);
        b = (Button)findViewById(R.id.refreshButton);
        //initialisation of some memory
        netlist=new ArrayList<FrameLayout>();
        //where all network info comes from
        wifi=(WifiManager)getSystemService(WIFI_SERVICE);
        // Register Broadcast Receiver
        receiver = new WiFiScanReceiver(this);
        registerReceiver(receiver, new IntentFilter(
                WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));

        b.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {;
            System.out.println("clicked");
                ll.removeAllViews();
                netlist.clear();

                wifi.startScan();
            }
        });
        System.out.println("end of main constructor");
    }

    @Override
    public void onStop() {
        unregisterReceiver(receiver);
    }
    public void processResults(List<ScanResult> results)
    {
        System.out.println("processResults(results "+results.toString());
        ll.removeAllViews();
        netlist.clear();
        for (ScanResult result:results)
        {
            readResult(result);
        }
        System.out.println("end of processResults");

    }
    public void readResult(ScanResult result)
    {
        System.out.println("readResult(result "+result.toString());
        FrameLayout frame=new FrameLayout(this);
        TextView ssid=new TextView(this);
        TextView strength=new TextView(this);
        System.out.println("1");
        int level=result.level;
        System.out.println("level="+level);
        int signal=WifiManager.calculateSignalLevel(level, 100)+1;
        //signal will be strength of the signal as a percent (from 1 to 100)
        System.out.println("signal="+signal);

        strength.setText(new Integer(signal).toString());
        ssid.setText(result.SSID);
        TextView cheat=new TextView(this);
        cheat.setText(result.toString());

//      frame.addView(ssid);
//      frame.addView(strength);
        frame.addView(cheat);

        netlist.add(frame);
        ll.addView(netlist.get(netlist.size()-1));
        System.out.println("end of readResults");
    }

}

and last but not least, here’s the entire output, plus all error messages.

06-20 20:40:06.835: I/ApplicationPackageManager(2399): cscCountry is not German : XSA
06-20 20:40:06.835: I/System.out(2399): start of main constructor
06-20 20:40:06.867: V/WifiProgressStore(2399): WifiProgressStore Created
06-20 20:40:06.867: I/System.out(2399): end of main constructor
06-20 20:40:16.765: I/System.out(2399): clicked
06-20 20:40:17.351: I/System.out(2399): onReceive(Context=com.blucalc.netfind.NetworkfinderActivity@40518050Intent=Intent { act=android.net.wifi.SCAN_RESULTS }
06-20 20:40:17.363: I/System.out(2399): processResults(results [SSID: BluCalculator, BSSID: f4:ec:38:a9:1d:56, capabilities: [WPA-PSK-TKIP+CCMP][WPA2-PSK-TKIP+CCMP][WPS], level: -51, frequency: 2412, SSID: BigAir, BSSID: 06:27:22:b3:41:7e, capabilities: , level: -72, frequency: 2437, SSID: BigAir, BSSID: 06:27:22:5f:56:d8, capabilities: , level: -87, frequency: 2437]
06-20 20:40:17.367: I/System.out(2399): readResult(result SSID: BluCalculator, BSSID: f4:ec:38:a9:1d:56, capabilities: [WPA-PSK-TKIP+CCMP][WPA2-PSK-TKIP+CCMP][WPS], level: -51, frequency: 2412
06-20 20:40:17.375: I/System.out(2399): 1
06-20 20:40:17.375: I/System.out(2399): level=-51
06-20 20:40:17.375: I/System.out(2399): signal=100
06-20 20:40:17.378: I/System.out(2399): end of readResults
06-20 20:40:17.382: I/System.out(2399): readResult(result SSID: BigAir, BSSID: 06:27:22:b3:41:7e, capabilities: , level: -72, frequency: 2437
06-20 20:40:17.390: I/System.out(2399): 1
06-20 20:40:17.390: I/System.out(2399): level=-72
06-20 20:40:17.394: D/AndroidRuntime(2399): Shutting down VM
06-20 20:40:17.394: W/dalvikvm(2399): threadid=1: thread exiting with uncaught exception (group=0x40015578)
06-20 20:40:17.402: E/AndroidRuntime(2399): FATAL EXCEPTION: main
06-20 20:40:17.402: E/AndroidRuntime(2399): java.lang.RuntimeException: Error receiving broadcast Intent { act=android.net.wifi.SCAN_RESULTS } in com.blucalc.netfind.WiFiScanReceiver@40520ec0
06-20 20:40:17.402: E/AndroidRuntime(2399):     at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:722)
06-20 20:40:17.402: E/AndroidRuntime(2399):     at android.os.Handler.handleCallback(Handler.java:587)
06-20 20:40:17.402: E/AndroidRuntime(2399):     at android.os.Handler.dispatchMessage(Handler.java:92)
06-20 20:40:17.402: E/AndroidRuntime(2399):     at android.os.Looper.loop(Looper.java:123)
06-20 20:40:17.402: E/AndroidRuntime(2399):     at android.app.ActivityThread.main(ActivityThread.java:3687)
06-20 20:40:17.402: E/AndroidRuntime(2399):     at java.lang.reflect.Method.invokeNative(Native Method)
06-20 20:40:17.402: E/AndroidRuntime(2399):     at java.lang.reflect.Method.invoke(Method.java:507)
06-20 20:40:17.402: E/AndroidRuntime(2399):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
06-20 20:40:17.402: E/AndroidRuntime(2399):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
06-20 20:40:17.402: E/AndroidRuntime(2399):     at dalvik.system.NativeStart.main(Native Method)
06-20 20:40:17.402: E/AndroidRuntime(2399): Caused by: java.lang.ArithmeticException: divide by zero
06-20 20:40:17.402: E/AndroidRuntime(2399):     at android.net.wifi.WifiManager.calculateSignalLevel(WifiManager.java:957)
06-20 20:40:17.402: E/AndroidRuntime(2399):     at com.blucalc.netfind.NetworkfinderActivity.readResult(NetworkfinderActivity.java:79)
06-20 20:40:17.402: E/AndroidRuntime(2399):     at com.blucalc.netfind.NetworkfinderActivity.processResults(NetworkfinderActivity.java:65)
06-20 20:40:17.402: E/AndroidRuntime(2399):     at com.blucalc.netfind.WiFiScanReceiver.onReceive(WiFiScanReceiver.java:23)
06-20 20:40:17.402: E/AndroidRuntime(2399):     at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:709)
06-20 20:40:17.402: E/AndroidRuntime(2399):     ... 9 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-05T23:53:57+00:00Added an answer on June 5, 2026 at 11:53 pm

    ANSWER UPDATED

    If you look into your stack trace, you will find another exception that points out the real problem:

    06-20 20:40:17.402: E/AndroidRuntime(2399): Caused by: java.lang.ArithmeticException: divide by zero
    06-20 20:40:17.402: E/AndroidRuntime(2399):     at android.net.wifi.WifiManager.calculateSignalLevel(WifiManager.java:957)
    06-20 20:40:17.402: E/AndroidRuntime(2399):     at com.blucalc.netfind.NetworkfinderActivity.readResult(NetworkfinderActivity.java:79)
    06-20 20:40:17.402: E/AndroidRuntime(2399):     at com.blucalc.netfind.NetworkfinderActivity.processResults(NetworkfinderActivity.java:65)
    06-20 20:40:17.402: E/AndroidRuntime(2399):     at com.blucalc.netfind.WiFiScanReceiver.onReceive(WiFiScanReceiver.java:23)
    06-20 20:40:17.402: E/AndroidRuntime(2399):     at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:709)
    06-20 20:40:17.402: E/AndroidRuntime(2399):     ... 9 more
    

    Note the part that says

        6-20 20:40:17.402: E/AndroidRuntime(2399): Caused by: java.lang.ArithmeticException: divide by zero
    

    The method you are attempting to access (calculateSignalLevel) has a known bug in it. You can find a post relating to the use calculateSignalLevel (that includes the code implementation of calculateSignalLevel) at this question (also note Ridcully’s comment on Lars’ answer).

    The problem is most likely your use of 100 here:

    WifiManager.calculateSignalLevel(level, 100);
    

    When this number is greater than 45, you will get a divide by zero exception. Try stepping through the method with a value of 100 for partitionLevel and observe the outcome.

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

Sidebar

Related Questions

Okay, so I'm working on a java server for an Apps backend, it must
okay, so i have an asp.net (C#) application and i want to add a
I am receiving the following error: error: expected constructor, destructor, or type conversion before
Is it okay to have a full silverlight website? I've seen some website implements
Okay, so I've got this TableLayout, and its full of data - with all
Okay, so I'm trying to make a full text search in multiple columns, something
Okay, I'm trying to load a file in Java using this code: String file
Okay full code now: DBOpenHelper: public class DBOpenHelper extends SQLiteOpenHelper { private SQLiteDatabase mDatabase;
Okay, this is part of the full code of a guessing game. public static
okay, so this is suppose to be part of the full code, but the

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.