articles

Text View in android

Nitish Kesarwani 2268 14-Dec-2017
Activity

Activity is an interface program which establishes the coordination with the programme when user click, touch scroll etc.It is like AWT or Swing program in java.It is the main class in Java, C++, C, and subclass of ContextThemeWrapper Class.

Services

Services are the operation that is running in the background without the user permission even it is executed when the application is destroyed.

Broadcast

It performs communication with another application or System which are broadcasted message occur on Android.

Content Provider

content provider component supplies the data from an application according to the request. This request is handled by ContentResolver class.

    <?xml version="1.0" encoding="utf-8"?>

<android.support.constraint.ConstraintLayout 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.mapsample.msclient009.apps.MainActivity">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:text="Hello Robot "
            android:textAlignment="center"
            android:textColor="#F1AD33"
            android:textSize="30dp"/>
    </LinearLayout>

</android.support.constraint.ConstraintLayout>

It is layout file in which all component is added such as Button, TextView, TextBox etc.it is residing under res>>Layout directories(folder).

MainActivity.java
package com.mapsample.msclient009.apps;


import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

 public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
     super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
    }
}

it is java in which layout added in ActivityMain.xml file can be viewed through findviewById(R.id.Id_name) declared in layout.

AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.mapsample.msclient009.apps">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

This file contains a component which you want to add should be declared such as Services, Activity, Broadcast, Intent.It resides inside Manifest directory.

                               Text View in android




Updated 07-Sep-2019

Leave Comment

Comments

Liked By