Panduan Praktis Pembuatan Aplikasi Android/Kode Program

Dari Wikibuku bahasa Indonesia, sumber buku teks bebas
  • Perbandingan kode program Android dan Gambas:
Kode Program Android Kode Program Gambas
//Komentar 'Komentar
//Nama variabel boolean tidak bisa digunakan

private Boolean b;

'Nama variabel boolean bisa digunakan

Private b As Boolean

[private] Integer integer1, integer2; Private integer1, integer2 As Integer
[private] String string [= ""]; Private string As String [= ""]
String sKueri [= ""]; Dim sKueri As String [= ""]
SQLiteDatabase db; Dim connection As Connection
Cursor cursor; Dim result As Result
cursor = db.rawQuery(sKueri, null); result = connection.Exec(sKueri)
string = cursor.getString(integer); string = result[integer]
integer = cursor.getCount(); integer = result.Count
cursor.moveToFirst(); result.MoveFirst
cursor.moveToNext(); result.MoveNext
db.close(); connection.Close
setTitle(CharSequence title); FMain.Text = string
null Null
if (string == null) kode_program; If string = Null Then kode_program
if (string != null) kode_program; If string <> null Then kode_program
else Else
! Not
for (integer = integer1; i <= integer2; i++) {

}

For integer = integer1 To integer2 Step 1

Next

for (String string: array) {

}

For Each string In array

Next

while (boolean) {

}

While boolean

Wend

do {

} while (boolean);

Repeat

Until boolean

boolean = sFolder.exists(); boolean = Exist(sFolder)
boolean = (boolean || boolean); boolean = (boolean Or boolean)
boolean = (boolean && boolean); boolean = (boolean And boolean)
switch (integer) {
  case 0:
    //Kode program
    break;
  case 1:
    //Kode program
}
Select Case integer
  Case 0
    'Kode program
  Case 1
    'Kode program
End Select

try Try
Toast.makeText(this, sPesan, Toast.LENGTH_SHORT).show(); Message.Info(sPesan)
this Me
widget.requestFocus(); kontrol.SetFocus
string = widget.getText().toString(); string = kontrol.Text
widget.setText(string); kontrol.Text = string
widget.append(string); kontrol.Text &= string
boolean = Boolean.valueOf(var); boolean = Val(var)
integer = Integer.valueOf(string); integer = Val(string)
string = String.valueOf(integer); string = Str(integer)
integer++; integer += 1
integer--; integer -= 1
startActivity(new Intent(string)); Shell(string)
string = string.replace(string1, string2); string = Replace(string, string1, string2)
integer = string.length(); integer = string.len
string = string.substring(startIndex, endIndex); string = Mid(string, startIndex, intLength)
string = string1 + string2; string = string1 & string2
imageView.setScaleType(ImageView.ScaleType.FIT_XY); PictureBox1.Stretch = True
return; Return
finish(); Quit