Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid get url with onclick
    primarykey
    data
    text
    <p>Hello I am trying to get the value of a url with onclick but it is not working for me. I am usign the following code.</p> <pre><code>import android.net.Uri; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.View; import android.webkit.WebView; public class MainActivity extends Activity { String valueOfURL = null; WebView webView; Intent browserIntent; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); browserIntent = new Intent("android.intent.action.VIEW", Uri.parse("http://www.example.com")); startActivity(browserIntent); } public String handleLinkClicked(String value) { if (value.startsWith("http")) valueOfURL = value; return valueOfURL; } public View.OnClickListener myhandler = new View.OnClickListener() { public void onClick(View view) { handleLinkClicked(valueOfURL); webView.loadUrl("http://docs.google.com/gview?embedded=true&amp;url=valueOfURL"); }}; } </code></pre> <p>The first page will load fine but when i click on a pdf on that page it wont load. Basically what I am trying to do is get the value of the URL and pass it to a variable that is then used to be read via google docs. It is a pdf file and its URL looks like this <a href="http://wwww.example.com/c/document_library/get_file" rel="nofollow">http://wwww.example.com/c/document_library/get_file</a>?</p> <p>Can anyone see where I am going wrong and maybe point me in the right direction.</p> <p>Thanking You</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload