Skip to content

Instantly share code, notes, and snippets.

View croach's full-sized avatar

Christopher Roach croach

View GitHub Profile
package com.android.hello;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;
import android.widget.EditText;
import android.view.View;
import android.view.View.OnClickListener;
<?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">
<LinearLayout
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<EditText
package com.android.hello;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;
import android.widget.EditText;
import android.view.View;
import android.view.View.OnClickListener;
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
final EditText editText = new EditText(this);
editText.setWidth(240);
final TextView textView = new TextView(this);
Button button = new Button(this);
button.setText("Click Me");
button.setOnClickListener(new Button.OnClickListener() {
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
LinearLayout main = new LinearLayout(this);
main.setOrientation(LinearLayout.VERTICAL);
setContentView(main);
}
% ant install
activitycreator -o HelloAndroid com.android.hello.HelloAndroid
cd HelloAndroid
emulator &
# Make sure that you wait until you see the actual
# operating system (i.e., the main “desktop”) before
# you execute the next line, otherwise you’ll be
# stuck with some type of error stating that the
# install wasn’t successful.
ant install
% source ~/.bashrc
# Adding Google's Android SDK
export PATH=$PATH:/your/chosen/path/android-sdk-mac_x86-0.9_beta/tools
# Check for the .bashrc file and execute it if it exists
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi