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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:40:28+00:00 2026-06-05T07:40:28+00:00

I had a ListView so I deleted it in the main.xml designer and it

  • 0

I had a ListView so I deleted it in the main.xml designer and it was automatically removed from the main.xml code also.

Then I added a spinner to the designer which added automatically to the main.xml code too.
In my program I deleted all uses for the ListView and added using the spinner.

Then I did a debug on one line and when I run my application in Debug mode and select yes then I’m getting an error in the debug window in red saying Source not found.

And I have a button I can click: Edit a source lookup path

I’m not sure where the problem is and how to fix it. 5 minutes ago before I removed the ListView and added the spinner in the designer it worked perfectly.

This is the main.xml code:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TextView
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:text="@string/hello" />


    <Button
        android:id="@+id/btnSpeak"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Button" />

    <EditText
        android:id="@+id/txtText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10" >

        <requestFocus />

    </EditText>

    <Spinner
        android:id="@+id/spinner1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

</LinearLayout>

And this is my java class code:

package com.testotspeech;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Locale;

import android.app.Activity;
import android.os.Bundle;
import android.speech.tts.TextToSpeech;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class AndroidTestToSpeechActivity extends Activity implements
        TextToSpeech.OnInitListener {
    /** Called when the activity is first created. */

    private TextToSpeech tts;
    private Button btnSpeak;
    private EditText txtText;
    private String array_spinner[];
    private ArrayList<String> itemsList;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Log.i("----------",Arrays.toString(Locale.getAvailableLocales()));
        itemsList.add(Arrays.toString(Locale.getAvailableLocales()));
        array_spinner = new String[itemsList.size()];
        tts = new TextToSpeech(this, this);
        btnSpeak = (Button) findViewById(R.id.btnSpeak);
        txtText = (EditText) findViewById(R.id.txtText);

        // button on click event
        btnSpeak.setOnClickListener(new View.OnClickListener() {

            public void onClick(View arg0) {
                speakOut();
            }

        });
    }

    @Override
    public void onDestroy() {
        // Don't forget to shutdown tts!
        if (tts != null) {
            tts.stop();
            tts.shutdown();
        }
        super.onDestroy();
    }

    public void onInit(int status) {

        if (status == TextToSpeech.SUCCESS) {

            int result = tts.setLanguage(Locale.ENGLISH);

            if (result == TextToSpeech.LANG_MISSING_DATA
                    || result == TextToSpeech.LANG_NOT_SUPPORTED) {
                Log.e("TTS", "This Language is not supported");
            } else {
                btnSpeak.setEnabled(true);
                speakOut();

            }

        } else {
            Log.e("TTS", "Initilization Failed!");
        }

    }

    private void speakOut() {

        String text = txtText.getText().toString();
        tts.speak(text, TextToSpeech.QUEUE_FLUSH, null);
    }
}

What could be causing the error?

Thanks.

EDIT: here is the stacktrace log, only errors in red:

