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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:27:05+00:00 2026-05-24T07:27:05+00:00

I am a student and new to programming. It might be a simple error,

  • 0

I am a student and new to programming. It might be a simple error, can anybody help me fix it.I have to pass an array list from one activity to another. In this activity i have 5 radio buttons RB1, RB2…. and i want to pass the content of news[] it to another activity called display.

public void onClick(View v) {
        String[] news;
        news = new String[5];

        news[0] = "bbc";
        news[1] = "guardian";
        news[2] = "yahoo";
        news[3] = "sky";
        news[4] = "fox news";

        final ArrayList<String> arr = new ArrayList<String>();
        if (RB1.isChecked() == true)
            arr.add(news[0]);
        if (RB2.isChecked() == true)
             arr.add(news[1]);
        if (RB3.isChecked() == true)
            arr.add(news[2]);
        if (RB4.isChecked() == true)
            arr.add(news[3]);
        if (RB5.isChecked() == true)
            arr.add(news[4]);
if (v == Done)
        {
            Button done = (Button) findViewById(R.id.DONE);
            done.setOnClickListener(new View.OnClickListener() {
                public void onClick(View view)
                {
                    Intent myIntent = new Intent(Read.this, display.class);
                    myIntent.putExtra("pass",arr);
                    startActivity(myIntent);
                }
            });
        }

the codes for next activity is as follows

                    Intent myintent = getIntent();
        String[] Array = myintent.getStringArrayExtra("pass");

        for (int i = 0; i < Array.length; i++)
            Log.v(LOG_TAG, "THE website Is :" +Array[i]);

I am geting a java.lang.NullPointerException in the above two line i.e

for (int i = 0; i < Array.length; i++)
                Log.v(LOG_TAG, "THE website Is :" +Array[i]);

can u pls tell me why ?
thanks in advance

  • 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-05-24T07:27:06+00:00Added an answer on May 24, 2026 at 7:27 am

    First of all, some conventions: Start names of variables lowercase, so array instead of Array. This will save you from some confusion later.

    Try it as follows, from this thread:

    Bundle b=new Bundle();
    b.putStringArray(key, new String[]{value1, value2});
    Intent i=new Intent(context, Class);
    i.putExtras(b);
    

    and

    Bundle b=this.getIntent().getExtras();
    String[] array=b.getStringArray(key);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Iam just a beginner student socket programming.I tried a simple code from TCP/IP Sockets
Can anybody suggest what is wrong here? public class Student { public List<Class> Classes
I am a college student slightly new to web programming and lately I have
I am a brand new programming student, so please forgive my ignorance. My assignment
I am new to computer programming and have some experience programming with python. I
I am student, new to database programming and new to Stack Overflow! Basically I
I'm a student new to android, and I have an application which use background
I can run RENAME TABLE student TO student_new ; The command is same and
public static ArrayList GetStudentAsArrayList() { ArrayList students = new ArrayList { new Student() {
So, I'm a brand new CS student, on a Mac, and I'm learning C++

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.