为什么它说"位图不能被解析为一个类型"在这种情况下? [英] Why does it say "Bitmap cannot be resolved to a type" in this case?

查看:187
本文介绍了为什么它说"位图不能被解析为一个类型"在这种情况下?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到这个错误。我怎样才能解决这个问题在我的处境?

 位图不能被解析为一个类型

所在行发生错误

 公共无效onPageStarted(的WebView视图,字符串URL,位图图标){

我的code

 公共类MainActivity延伸活动{
    私人活动活动=这一点;
    私人字符串标题=;    私人动作条mActionBar;
    私人SimpleSideDrawer mNav;
    的WebView myWebView;    INT宽度,高度;
    浮flick_width;
    浮flick_height;    @覆盖
    保护无效的onCreate(捆绑savedInstanceState){
        super.onCreate(savedInstanceState);          。标题= activity.getTitle()的toString(); //(1)
          requestWindowFeature(Window.FEATURE_PROGRESS);        的setContentView(R.layout.activity_main);        的getSize();        mActionBar = getActionBar();
        mActionBar.hide();
        mNav =新SimpleSideDrawer(本);
        mNav.setLeftBehindContentView(R.layout.activity_behind_left_simple,这一点);
        mNav.setRightBehindContentView(R.layout.activity_behind_right_simple,这一点);
        myWebView =(的WebView)findViewById(R.id.webView1);
        myWebView.setWebViewClient(新WebViewClient());
        myWebView.getSettings()setJavaScriptEnabled(真)。        myWebView.setWebViewClient(新WebViewClient(){
            @覆盖
            公共无效onPageStarted(的WebView视图,字符串URL,位图图标){
                Log.d(HelloWebView,onPageStarted:+网址);
                activity.setTitle(正在加载...); //(2)
                activity.setProgressBarVisibility(真);
            }
            @覆盖
            公共无效onPageFinished(的WebView视图,字符串URL){
                Log.d(HelloWebView,onPageFinished:+网址);
            }
            @覆盖
            公共布尔shouldOverrideUrlLoading(的WebView视图,字符串URL){
                Log.d(HelloWebView,shouldOverrideUrlLoading:+网址);
                返回super.shouldOverrideUrlLoading(查看,网址);
            }
            @覆盖
            公共无效onReceivedError(的WebView观点,诠释错误code,描述字符串,字符串failingUrl){
                Log.d(HelloWebView,onReceivedError:+描述);
                //view.loadData(\"Error+的描述,text / plain的,UTF-8);
                view.loadDataWithBaseURL(NULL,错误(+错误code +):+的描述,text / plain的,UTF-8,NULL);
            }
        });
        myWebView.setWebChromeClient(新WebChromeClient(){//(3)
            公共无效onProgressChanged(的WebView观点,诠释进度){
                activity.setProgress(进度* 100);
                   Log.d(HelloWebView,进步=+进度);
                   如果(进度== 100){
                       activity.setProgressBarVisibility(假);
                       activity.setTitle(职称);
                   }
            }
        });        myWebView.loadUrl(http://yahoo.com);
        。myWebView.getSettings()setSupportZoom(真);
        。myWebView.getSettings()setLoadWithOverviewMode(真);
        。myWebView.getSettings()setUseWideViewPort(真);


解决方案

的Eclipse试图自动解析进口时,有时会打嗝。在这样的情况下,可以尝试手动输入自己的import语句:进口android.graphics.Bitmap;

I get this error. How can I fix this in my situation?

"Bitmap cannot be resolved to a type"

The line where error occurs

public void onPageStarted(WebView view, String url, Bitmap favicon) {

My code

public class MainActivity extends Activity {
    private Activity activity = this;
    private String title = "";

    private ActionBar mActionBar;


    private SimpleSideDrawer mNav;
    WebView myWebView;

    int width, height;
    float flick_width; 
    float flick_height;     

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

          title = activity.getTitle().toString(); // (1)
          requestWindowFeature(Window.FEATURE_PROGRESS);  

        setContentView(R.layout.activity_main);



        getSize();

        mActionBar = getActionBar();
        mActionBar.hide();


        mNav = new SimpleSideDrawer(this);
        mNav.setLeftBehindContentView(R.layout.activity_behind_left_simple, this);
        mNav.setRightBehindContentView(R.layout.activity_behind_right_simple, this);


        myWebView = (WebView)findViewById(R.id.webView1);
        myWebView.setWebViewClient(new WebViewClient());
        myWebView.getSettings().setJavaScriptEnabled(true);

        myWebView.setWebViewClient(new WebViewClient() {
            @Override
            public void onPageStarted(WebView view, String url, Bitmap favicon) {
                Log.d("HelloWebView", "onPageStarted : " + url);
                activity.setTitle("Loading..."); // (2)
                activity.setProgressBarVisibility(true);
            }
            @Override
            public void onPageFinished(WebView view, String url) {
                Log.d("HelloWebView", "onPageFinished : " + url);
            }
            @Override
            public boolean shouldOverrideUrlLoading(WebView view, String url) {
                Log.d("HelloWebView", "shouldOverrideUrlLoading : " + url);
                return super.shouldOverrideUrlLoading(view, url);
            }
            @Override
            public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
                Log.d("HelloWebView", "onReceivedError : "+description);
                //view.loadData("Error   "+description, "text/plain", "utf-8");
                view.loadDataWithBaseURL(null, "Error ("+errorCode+"):"+description, "text/plain", "utf-8", null);
            }
        });
        myWebView.setWebChromeClient(new WebChromeClient() { // (3)
            public void onProgressChanged(WebView view, int progress) {
                activity.setProgress(progress * 100);
                   Log.d("HelloWebView", "progress="+progress);
                   if (progress==100) {
                       activity.setProgressBarVisibility(false);
                       activity.setTitle(title);
                   }
            }
        });

        myWebView.loadUrl("http://yahoo.com");          
        myWebView.getSettings().setSupportZoom(true); 
        myWebView.getSettings().setLoadWithOverviewMode(true);
        myWebView.getSettings().setUseWideViewPort(true); 

解决方案

Eclipse sometimes hiccups when trying to auto-resolve imports. In cases like that, you can try manually entering the import statement yourself: import android.graphics.Bitmap;

这篇关于为什么它说"位图不能被解析为一个类型"在这种情况下?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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