Skip to content

Instantly share code, notes, and snippets.

View pkavoo's full-sized avatar

Polycarp Kavoo pkavoo

  • Nairobi, Kenya
View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<ViewFlipper xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/flipper"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true">
@pkavoo
pkavoo / MainActivity.java
Last active May 9, 2019 08:59
Main Activity java file for math operations implementing addition and subtraction
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
//Declaration of components (editext & textview) and global variables (string and double)
EditText ed1, ed2;
String value1, value2;
@pkavoo
pkavoo / activity_main.xml
Last active May 9, 2019 08:58
Activity main xml file for the design of the math operations app
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:orientation="vertical">
<EditText
public void openMessage(View view)
{
if (VERSION.SDK_INT >= VERSION_CODES.KITKAT) //At least KitKat
{
String defaultSmsPackageName = Telephony.Sms.getDefaultSmsPackage(getApplicationContext()); //Need to change the build to API 19
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("text/plain");
sendIntent.putExtra(Intent.EXTRA_TEXT, smsText);
//open calendar method
public void openCalendar(View view)
{
Intent calendarIntent = new Intent() ;
calendarIntent.setClassName("com.android.calendar","com.android.calendar.AgendaActivity");
}
//openbrowser method
public void openBrowser(View view)
{
import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.provider.ContactsContract;
import android.provider.MediaStore;
import android.provider.Telephony;
import android.support.annotation.NonNull;
import android.support.annotation.RequiresApi;
<?php
define('DB_HOST', 'localhost');
define('DB_USER', 'root');
define('DB_PASS', '');
define('DB_NAME', 'heroes');
<?php
//Class DbConnect
class DbConnect
{
//Variable to store database link
private $con;
//Class constructor
<?php
class DbOperation
{
//Database connection link
private $con;
//Class constructor
function __construct()
{
<?php
//getting the dboperation class
require_once '../includes/DbOperation.php';
//function validating all the paramters are available
//we will pass the required parameters to this function
function isTheseParametersAvailable($params){
//assuming all parameters are available
$available = true;
$missingparams = "";