Users Online

· Guests Online: 103

· Members Online: 0

· Total Members: 188
· Newest Member: meenachowdary055

Forum Threads

Newest Threads
No Threads created
Hottest Threads
No Threads created

Latest Articles

070 Java Android Program to Demonstrate a Full Screen Activity

Java Android Program to Demonstrate a Full Screen Activity

Here is source code of the Program to Demonstrate a Full Screen Activity in Andorid. The program is successfully compiled and run on a Windows system using Eclipse Ide. The program output is also shown below.

 

MainActivity.java

 
package com.example.fullscreen;
 
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
 
public class MainActivity extends Activity  {
 
    EditText distance, result;
    RadioGroup rg1;
    Button calculate;
    private double fare = 0;
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        //setting our activity to be full screen
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
        setContentView(R.layout.activity_main);
 
    }
}

Activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/farecard"
    android:orientation="vertical" >
 
    <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_marginBottom="16dp"
        android:background="@android:color/darker_gray"
        android:text="CALCULATE"
        android:textAlignment="center"
        android:textColor="@android:color/black" />
 
    <EditText
        android:id="@+id/auto_result"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/button1"
        android:layout_alignParentLeft="true"
        android:layout_marginBottom="26dp"
        android:ems="10" />
 
    <TextView
        android:id="@+id/textView2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/auto_result"
        android:layout_alignRight="@+id/textView1"
        android:text="Your Total Fare"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textSize="20dp" />
 
    <EditText
        android:id="@+id/auto_distance"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/textView2"
        android:layout_alignParentLeft="true"
        android:layout_marginBottom="18dp"
        android:ems="10" />
 
    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:text="Enter Distance"
        android:textAppearance="?android:attr/textAppearanceLarge" />
 
    <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/textView1"
        android:layout_alignLeft="@+id/textView2"
        android:layout_alignParentRight="true"
        android:layout_marginBottom="14dp"
        android:orientation="horizontal"
        android:paddingBottom="40px" >
 
        <RadioGroup
            android:id="@+id/auto_rg1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:weightSum="2" >
 
            <RadioButton
                android:id="@+id/auto_day"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentLeft="true"
                android:layout_alignParentTop="true"
                android:layout_marginTop="84dp"
                android:layout_weight="1"
                android:text="DAY" />
 
            <RadioButton
                android:id="@+id/auto_night"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="20dp"
                android:layout_marginRight="10dp"
                android:layout_marginTop="84dp"
                android:layout_weight="1"
                android:text="NIGHT" />
        </RadioGroup>
    </LinearLayout>
 
    <ImageButton
        android:id="@+id/auto_call"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/linearLayout1"
        android:layout_alignParentTop="true"
        android:layout_weight="1"
        android:src="@drawable/phone" />
 
    <ImageButton
        android:id="@+id/auto_arrow"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/auto_call"
        android:layout_alignParentRight="true"
        android:layout_alignParentTop="true"
        android:src="@drawable/arrow" />
 
</RelativeLayout>

Comments

No Comments have been Posted.

Post Comment

Please Login to Post a Comment.

Ratings

Rating is available to Members only.

Please login or register to vote.

No Ratings have been Posted.
Render time: 0.99 seconds
10,828,988 unique visits