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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:18:05+00:00 2026-06-15T09:18:05+00:00

I am trying to get data from editText box and open that url on

  • 0

I am trying to get data from editText box and open that url on Button click. For that I have to send data from one intent to another. For that, I have referred this and this but was unable to send data.. I am trying to send data from main to web view activity..

MainActivity.Java

public class MainActivity extends Activity {
Button b;

WebView mWebVIew2;
EditText mEdit;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    b = (Button) findViewById(R.id.button1);
    mEdit = (EditText) findViewById(R.id.editText1);
    final String s = mEdit.getText().toString();

    b.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            Toast.makeText(getApplicationContext(), mEdit.getText(), Toast.LENGTH_LONG).show();
            Intent i = new Intent(getApplicationContext(), WebViewActivity.class);
            i.putExtra("mSite", s);
            startActivityForResult(i, 0);
        }
    });

}

}

WebViewActivity.java

public class WebViewActivity extends Activity {
private WebView mWebView;

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.webv);
    mWebView = (WebView) findViewById(R.id.webView1);
    Intent mIntent = getIntent();
    String y = mIntent.getExtras().getString("mSite");

    Toast.makeText(getApplicationContext(), y, Toast.LENGTH_LONG).show();

    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.loadUrl(y);

}

}
  • 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-15T09:18:06+00:00Added an answer on June 15, 2026 at 9:18 am

    You String s is defined as mEdit.getText in the onCreate. It does not reflect the content of the editText when you click your button.

    Instead, fetch the value for s in the onClick method.

    edit

    In further details : in Java, String objects are immutable. A pointer may point to a different reference, but a reference may not be altered (i.e. muted).

    In this case, that means that your String s can never reflect the value of the EditText, but only a copy at a given time. In this particular scenario, the String s contains the content of the editText at startup (in onCreate), which most likely contains either nothing or a default value.

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

Sidebar

Related Questions

I'm trying to get data from an Excel file on a button click event.
I have sugar crm instance and i was trying to get some data from
I'm trying to get data from multiple XML feeds and copy that data to
I am trying to get data from a database. I have the following code
I'm trying to get data from a webpage that serves a XML file periodically
I'm trying to get data from one database and put it in the format
I am trying to get data from one row in a table into three
I'm trying to get data from Geobytes. One of the templates returns JSON and
So I'm trying to get data from my sql database and sort it by
I am trying to get data from my interface, written in c, to another

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.