Android

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

Name of the Experiment- Receive data from the user by Edit Text and pass the data to another

activity using intent.

Coding Phase: Pseudo code/ Flow Chart / Algorithm


Intent: It is devided in to 2 types i.e Implicit intent and another is Explicit intent.
1.Implicit Intent:-

Testing Phase: Compilation of Code(error detection)


Implementation Phase : Final Output (no error)
Activity_main.xml file-
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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=".MainActivity">
<ImageView
android:id="@+id/imageView"
android:layout_width="403dp"
android:layout_height="724dp"
app:srcCompat="@drawable/img"
tools:layout_editor_absoluteX="2dp"
tools:layout_editor_absoluteY="-2dp"
tools:ignore="MissingConstraints" />
<Button
android:id="@+id/button"
android:layout_width="193dp"
android:layout_height="76dp"
android:layout_centerHorizontal="true"
android:onClick="clk"
android:text="CLICK"
android:textSize="24sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.865"
tools:ignore="MissingConstraints" />
</androidx.constraintlayout.widget.ConstraintLayout>

mainActivity.java-
package com.example.implicitintent;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void clk(View v) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
startActivity(intent);
}
}
2.Explicit intent:-
Coding Phase: Pseudo code/ Flow Chart / Algorithm

Implementation Phase : Final Output (no error)


Activity_main.xml file-1
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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=".MainActivity">
<ImageView
android:id="@+id/imageView"
android:layout_width="434dp"
android:layout_height="740dp"
app:srcCompat="@drawable/img"
tools:layout_editor_absoluteX="-13dp"
tools:layout_editor_absoluteY="-5dp" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Whatever happened was good.
What’s happening is going well.
Whatever will happen will also be good.
Do not worry about the future.
Live in the present.
Jay Shree Krishna"
android:textColor="@color/white"
android:textSize="40sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1.0"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.484" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:linksClickable="false"
android:text="Click"
android:textColorLink="#FFFFFF"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView"
app:layout_constraintVertical_bias="0.974" />
</androidx.constraintlayout.widget.ConstraintLayout>

Activity_main.xml file-2
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.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=".Second">
<ImageView
android:id="@+id/imageView2"
android:layout_width="612dp"
android:layout_height="860dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.361"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.0"
app:srcCompat="@drawable/img_1" />
<TextView
android:id="@+id/textView2"
android:layout_width="313dp"
android:layout_height="73dp"
android:text="Thanku Krishna"
android:textColor="#F4F4F4"
android:textColorLink="#FFFFFF"
android:textSize="40sp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.591"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.957" />
</androidx.constraintlayout.widget.ConstraintLayout>

mainActivity.java-1
package com.example.explicittext;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MainActivity<find> extends AppCompatActivity {
private Button button;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
onClickButtonListener();
}
public void onClickButtonListener()
{
button=(Button)findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent=new Intent(MainActivity.this,MainActivity2.class);
startActivity(intent);}
});
}
}

mainActivity.java-2
package com.example.explicittext;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
public class MainActivity2 extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main2);
}
}
Output

CONCLIUSION:-

successfully completed the Receive data from the user by Edit Text and pass the data to another activity
using intent.

ASSESSMENT
Rubrics Full Mark Marks Obtained Remarks
Concepts 10
Planning and Execution/ 10
Practical Simulation/Programming
Result and Interpretation 10
Record of Applied and Action Learning 10
Viva 10
Total 50

Signature of the Student:


Signature of Faculty Name:
Regn. No. :
Page No…..

You might also like