简体   繁体   中英

Inconvertible type cannot cast android.view.view to javafx.scene.web.webview

i want to show my post in webview but i fatch error of "Inconvertible type cannot cast android.view.view to javafx.scene.web.webview" in android studio. how can i solve it please help me.

WPPostDetails.java

package com.ejobbox.ejobbox;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.widget.TextView;

import javafx.scene.web.WebView;

public class WPPostDetails extends AppCompatActivity {
    TextView title;
    WebView webView;

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_postdetails);
        title=(TextView) findViewById(R.id.title);
        webView= (WebView) findViewById(R.id.postwebview);
        Intent i = getIntent();
        int position = i.getExtras().getInt("itemPosition");

        //title.setText(MainActivity.mListPost.get(position).getTitle().getRendered());
        Log.e("WpPostDetails","title is"+MainActivity.mListPost.get(position).getTitle().getRendered());

        webView.getSettings().setJavaScriptEnabled(true);

    }
}

在此处输入图片说明

You import a wrong WebView class. Remove import javafx.scene.web.WebView; and add import android.webkit.WebView

导入 android.webkit.WebView 而不是 javafx.scene.web.WebView;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM