| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Creating your first Android Java Application

Page history last edited by Will 13 years, 4 months ago

This tutorial assumes that you have the Android Hardware Development Environment ( http://www.liquidware.com/shop/show/BB-AND-HDE/Android+Hardware+Development+Environment ) installed.

 

Create an Android project

 

1. Open up Eclipse and select File > New > Project

2. Select Android Project and click Next

 

 

 

3. In this window you can enter what you want or the following:

Project name: Hello World

Contents: Select "Create new project in workspace"

Build Target: Select "Android 2.1-update1"

Application name: HelloWorld

Package name: com.liquidware.helloworld

Create Activity: .HelloActivity

 

 

Write your Application

 

1. Find and open HelloActivity.java and replace the code with:

package com.liquidware.helloworld;

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

public class HelloActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
 public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    TextView tv = new TextView(this);
    tv.setText("Hello, Android!");
    setContentView(tv);
    }
}

 

 

2. Find and open main.xml and replace the code with:

<?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>

 

 

Compile your Application

Make sure you have ADB set up (Installing apk packages over USB with adb) before trying to compile to your device.

 

1. Press the   button and the application should be loaded onto your device.

 

If everything goes right this is what you should see:

 

 

 

Comments (0)

You don't have permission to comment on this page.