Skip to main content

Posts

Showing posts from July, 2016

Camera Application using startActivityForResult Example

Screenshots :




activity_main.xml :
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.chantisandroid.exampleapp.MainActivity">
    <Button         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="CAMERA"         android:id="@+id/button"         android:layout_alignParentTop="true"         android:layout_centerHorizontal="true"         android:layout_marginTop="44dp" />
    <ImageView         android:layout_width="match_parent"         android:layout_height="match_parent"         android:id="@+id/imageView"         android:layout_below="@+id/bu…

Android Activity Life Cycle

Does not crash if the user receives a phone call or switches to another app while using your app.Does not consume valuable system resources when the user is not actively using it.Does not lose the user's progress if they leave your app and return to it at a later time.Does not crash or lose the user's progress when the screen rotates between landscape and portrait orientation.
Every knows about create the activity and start the activity ResumedIn this state, the activity is in the foreground and the user can interact with it. (Also sometimes referred to as the "running" state.)PausedIn this state, the activity is partially obscured by another activity—the other activity that's in the foreground is semi-transparent or doesn't cover the entire screen. The paused activity does not receive user input and cannot execute any code.StoppedIn this state, the activity is completely hidden and not visible to the user; it is considered to be in the background. While stoppe…

Passing data between Activities using Bundle in Android Example

Screenshots :








activity_main.xml :
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.chantisandroid.exampleapp.MainActivity">
    <EditText         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:id="@+id/editText"         android:layout_alignParentTop="true"         android:layout_centerHorizontal="true"         android:layout_marginTop="46dp"         android:layout_marginLeft="5dp"         android:layout_marginRight="5dp"         android:hint="Plz enter name" />
    <Button         android:layout_width="wrap_content"         android:layout_height=&qu…

Passing Data between Activities using Intent Example

Screenshots :





activity_main.xml :
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.chantisandroid.exampleapp.MainActivity">
    <EditText         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:id="@+id/editText"         android:layout_alignParentTop="true"         android:layout_centerHorizontal="true"         android:layout_marginTop="46dp"         android:layout_marginLeft="5dp"         android:layout_marginRight="5dp" />
    <Button         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="…

Android Intent Example

Screenshots :





activity_main.xml :

<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.chantisandroid.exampleapp.MainActivity">
    <Button         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="Implicit intent"         android:id="@+id/button"         android:layout_alignParentTop="true"         android:layout_centerHorizontal="true"         android:layout_marginTop="82dp" />
    <Button         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="explicit intent"         android:id="@+id/butt…