Skip to main content

1. activity_main.xml

Inside the activity_main.xml.

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
android:background="#182b5c">

<WebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/webView"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
tools:layout_editor_absoluteX="146dp"
tools:layout_editor_absoluteY="207dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
SplashScreen.Java
package com.example.kcau;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;

public class SplashScreen extends AppCompatActivity {
private int SLEEP_TIMER = 4;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

setContentView(R.layout.activity_splash_screen);
getSupportActionBar().hide();
LogoLauncher logolauncher = new LogoLauncher();
logolauncher.start();
}
private class LogoLauncher extends Thread{
public void run(){
try{
sleep(1000 *SLEEP_TIMER);
}catch (InterruptedException e){
e.printStackTrace();
}
Intent intent = new Intent(SplashScreen.this, MainActivity.class );
startActivity(intent);
SplashScreen.this.finish();
}
}
}
activity_splash_screen.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".SplashScreen"
android:background="#182b5c">

<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/kca_logo" />

<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Developed by: Samuel Kioko, IT Club Town Campus"
android:textAlignment="center"
android:textColor="#ffffff"
android:textSize="16dp"
android:textStyle="italic"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.979" />

<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:gravity="center"
android:text="KCA UNIVERSITY"
android:textAlignment="center"
android:textColor="#FFD700"
android:textSize="40dp"
android:textStyle="bold"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="Advancing Knowledge, Driving Change"
android:textColor="#FFD700"
android:textSize="20dp"

app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/textView3"
app:layout_constraintVertical_bias="0.119" />

</androidx.constraintlayout.widget.ConstraintLayout>

colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="dark_blue">#182b5c</color>
<color name="gold">#FFD700</color>
</resources>
Androidmanifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.kcau">

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

<application
android:allowBackup="true"
android:icon="@drawable/kca_logo"
android:label="KCA UNIVERSITY"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.KCAU">
<activity android:name=".SplashScreen">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MainActivity">

</activity>
</application>

</manifest>


main_activity.java
package com.example.kcau;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.webkit.DownloadListener;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class MainActivity extends AppCompatActivity {
private WebView myWebView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
myWebView=(WebView)findViewById(R.id.webView);
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
myWebView.loadUrl("https://www.kca.ac.ke/");
myWebView.setWebViewClient(new WebViewClient());

myWebView.setDownloadListener(new DownloadListener() {
public void onDownloadStart(String url, String userAgent,
String contentDisposition, String mimetype,
long contentLength) {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
}
});
}

@Override
public void onBackPressed() {
if(myWebView.canGoBack()){
myWebView.goBack();
}else {
super.onBackPressed();
}
}
}

Comments

Popular posts from this blog

ACTIVATING MS OFFICE WITHOUT KEY

Step1 Open cmd as admin Step2 copy office directory Step3  Go to office directory, type cd on cmd then paste the office directory you copied e.g., for a 64-bit machine it will look like this. cd C:\Program Files (x86)\Microsoft Office\Office16 Step4 Type in the following commands into cmd then hit enter after every command: cscript ospp.vbs /inpkey:XQNVK-8JYDB-WJ9W3-YJ8YR-WFG99 cscript ospp.vbs /unpkey:BTDRB >nul cscript ospp.vbs /unpkey:KHGM9 >nul cscript ospp.vbs /unpkey:CPQVG >nul cscript ospp.vbs /sethst:kms8.msguides.com cscript ospp.vbs /setprt:1688 cscript ospp.vbs /act METHOD 2 Copy script https://gist.github.com/amitbd1508/fe64e926005c85d424e8e79a943b3b60 @echo off title Activate Microsoft Office 2019 (ALL versions) for FREE - MSGuides.com&cls&echo =====================================================================================&echo #Project: Activating Microsoft software products for FREE without additional software&echo =====================...
 HOW TO USE MESSAGE BOX TO DISPLAY OUTPUT FROM A SELECTION CASE IN VB Public Class Form1     Dim mark As Double     Private Sub txtTest_TextChanged(sender As Object, e As EventArgs) Handles txtTest.TextChanged     End Sub     Private Sub btnok_Click(sender As Object, e As EventArgs) Handles btnok.Click         mark = Double.Parse(txtTest.Text)         Select Case (mark)             Case 0 To 49                 MsgBox("Fail!", MsgBoxStyle.Information, "COMMENT")             Case 50 To 64                 MsgBox("Pass", MsgBoxStyle.Information, "COMMENT")             Case 65 To 74                 MsgBox("Credit", MsgBoxStyle.Information, "COMMENT")             Case 75 To...