Skip to content

Instantly share code, notes, and snippets.

@shamikalashawn
Created May 14, 2018 00:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shamikalashawn/868727aaf284837f28310cc76567946c to your computer and use it in GitHub Desktop.
Save shamikalashawn/868727aaf284837f28310cc76567946c to your computer and use it in GitHub Desktop.
Master Shoemaker Business Card App
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
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="com.shamikalashawn.mastershoemaker.MainActivity"
android:background="@drawable/smallshoe">
<TextView
android:id="@+id/address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/address"
android:textColor="@android:color/white"
android:layout_centerInParent="true"
android:layout_centerHorizontal="true"
android:textAlignment="center"
android:textStyle="bold"
android:textSize="40sp"
android:padding="16dp" />
<Button
android:id="@+id/map"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/map"
android:layout_centerHorizontal="true"
android:textSize="32sp"
android:layout_margin="16dp"
android:background="@drawable/redbutton"
android:textColor="@android:color/white"
android:textStyle="bold"
android:layout_below="@+id/address"
android:onClick="googleMapIt"/>
<Button
android:id="@+id/phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/phone"
android:background="@drawable/redbutton"
android:textColor="@android:color/white"
android:textStyle="bold"
android:layout_centerHorizontal="true"
android:textSize="40sp"
android:padding="8dp"
android:layout_below="@+id/map"
android:onClick="callIt"/>
</RelativeLayout>
package com.shamikalashawn.mastershoemaker;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void callIt (View view){
Intent callIntent = new Intent(Intent.ACTION_DIAL);
callIntent.setData(Uri.parse("tel:7184212421"));
startActivity(callIntent);
}
public void googleMapIt (View view){
Uri intentAddress = Uri.parse("geo:0,0?q=Master+Shoemaker, 1221 Foster+Ave, Brooklyn, NY, 11230");
Intent mapIntent = new Intent(Intent.ACTION_VIEW, intentAddress);
mapIntent.setPackage("com.google.android.apps.maps");
startActivity(mapIntent);
}
}
<resources>
<string name="app_name">Master Shoemaker</string>
<string name="map">Map</string>
<string name="address">1221 Foster Ave, Brooklyn, NY 11230</string>
<string name="phone">(718) 421-2421</string>
</resources>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment