在web视图参数不是工作在Android的网址是什么? [英] URL with parameter in WebView not working in Android?

查看:135
本文介绍了在web视图参数不是工作在Android的网址是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图调用使用loadURL方法的web视图与下面的网址

<一个href="http://stage.realtylog.net/iPhone/functions.php?username=xxx&ID=xxx&act=readFileAndPrint" rel="nofollow">http://stage.realtylog.net/iPhone/functions.php?username=xxx&ID=xxx&act=readFileAndPrint

在调用这个URL,它提供了从服务器的图像。我需要显示的图像上的web视图。

它的正常工作与正常的URL。但它不工作与上述URL与参数。

这给了我一个错误,如:

  

函数名称必须是一个字符串   /var/www/stage/realtylog.net/iPhone/functions.php

我试图URLEn $ C C上面的URL $,但它仍然没有工作。 任何形式的帮助将是非常美联社preciated。

 包com.hussain.webview2;

进口android.app.Activity;
进口android.os.Bundle;
进口android.view.Window;
进口android.webkit.SslErrorHandler;
进口android.net.http *。
进口android.webkit.WebChromeClient;
进口android.webkit.WebView;
进口android.webkit.WebViewClient;


公共类WebViewDemo2Activity扩展活动
{
   最后活动活动=这一点;

    @覆盖
    公共无效的onCreate(包savedInstanceState)
    {
       super.onCreate(savedInstanceState);
       。this.getWindow()requestFeature(Window.FEATURE_PROGRESS);
       的setContentView(R.layout.main);

       的WebView web视图=(web视图)findViewById(R.id.webview);
      // webView.setWebViewClient(新WebViewClient());
      // webView.addView(webView.getZoomControls());
      webView.getSettings()setJavaScriptEnabled(真)。

      webView.setWebChromeClient(新WebChromeClient(){
        公共无效onProgressChanged(web视图来看,INT进度)
        {
            activity.setTitle(载入中...);
            activity.setProgress(进度* 100);

            如果(进度== 100)
                activity.setTitle(完成);
        }
    });

    webView.setWebViewClient(新WebViewClient(){
        @覆盖
       公共无效onReceivedError(web视图来看,INT错误code,字符串描述,字符串failingUrl)
       {
           //处理错误
       }



        @覆盖
        公共布尔shouldOverrideUrlLoading(web视图查看,字符串URL)
        {
            view.loadUrl(URL);
            返回true;
        }
    });

    //webView.loadUrl("http://developer.android.com);
    webView.loadUrl("http://stage.realtylog.net/iPhone/functions.php?username=xxxx&ID=xxxx&act=readFileAndPrint");


    }
}
 

解决方案

欢迎到可怕的已知的错误,谷歌这感觉并不像固定,甚至是解决。

<一个href="http://$c$c.google.com/p/android/issues/detail?id=17535">http://$c$c.google.com/p/android/issues/detail?id=17535

I am trying to call the loadUrl method in a webview with the below url

http://stage.realtylog.net/iPhone/functions.php?username=xxx&ID=xxx&act=readFileAndPrint

When calling this URL, it gives an image from server. I need to display that image on a webview.

It's working fine with normal URLs. But its not working with the above url with parameters.

It gives me an error like:

Function name must be a string in /var/www/stage/realtylog.net/iPhone/functions.php

I tried to URLEncode the above url , but its still not working. Any kind of help will be highly appreciated.

package com.hussain.webview2;

import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.webkit.SslErrorHandler;
import android.net.http.*;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;


public class WebViewDemo2Activity extends Activity
{
   final Activity activity = this;

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
       super.onCreate(savedInstanceState);
       this.getWindow().requestFeature(Window.FEATURE_PROGRESS);
       setContentView(R.layout.main);

       WebView webView = (WebView) findViewById(R.id.webview);
      // webView.setWebViewClient(new WebViewClient());
      // webView.addView(webView.getZoomControls());
      webView.getSettings().setJavaScriptEnabled(true);

      webView.setWebChromeClient(new WebChromeClient() {
        public void onProgressChanged(WebView view, int progress)
        {
            activity.setTitle("Loading...");
            activity.setProgress(progress * 100);

            if(progress == 100)
                activity.setTitle("Done");
        }
    });

    webView.setWebViewClient(new WebViewClient() {
        @Override
       public void onReceivedError(WebView view, int errorCode, String description, String failingUrl)
       {
           // Handle the error
       }



        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url)
        {
            view.loadUrl(url);
            return true;
        }
    });

    //webView.loadUrl("http://developer.android.com");
    webView.loadUrl("http://stage.realtylog.net/iPhone/functions.php?username=xxxx&ID=xxxx&act=readFileAndPrint");


    }
}

解决方案

Welcome to a horrible known bug, that Google doesn't feel like fixing, or even addressing.

http://code.google.com/p/android/issues/detail?id=17535

这篇关于在web视图参数不是工作在Android的网址是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