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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T02:27:01+00:00 2026-05-30T02:27:01+00:00

Okay, so I have searched this site and found many tutorials on how to

  • 0

Okay, so I have searched this site and found many tutorials on how to pass variables to another activity with an Intent, but for some reason I still am having trouble getting any thing passed except for a null value.
Logcat tells me this:

E/AndroidRuntime(  747): java.lang.RuntimeException: Unable to start activity ComponentInfo{eu.sourceway.tutorials.BetterTabs/eu.sourceway.tutorials.BetterTabs.addonsBrowser}: java.lang.NullPointerException

Here is my starting Activity:

        lv.setOnItemClickListener(new OnItemClickListener() {
      public void onItemClick(AdapterView<?> parent, View view,int position, long id) {
          String content = links[position];
            Intent addonPage = new Intent(ThirdTab.this,addonsBrowser.class);
            Bundle b = new Bundle();
            b.putString("passed", "http://google.com");
            addonPage.putExtras(b);
            startActivity(addonPage);

      }

    }); 

Here is my Secondary Activity:

public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

Bundle extras = getIntent().getExtras();

String URL = extras.getString("passed");

browser=new WebView(this);
browser.setWebViewClient(new WebViewClient());
browser.setInitialScale(55);

setContentView(browser);
browser.loadUrl(URL);



}

I set a breakpoint in Eclipse and viewed the passed Bundle variable “extras” in the second Activity, and it show as null, so that and the logcat results are what lead to to conclude that it is not being passed.
Also if you look in the first Activity, I actually have the URL being pulled from an ArrayList originally, and then stored in a String variable called content, but that will not pass either. So that is why I subbed the “http://google.com&#8221; address. I have tried this with other URLs and still can’t pass it. I know the web works, as I have been able o load pages in a webview.
The main purpose of this is to have a list that has links from a website, and with the onItemClick, pass the URL to another Activity that has a WebView to load it.
The generating of the URLs into the ArraysList works. I have been able to populate the list. The problem is that it force closes as soon as I click on a link because the variable sent is null.
Any ideas are much appreciated.

  • 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-30T02:27:04+00:00Added an answer on May 30, 2026 at 2:27 am

    “check this out just put this code in your onclick of first activity Note:->directly capture the edittext donot save the edit text in string and then pass it ,if you will do show then string will not pass. see the below example”

     public void onClick(View v) {
    
    // TODO Auto-generated method stub
    Intent i = new Intent(this,Web.class);
    i.putExtra("epuzzle",urlenter.getText().toString());
    
    final int result = 1;
    startActivityForResult(i, result);
    }
    

    “now in second activity put this ,Note:-> is you will try to save the passeed string of activity first in to another string in activity second then it will not work ,you should directly pass the string to loadurl instead of saving and passing to loadurl.”

     Intent intent = getIntent();
     w.loadUrl(intent.getExtras().getString("epuzzle"));
     w.getSettings().setJavaScriptEnabled(true);
    

    plz let me know if it worked for you or not.

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

Sidebar

Related Questions

Okay, this should be really simple, but I have searched all over for the
Okay, so first, I have searched for this everywhere but it seems like every
I've searched SO and this question seems to have been asked multiple times, but
Okay I have been trying to get this to work for some time now.
Okay I have seen some very similar questions here but none seem to be
Okay, Ive searched around and found how this is supposed to be done. For
Okay I have this RewriteRule which is supposed to redirect any request for the
okay i have found the way to run a video in a image.... the
Okay I have updated my code a little, but I am still not exactly
Okay so I have the following Code which appends a string to another in

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.