M072 Ejemplos 003

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 1

Apartado 3.

“Hola Mundo” al detalle

 Código 1: ./src/es/masterd/holamundo/MainActivity.class: (página 12)


package es.masterd.holamundo;

import android.app.Activity;
import android.os.Bundle;

public class MainActivity extends Activity {


/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}

 Código 2: ./res/layout/main.xml: (página 13)


<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
</LinearLayout>

 Código 3: ./res/values/strings.xml: (página 13)


<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, MainActivity!
</string>
<string name="app_name">HolaMundo</string>
</resources>

 Código 4: ./AndroidManifest.xml: (página 13)


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="es.masterd.holamundo"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon"
android:label="@string/app_name">
<activity android:name=".MainActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

You might also like