This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BasicCalc - first java and simple logcat then build calculator | |
BasicLogcat - logcat and application lifecycle | |
BasicControls - buttons, toasts, changing text | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.main); | |
AdvancedCalculator ac = new AdvancedCalculator(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
append_path () { | |
input="$1" | |
value="$2" | |
if ! echo $input | /usr/bin/egrep -q "(^|:)$value($|:)" ; then | |
if [ "$3" = "after" ] ; then | |
echo $input:$value | |
else | |
echo $value:$input |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.bytefly.handlersample; | |
import android.os.Bundle; | |
import android.os.Handler; | |
import android.os.Message; | |
import android.app.Activity; | |
import android.view.Menu; | |
import android.view.View; | |
import android.widget.Button; | |
import android.widget.EditText; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.bytefly.handlersample; | |
import android.os.Bundle; | |
import android.os.Handler; | |
import android.os.Message; | |
import android.app.Activity; | |
import android.view.Menu; | |
import android.view.View; | |
import android.widget.Button; | |
import android.widget.EditText; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.bytefly.handlersample; | |
import android.os.Bundle; | |
import android.os.Handler; | |
import android.os.Message; | |
import android.app.Activity; | |
import android.view.Menu; | |
import android.view.View; | |
import android.widget.Button; | |
import android.widget.EditText; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<GridView xmlns:android="http://schemas.android.com/apk/res/android" | |
android:id="@+id/gridView1" | |
android:numColumns="auto_fit" | |
android:gravity="center" | |
android:columnWidth="100dp" | |
android:stretchMode="columnWidth" | |
android:layout_width="fill_parent" | |
android:layout_height="fill_parent" > |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
---------------DBController.java--------------- | |
package com.bytefly.zooexample; | |
import java.util.ArrayList; | |
import android.content.ContentValues; | |
import android.content.Context; | |
import android.database.Cursor; | |
import android.database.sqlite.SQLiteDatabase; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
activity_edit_animal.xml | |
------------------------ | |
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:background="#CCCCCC" | |
android:orientation="vertical" | |
android:paddingTop="1dp" > |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Button button= (Button) findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View v) { | |
// do something | |
Log.d(TAG, "onClick was called"); | |
Intent intent = new Intent(v.getContext(), MyActivity2.class); | |
startActivity(intent); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Button button= (Button) findViewById(R.id.countButton); button.setOnClickListener(new View.OnClickListener() { | |
@Override | |
public void onClick(View v) { | |
// do something | |
Log.d(TAG, "onClick was called"); | |
counter++; | |
TextView countview = (TextView) findViewById(R.id.countView); | |
countview.setText(""+counter); | |
} |
OlderNewer