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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:35:34+00:00 2026-06-01T13:35:34+00:00

Well the error is: W/dalvikvm(320): threadid=3: thread exiting with uncaught exception (group=0x4001b188) E/AndroidRuntime(320): Uncaught

  • 0

Well the error is:

 W/dalvikvm(320): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
 E/AndroidRuntime(320): Uncaught handler: thread main exiting due to uncaught exception
 E/AndroidRuntime(320): java.lang.NullPointerException
 E/AndroidRuntime(320):     at com.android.vosori.Amp$1.onCheckedChanged(Amp.java:58)
 E/AndroidRuntime(320):     at android.widget.CompoundButton.setChecked(CompoundButton.java:122)
E/AndroidRuntime(320):  at android.widget.ToggleButton.setChecked(ToggleButton.java:66)
 E/AndroidRuntime(320):     at android.widget.CompoundButton.toggle(CompoundButton.java:85)
 E/AndroidRuntime(320):     at android.widget.CompoundButton.performClick(CompoundButton.java:97)
 E/AndroidRuntime(320):     at android.view.View.onTouchEvent(View.java:4179)
 E/AndroidRuntime(320):     at android.widget.TextView.onTouchEvent(TextView.java:6541)
 E/AndroidRuntime(320):     at android.view.View.dispatchTouchEvent(View.java:3709)      E/AndroidRuntime(320):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
 E/AndroidRuntime(320):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
 E/AndroidRuntime(320):     at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:884)
 E/AndroidRuntime(320):     at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)
E/AndroidRuntime(320):  at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)
E/AndroidRuntime(320):  at android.app.Activity.dispatchTouchEvent(Activity.java:2061)
 E/AndroidRuntime(320):     at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
 E/AndroidRuntime(320):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1691)
 E/AndroidRuntime(320):     at android.os.Handler.dispatchMessage(Handler.java:99)
 E/AndroidRuntime(320):     at android.os.Looper.loop(Looper.java:123)
 E/AndroidRuntime(320):     at android.app.ActivityThread.main(ActivityThread.java:4363)
 E/AndroidRuntime(320):     at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(320):  at java.lang.reflect.Method.invoke(Method.java:521)
 E/AndroidRuntime(320):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
 E/AndroidRuntime(320):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
 E/AndroidRuntime(320):     at dalvik.system.NativeStart.main(Native Method)

and.. source is :

public class Amp extends Activity implements OnSeekBarChangeListener {

    WakeLock wL;
    public boolean tb;
    SeekBar volume;
    AudioManager am;
    MediaPlayer mp;
    AudioRecord arec;
    AudioTrack atrack;
    ToggleButton tbs;
    static final int buffersize = 200000;
    final short[] buffer = new short[buffersize];
    short[] readBuffer = new short[buffersize];

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        // wake-lock
        PowerManager pM = (PowerManager) getSystemService(Context.POWER_SERVICE);
        WakeLock wL = pM.newWakeLock(PowerManager.FULL_WAKE_LOCK, "whatever");

        super.onCreate(savedInstanceState);
        wL.acquire();
        // fullscreen
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.main);
            android.os.Process
                    .setThreadPriority(android.os.Process.THREAD_PRIORITY_URGENT_AUDIO);
            int bufferSize = AudioRecord.getMinBufferSize(8000,
                    AudioFormat.CHANNEL_CONFIGURATION_MONO,
                    AudioFormat.ENCODING_PCM_16BIT);

            arec = new AudioRecord(MediaRecorder.AudioSource.MIC, 8000,
                    AudioFormat.CHANNEL_CONFIGURATION_MONO,
                    AudioFormat.ENCODING_PCM_16BIT, bufferSize);
            atrack = new AudioTrack(AudioManager.STREAM_VOICE_CALL, 8000,
                    AudioFormat.CHANNEL_CONFIGURATION_MONO,
                    AudioFormat.ENCODING_PCM_16BIT, bufferSize,
                    AudioTrack.MODE_STREAM);
            atrack.setPlaybackRate(8000);
            byte[] buffer = new byte[bufferSize];


            while (tb) {
                arec.read(buffer, 0, bufferSize);
                atrack.write(readBuffer, 0, buffer.length);
            }

        tbs = (ToggleButton) findViewById(R.id.tbS);
        tbs.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

            public void onCheckedChanged(CompoundButton buttonView,
                    boolean isChecked) {
                // TODO Auto-generated method stub
                if (isChecked) {
                    arec.startRecording();
                    atrack.play();
                } else {
                    arec.stop();
                    atrack.stop();

                }

            }
        });

        volume = (SeekBar) findViewById(R.id.sb1);
        am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
        int maxV = am.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
        int curV = am.getStreamVolume(AudioManager.STREAM_MUSIC);
        volume.setMax(maxV);
        volume.setProgress(curV);
        volume.setOnSeekBarChangeListener(this);
    }

    public void onProgressChanged(SeekBar arg0, int progress, boolean arg2) {
        // TODO Auto-generated method stub
        am.setStreamVolume(AudioManager.STREAM_MUSIC, progress, 0);
        am.setSpeakerphoneOn(true);

    }

    public void onStartTrackingTouch(SeekBar arg0) {
        // TODO Auto-generated method stub

    }

    public void onStopTrackingTouch(SeekBar arg0) {
        // TODO Auto-generated method stub

    }


}

Can you please help me? I’m stuck with this days, can’t find way to fix this

updated
Edit: sorry D: i’m not that good with this D: i probably have a mistake here also
tried also to move those thing into oncheckedchanged method but didnt work :S

  • 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-01T13:35:36+00:00Added an answer on June 1, 2026 at 1:35 pm

    You aren’t initializing your arec and atrack variables until your method “run” is called.
    I don’t see anywhere in your code that you are calling the method run() so those variables will never get initialized.

    Move initializing those variables into the onCreate and that problem should go away

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

Sidebar

Related Questions

As a developer, we often encounter that exception: NullReferenceException with the well known error
Compiler error CS0283 indicates that only the basic POD types (as well as strings,
Well since i installed IE 8 i get this error so i cant debug
well for some strange reason IE gives me and InvalidAuthenticityToken error almost every time
Well, I´m developing a wpf application and I got a strange error on design
I get a strange error and couldn't find the answer.. This code works well:
I am well aware about error_reporting(0); & ini_set('display_errors', Off); to make error messages go
I know this error very well however this is the once time I'm stumped.
I'm getting an error (well, a ton of errors actually) from valgrind that I'm
When you run perl -e "Bla->new" , you get this well-known error: Can't locate

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.