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.widget.LinearLayout;
import android.view.View;
import android.view.View.OnClickListener;
cd /directory/where/you/downloaded/the/SDK
unzip android-sdk-platform-version_beta.zip
mv android-sdk-platform-version_beta.zip /your/chosen/path
# Check for the .bashrc file and execute it if it exists
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
# Adding Google's Android SDK
export PATH=$PATH:/your/chosen/path/android-sdk-mac_x86-0.9_beta/tools
% source ~/.bashrc
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
% ant install
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
LinearLayout main = new LinearLayout(this);
main.setOrientation(LinearLayout.VERTICAL);
setContentView(main);
}
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() {
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;