android – 为什么在这种情况下会说“Bitmap无法解析为某种类型”?

前端之家收集整理的这篇文章主要介绍了android – 为什么在这种情况下会说“Bitmap无法解析为某种类型”?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我收到这个错误.我怎么能在我的情况下解决这个问题?
"Bitmap cannot be resolved to a type"

发生错误的行

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

我的代码

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,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,"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,"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有时会出现问题.在这种情况下,您可以尝试自己手动输入import语句:import android.graphics.Bitmap;
原文链接:https://www.f2er.com/android/314346.html

猜你在找的Android相关文章