Archive

Archive for the ‘Android Programming’ Category

How to make an activity call itself in Android

March 6, 2012 Comments off

Here is an example of how to make an activity in Android call itself via using an Intent object.

Here is the code for the main.xml layout:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<Button android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Load Instances"
android:layout_centerHorizontal="true" />

<LinearLayout android:id="@+id/textlayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_centerInParent="true" >

<TextView
android:id="@+id/textview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="MainActivity has not called itself yet."
android:layout_gravity="center" />

</LinearLayou Read more...