我正试图在Webview中显示一个php网页(网络摄像头流),我想尝试制作一个Android应用程序(我是java和android的新手)。thats the xml and where i want the stream to be displayed
这是我从我从developers.google获得的信息制作的java代码,但它似乎无法正常工作
public class MainActivity extends AppCompatActivity {
ArrayAdapter<CharSequence> adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Spinner spinner = (Spinner) findViewById(R.id.roomSelector);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
R.array.available_Rooms, android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(adapter);
WebView myWebView = (WebView) findViewById(R.id.webvieww);
myWebView.setWebViewClient(new WebViewClient());
}
private class MyWebViewClient extends WebViewClient {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (Uri.parse(url).getHost().equals("http://www.google.com")) {
return false;
}
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
startActivity(intent);
return true;
}
}
}
有人可以帮助我将php流显示到WebView中,或者是否有其他方式来显示流(我不想使用套接字)。我想在上面的图片中显示webview内的网页