Answer the question
In order to leave comments, you need to log in
How to add a channel from www.twitch.tv to the app?
In general, I decided to add to my application, twitch stream. Made by stackoverflow.com/questions/30313933/playing-twitc...
Here is my code.
<WebView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/webview1"
android:layout_marginBottom="137dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignRight="@+id/tableLayout"
android:layout_alignEnd="@+id/tableLayout"
JAVA
package com.example.kyky.papi4bingo;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.ImageButton;
public class list2 extends AppCompatActivity {
ImageButton button;
String url = "http://twitch.tv/dotamajorru/embed";
WebView mWebView;
boolean bIcon = true;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.list2);
mWebView = (WebView) findViewById(R.id.webview1);
button = (ImageButton) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
if (bIcon)
button.setImageResource(R.drawable.tiltedyes);
else button.setImageResource(R.drawable.tilted);
bIcon = !bIcon;
}
});
mWebView.setWebChromeClient(new WebChromeClient());
WebSettings webSettings = mWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setUseWideViewPort(true);
webSettings.setLoadWithOverviewMode(true);
mWebView.loadUrl(url);
}
}
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.kyky.papi4bingo" >
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme" >
<activity android:name=".MainActivity" android:screenOrientation="portrait">
<uses-permission android:name="android.permission.INTERNET" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".list2" android:screenOrientation="portrait">
</activity>
</application>
</manifest>
Answer the question
In order to leave comments, you need to log in
Passed out for application earned, but not as I wanted. My browser turns on and opens a link there. And I wanted to have a stream window in the application. Is it possible?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question