Skip to main content

Posts

Showing posts from July, 2017

Google Maps example in Android

activity_maps.xml
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:map="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/map"
    android:name="com.google.android.gms.maps.SupportMapFragment"
    android:layout_width="match_parent"
    android:layout_height="match_parent"

    tools:context="com.chantisandroid.mapsexample.MapsActivity" />


* Under values folder create google_maps_api.xml file

google_maps_api.xml
<resources>

    <string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">YOUR_KEY_HERE</string>

</resources>

* To get your google maps api key from 
https://console.developers.google.com/  and paste it above YOUR_KEY_HERE

build.gradle:
apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    build…

Bottom Navigation Bar example in android

activity_main.xml:
<?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:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="com.chantisandroid.bottomnavigationview.MainActivity">

    <FrameLayout
        android:id="@+id/content"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1">

        <TextView
            android:id="@+id/message"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="@d…