06-04 20:20:05.609: E/AndroidRuntime(8567): FATAL EXCEPTION: main
06-04 20:20:05.609: E/AndroidRuntime(8567): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.testotspeech/com.testotspeech.AndroidTestToSpeechActivity}: java.lang.NullPointerException
06-04 20:20:05.609: E/AndroidRuntime(8567):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2787)
06-04 20:20:05.609: E/AndroidRuntime(8567):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2803)
06-04 20:20:05.609: E/AndroidRuntime(8567):     at android.app.ActivityThread.access$2300(ActivityThread.java:135)
06-04 20:20:05.609: E/AndroidRuntime(8567):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2136)
06-04 20:20:05.609: E/AndroidRuntime(8567):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-04 20:20:05.609: E/AndroidRuntime(8567):     at android.os.Looper.loop(Looper.java:144)
06-04 20:20:05.609: E/AndroidRuntime(8567):     at android.app.ActivityThread.main(ActivityThread.java:4937)
06-04 20:20:05.609: E/AndroidRuntime(8567):     at java.lang.reflect.Method.invokeNative(Native Method)
06-04 20:20:05.609: E/AndroidRuntime(8567):     at java.lang.reflect.Method.invoke(Method.java:521)
06-04 20:20:05.609: E/AndroidRuntime(8567):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
06-04 20:20:05.609: E/AndroidRuntime(8567):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
06-04 20:20:05.609: E/AndroidRuntime(8567):     at dalvik.system.NativeStart.main(Native Method)
06-04 20:20:05.609: E/AndroidRuntime(8567): Caused by: java.lang.NullPointerException
06-04 20:20:05.609: E/AndroidRuntime(8567):     at com.testotspeech.AndroidTestToSpeechActivity.onCreate(AndroidTestToSpeechActivity.java:30)
06-04 20:20:05.609: E/AndroidRuntime(8567):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1069)
06-04 20:20:05.609: E/AndroidRuntime(8567):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2751)
06-04 20:20:05.609: E/AndroidRuntime(8567):     ... 11 more
06-04 20:22:54.219: E/ActivityManager(127): fail to set top app changed!
06-04 20:24:32.509: E/ActivityManager(127): fail to set top app changed!
06-04 20:25:45.439: E/ActivityManager(127): fail to set top app changed!
06-04 20:32:49.439: E/ActivityManager(127): fail to set top app changed!
06-04 20:33:06.109: E/lights(127): write ok string=0,len=1
06-04 20:33:06.109: E/lights(127): write ok string=0,len=1
06-04 20:33:06.119: E/lights(127): write ok string=0 0,len=3
06-04 20:33:06.119: E/lights(127): write ok string=1,len=1
06-04 20:33:06.129: E/lights(127): write ok string=0,len=1
06-04 20:33:06.129: E/lights(127): write ok string=0 0,len=3
06-04 20:33:06.149: E/lights(127): write ok string=0,len=1
06-04 20:33:06.159: E/lights(127): write ok string=0,len=1
06-04 20:33:06.159: E/lights(127): write ok string=0 0,len=3
06-04 20:33:06.169: E/lights(127): write ok string=1,len=1
06-04 20:33:06.169: E/lights(127): write ok string=0,len=1
06-04 20:33:06.169: E/lights(127): write ok string=0 0,len=3
06-04 20:33:09.179: E/lights(127): write ok string=0,len=1
06-04 20:33:09.179: E/lights(127): write ok string=0,len=1
06-04 20:33:09.179: E/lights(127): write ok string=0 0,len=3
06-04 20:33:09.189: E/lights(127): write ok string=1,len=1
06-04 20:33:09.189: E/lights(127): write ok string=0,len=1
06-04 20:33:09.189: E/lights(127): write ok string=0 0,len=3
06-04 20:33:16.309: E/AndroidRuntime(8748): FATAL EXCEPTION: main
06-04 20:33:16.309: E/AndroidRuntime(8748): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.testotspeech/com.testotspeech.AndroidTestToSpeechActivity}: java.lang.NullPointerException
06-04 20:33:16.309: E/AndroidRuntime(8748):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2787)
06-04 20:33:16.309: E/AndroidRuntime(8748):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2803)
06-04 20:33:16.309: E/AndroidRuntime(8748):     at android.app.ActivityThread.access$2300(ActivityThread.java:135)
06-04 20:33:16.309: E/AndroidRuntime(8748):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2136)
06-04 20:33:16.309: E/AndroidRuntime(8748):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-04 20:33:16.309: E/AndroidRuntime(8748):     at android.os.Looper.loop(Looper.java:144)
06-04 20:33:16.309: E/AndroidRuntime(8748):     at android.app.ActivityThread.main(ActivityThread.java:4937)
06-04 20:33:16.309: E/AndroidRuntime(8748):     at java.lang.reflect.Method.invokeNative(Native Method)
06-04 20:33:16.309: E/AndroidRuntime(8748):     at java.lang.reflect.Method.invoke(Method.java:521)
06-04 20:33:16.309: E/AndroidRuntime(8748):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
06-04 20:33:16.309: E/AndroidRuntime(8748):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
06-04 20:33:16.309: E/AndroidRuntime(8748):     at dalvik.system.NativeStart.main(Native Method)
06-04 20:33:16.309: E/AndroidRuntime(8748): Caused by: java.lang.NullPointerException
06-04 20:33:16.309: E/AndroidRuntime(8748):     at com.testotspeech.AndroidTestToSpeechActivity.onCreate(AndroidTestToSpeechActivity.java:30)
06-04 20:33:16.309: E/AndroidRuntime(8748):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1069)
06-04 20:33:16.309: E/AndroidRuntime(8748):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2751)
06-04 20:33:16.309: E/AndroidRuntime(8748):     ... 11 more
06-04 20:33:16.339: E/lights(127): write ok string=0,len=1
06-04 20:33:16.349: E/lights(127): write ok string=0,len=1
06-04 20:33:16.349: E/lights(127): write ok string=0 0,len=3
06-04 20:33:16.349: E/lights(127): write ok string=1,len=1
06-04 20:33:16.349: E/lights(127): write ok string=0,len=1
06-04 20:33:16.359: E/lights(127): write ok string=0 0,len=3
06-04 20:33:16.559: E/lights(127): write ok string=0,len=1
06-04 20:33:16.569: E/lights(127): write ok string=0,len=1
06-04 20:33:16.579: E/lights(127): write ok string=0 0,len=3
06-04 20:33:16.579: E/lights(127): write ok string=0,len=1
06-04 20:33:16.579: E/lights(127): write ok string=0,len=1
06-04 20:33:16.579: E/lights(127): write ok string=0 0,len=3
06-04 20:33:16.629: E/lights(127): write ok string=0,len=1
06-04 20:33:16.639: E/lights(127): write ok string=0,len=1
06-04 20:33:16.639: E/lights(127): write ok string=0 0,len=3
06-04 20:33:16.639: E/lights(127): write ok string=0,len=1
06-04 20:33:16.639: E/lights(127): write ok string=0,len=1
06-04 20:33:16.649: E/lights(127): write ok string=0 0,len=3
06-04 20:33:18.789: E/lights(127): write ok string=0,len=1
06-04 20:33:18.789: E/lights(127): write ok string=0,len=1
06-04 20:33:18.789: E/lights(127): write ok string=0 0,len=3
06-04 20:33:18.789: E/lights(127): write ok string=0,len=1
06-04 20:33:18.799: E/lights(127): write ok string=0,len=1
06-04 20:33:18.799: E/lights(127): write ok string=0 0,len=3
06-04 20:33:23.009: E/lights(127): write ok string=0,len=1
06-04 20:33:23.019: E/lights(127): write ok string=0,len=1
06-04 20:33:23.019: E/lights(127): write ok string=0 0,len=3
06-04 20:33:23.019: E/lights(127): write ok string=1,len=1
06-04 20:33:23.029: E/lights(127): write ok string=0,len=1
06-04 20:33:23.029: E/lights(127): write ok string=0 0,len=3
06-04 20:33:23.049: E/DatabaseUtils(367): Writing exception to parcel
06-04 20:33:23.049: E/DatabaseUtils(367): java.lang.SecurityException: Permission Denial: reading com.android.providers.downloads.DownloadProvider uri content://downloads/download from pid=316, uid=10007 requires android.permission.ACCESS_DOWNLOAD_MANAGER
06-04 20:33:23.049: E/DatabaseUtils(367):   at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:277)
06-04 20:33:23.049: E/DatabaseUtils(367):   at android.content.ContentProvider$Transport.bulkQuery(ContentProvider.java:155)
06-04 20:33:23.049: E/DatabaseUtils(367):   at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:134)
06-04 20:33:23.049: E/DatabaseUtils(367):   at android.os.Binder.execTransact(Binder.java:288)
06-04 20:33:23.049: E/DatabaseUtils(367):   at dalvik.system.NativeStart.run(Native Method)
06-04 20:33:23.049: E/SwitchUsbSettings(316): Error when query download provider. error: java.lang.SecurityException: Permission Denial: reading com.android.providers.downloads.DownloadProvider uri content://downloads/download from pid=316, uid=10007 requires android.permission.ACCESS_DOWNLOAD_MANAGER
06-04 20:33:23.149: E/DatabaseUtils(367): Writing exception to parcel
06-04 20:33:23.149: E/DatabaseUtils(367): java.lang.SecurityException: Permission Denial: reading com.android.providers.downloads.DownloadProvider uri content://downloads/download from pid=316, uid=10007 requires android.permission.ACCESS_DOWNLOAD_MANAGER
06-04 20:33:23.149: E/DatabaseUtils(367):   at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:277)
06-04 20:33:23.149: E/DatabaseUtils(367):   at android.content.ContentProvider$Transport.bulkQuery(ContentProvider.java:155)
06-04 20:33:23.149: E/DatabaseUtils(367):   at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:134)
06-04 20:33:23.149: E/DatabaseUtils(367):   at android.os.Binder.execTransact(Binder.java:288)
06-04 20:33:23.149: E/DatabaseUtils(367):   at dalvik.system.NativeStart.run(Native Method)
06-04 20:33:23.149: E/SwitchUsbSettings(316): Error when query download provider. error: java.lang.SecurityException: Permission Denial: reading com.android.providers.downloads.DownloadProvider uri content://downloads/download from pid=316, uid=10007 requires android.permission.ACCESS_DOWNLOAD_MANAGER
06-04 20:33:56.369: E/ActivityManager(127): fail to set top app changed!
06-04 20:38:30.539: E/ActivityManager(127): fail to set top app changed!
06-04 20:50:48.819: E/ActivityManager(127): fail to set top app changed!
06-04 20:51:59.019: E/ActivityManager(127): fail to set top app changed!
06-04 23:01:32.909: E/Tethering(127): active iface (usb0) reported as added, ignoring
06-04 23:02:23.029: E/Tethering(127): active iface (usb0) reported as added, ignoring
06-04 23:04:03.339: E/Tethering(127): active iface (usb0) reported as added, ignoring
06-04 23:07:23.899: E/Tethering(127): active iface (usb0) reported as added, ignoring
06-04 23:09:54.619: E/Tethering(127): active iface (usb0) reported as added, ignoring
06-04 23:14:04.959: E/Tethering(127): active iface (usb0) reported as added, ignoring
06-04 23:16:35.439: E/Tethering(127): active iface (usb0) reported as added, ignoring
06-04 23:20:58.319: E/jdwp(9122): Failed sending reply to debugger: Broken pipe
06-04 23:21:36.259: E/Tethering(127): active iface (usb0) reported as added, ignoring
  • 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-05T07:40:29+00:00Added an answer on June 5, 2026 at 7:40 am

    your Null pointer is telling you, that your ArrayList itemsList is Null, and not initialized. try it like this:

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Log.i("----------",Arrays.toString(Locale.getAvailableLocales()));
        itemsList = new ArrayList<String>();
        //here you never initialized ItemsList before, and get a nullpointer
        itemsList.add(Arrays.toString(Locale.getAvailableLocales()));
        array_spinner = new String[itemsList.size()];
        tts = new TextToSpeech(this, this);
        btnSpeak = (Button) findViewById(R.id.btnSpeak);
        txtText = (EditText) findViewById(R.id.txtText);
    
        // button on click event
        btnSpeak.setOnClickListener(new View.OnClickListener() {
    
            public void onClick(View arg0) {
                speakOut();
            }
    
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had a activity which contains one button and a listview.The listview contains values
I've got a simple ListView which pulls data from an ObservableCollection and I'm using
I have one listview.which contain one image ,text and one button .i had creted
So I had my listview working perfectly then I decided to add a context
I have a ListView which has been constructed, styled and had an adapter set
I had used a ListView to show some data (String) retrieved from the database...quite
I had tried to to put checkbox in listview through layout inflator and I
I use the following main.xml for my app. <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:layout_width=fill_parent
I had to change a ListView webpart and noticed the syntax that renders the
I developed a WPF application under WinXP and my ListView had my expected layout.

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.