In this blog you will learn that by using Android Studio how to​​ create an Android app that displays your picture with labels below that contain​​ your name, location, and major.​​ For best results, use a PNG image.

Download Android Studio from the link given blow according to your operating system Windows, Mac, Linux, Chrome OS etc.

Link:​​ https://developer.android.com/studio

More downloads are available here.​​ 

Link:​​ https://developer.android.com/studio/archive

 

Code:

MainActivity.java

...................................

package com.example.showimage;

import android.app.Activity;

import android.os.Bundle;

import android.view.Menu;

import android.widget.ImageView;

public class MainActivity extends Activity {

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

ImageView image = (ImageView) findViewById(R.id.imageView1);

image.setMinimumHeight(500);

image.setMinimumWidth(500);

image.setImageResource(R.drawable.mypic);

}

@Override

public boolean onCreateOptionsMenu(Menu menu) {

//​​ Inflate the menu; this adds items to the action bar if it is present.

getMenuInflater().inflate(R.menu.main, menu);

return true;

}

}

activity_main.xml

.........................................

Please change the bold lines by your name, location, major

.........................................

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:orientation ="vertical"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >

<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/mypic" />

<TextView
android:id="@+id/textView1"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="
My name here"
android:textAppearance="?android:attr/textAppearanceLarge" />

<TextView
android:id="@+id/textView2"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="
My location here"
android:textAppearance="?android:attr/textAppearanceLarge" />

<TextView
android:id="@+id/textView3"

android:layout_width="wrap_content"

android:layout_height="wrap_content"

android:text="
My major here"
android:textAppearance="?android:attr/textAppearanceLarge" />

</LinearLayout>

Put your image in​​ (res)​​ folder like below:

sgAAwyh7AADonf8fCYOGPT2xlRoAAAAASUVORK5CYII= - Build Text & Image App in Android Studio

 

Output:

n+3DPddDOWOzAAAAABJRU5ErkJggg== - Build Text & Image App in Android Studio