Design custom browser Android App to access application like YouTube, Radio, News Channel

This page shows the steps to create a custom Web View App. A kind of custom web Browser App. This can be used to create a kind of shortcut for any web based application like YouTube, online Radios and new channels in your smartphone.

The source code:

MainActivity.java

package com.example.mycustomapplication;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.webkit.WebView;

public class MainActivity extends AppCompatActivity {

private WebView myPrivateWebView;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

myPrivateWebView = findViewById(R.id.myWebView);
myPrivateWebView.loadUrl(“http://www.youtube.com”);

}
}

AndroidManifest.xml

<?xml version=”1.0″ encoding=”utf-8″?>
<manifest xmlns:android=”http://schemas.android.com/apk/res/android&#8221;
package=”com.example.mycustomapplication”>

<uses-permission android:name=”android.permission.INTERNET”/>

<application
android:allowBackup=”true”
android:icon=”@mipmap/ic_launcher”
android:label=”@string/app_name”
android:roundIcon=”@mipmap/ic_launcher_round”
android:supportsRtl=”true”
android:theme=”@style/AppTheme”
android:usesCleartextTraffic=”true”>
<activity android:name=”.MainActivity”>
<intent-filter>
<action android:name=”android.intent.action.MAIN” />

<category android:name=”android.intent.category.LAUNCHER” />
</intent-filter>
</activity>
</application>

</manifest>

build.gradle

apply plugin: ‘com.android.application’

android {
compileSdkVersion 28
defaultConfig {
applicationId “com.example.mycustomapplication”
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName “1.0”
testInstrumentationRunner “android.support.test.runner.AndroidJUnitRunner”
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile(‘proguard-android-optimize.txt’), ‘proguard-rules.pro’
}
}
}

dependencies {
implementation fileTree(dir: ‘libs’, include: [‘*.jar’])
implementation ‘com.android.support:appcompat-v7:28.0.0’
implementation ‘com.android.support.constraint:constraint-layout:1.1.3’
testImplementation ‘junit:junit:4.12’
androidTestImplementation ‘com.android.support.test:runner:1.0.2’
androidTestImplementation ‘com.android.support.test.espresso:espresso-core:3.0.2’
}

Please post your comments or queries.

Leave a Reply

%d bloggers like this: