BASICIDE V2.8 HELP CONTENTS

Device Functions


Activity Functions


Views and Events


View Functions


TextView Functions


EditText Functions


Check, Radio and Toggle Functions


Timer Functions


SeekBar Functions


ScrollView Functions


Spinner Functions


ListView Functions


ListView and Spinner Functions


TabHost Functions


Graphics Functions


Array Functions


User Interaction Functions


File Functions

DEVICE FUNCTIONS

Get the available width of the window.
Depending upon the device orientation this is not necessarily the same as the physical display width.
WindowWidth

Get the available height of the window.
Depending upon the device orientation this is not necessarily the same as the physical display height.
WindowHeight

Get the scaling value (density) for this device.
ScreenScale

Get the layout values for this device in a comma separated string "width,height,density",
GetLayoutValues

Contents

ACTIVITY FUNCTIONS

Returns true if this is the first time the initial code block program has been run.
This is the equivalent of FirstTime in Activity_Create.
GetFirstTime

Get a previously saved an array of persistent data that will survive activity destruction.
GetSavedData(dataarrayname As String)

Save an array of data that will survive activity destruction.
SetSavedData(dataarrayname As String)

Close the Activity and return to the editor
Call this at the end of the initial code block for a program that does not support events otherwise the
program will be left waiting for an event that won't come and the back button will be needed to close it.
A program that does support events can end by calling AppClose or this.
ActivityFinish

Set the Background property of the Activity to the GradientDrawable.
Returns false if less than two colors are in the array otherwise returns true.
Orientation can be one of the following -
"TOP_BOTTOM", "TR_BL" (Top-Right To Bottom-Left, "RIGHT_LEFT", "BR_TL" (Bottom-Right To Top-Left)
"BOTTOM_TOP", "BL_TR" (Bottom-Left To Top-Right), "LEFT_RIGHT", "TL_BR" (Top-Left To Bottom-Right)
SetActivityBackground(orientation As String, radius As String, colorsarrayname As String)

Logs the provided message to the Logcat output.
LogCat(message As String)

Closes the Activity menu. This is added for symmetry with OpenMenu but seems of little practical use.
CloseMenu

Opens the Activity menu
OpenMenu

Contents

VIEWS AND EVENTS

On Activity_Create the inital block of code up to the first Sub statement is run. GetFirstTime returns true the first time.
On Activity_Pause "Sub activity_pause(userclosed)" is called if implemented.
On Activity_Resume "Sub activity_resume" is called if implemented.
All MenuItem Click events are vectored to a single BasicLib sub "Sub menu_click(menutext)".
All Button Click events are vectored to a single BasicLib sub "Sub button_click(sender)".
All Checkbox CheckedChange events are vectored to a single BasicLib sub "Sub check_change(sender, checked)".
All EditText TextChanged events are vectored to a single BasicLib sub "Sub edit_change(sender, oldtext, newtext)".
All EditText EnterPressed events are vectored to a single BasicLib sub "Sub edit_enterpressed(sender)".
All ListView ItemClick events are vectored to a single BasicLib sub "Sub listview_itemclick(sender, position, value)".
All RadioButton CheckedChange events are vectored to a single BasicLib sub "Sub radio_change(sender, checked)".
All SeekBar ValueChanged events are vectored to a single BasicLib sub "Sub seekbar_valuechanged(sender, value, userchanged)".
All Spinner ItemClick events are vectored to a single BasicLib sub "Sub spinner_itemclick(sender, position, value)".
All TabHost TabChanged events are vectored to a single BasicLib sub "Sub tabhost_tabchanged(sender)".
All ToggleButton CheckedChange events are vectored to a single BasicLib sub "Sub toggle_change(sender, checked)".
Sender will be set to the name of view that caused the event.
If a view raising events is added then the appropriate event Sub or Subs must be present in the program.

Here are all the event Sub templates to copy and paste if desired.

Sub activity_pause(userclosed)
End Sub

Sub activity_resume
End Sub

Sub button_click(who)
End Sub

Sub check_change(who, checked)
End Sub

Sub edit_change(who, old, new)
End Sub

Sub edit_enterpressed(who)
End Sub

Sub listview_itemclick(who, pos, value)
End Sub

Sub menu_click(menutext)
End Sub

Sub radio_change(who, checked)
End Sub

Sub seekbar_valuechanged(who, pos, value)
End Sub

Sub spinner_itemclick(who, pos, value)
End Sub

Sub tabhost_tabchanged(who)
End Sub

Sub toggle_change(who, checked)
End Sub

Completely remove the named view from the program.
RemoveView(name As String)

Add a MenuItem to the Activity.
The maximum of six menu itemsthat was present in previous versions no longer applies
AddMenuItem(menutext As String)

Add a Button to the window or a panel.
AddButton(name As String, left As String, top As String, width As String, height As String, parent As String)

Add a ToggleButton to the window or a panel.
AddToggleButton(name As String, left As String, top As String, width As String, height As String, parent As String)

Add a CheckBox to the window.
AddCheckBox(name As String, left As String, top As String, width As String, height As String, parent As String)

Add an EditText to the window or a panel.
AddEditText(name As String, left As String, top As String, width As String, height As String, parent As String)

Add an ImageView to the window or a panel.
AddImage(name As String, left As String, top As String, width As String, height As String, parent As String)

Add a Label to the window or a panel.
AddLabel(name As String, left As String, top As String, width As String, height As String, parent As String)

Add a ListView to the window or a panel.
AddListView(name As String, left As String, top As String, width As String, height As String, parent As String)

Add a Panel to the window or a panel.
AddPanel(name As String, left As String, top As String, width As String, height As String, parent As String)

Add a RadioButton to the window or a panel.
AddRadioButton(name As String, left As String, top As String, width As String, height As String, parent As String)

Add a ScrollView to the window or a panel.
AddScrollView(name As String, left As String, top As String, width As String, height As String, parent As String)

Add a SeekBar to the window or a panel.
AddSeekBar(name As String, left As String, top As String, width As String, height As String, parent As String)

Add a Spinner to the window or a panel.
AddSpinner(name As String, left As String, top As String, width As String, height As String, parent As String)

Add a TabHost to the window or a panel.
AddTabHost(name As String, left As String, top As String, width As String, height As String, parent As String)

Contents

VIEW FUNCTIONS

Get the Enabled property of the named view.
GetEnabled(name As String)

Get the Visible property of the named view.
GetVisible(name As String)

Get the Top property of the named view.
GetTop(name As String)

Get the Left property of the named view.
GetLeft(name As String)

Get the Width property of the named view.
GetWidth(name As String)

Get the Height property of the named view.
GetHeight(name As String)

Set the Enabled property of the named view.
SetEnabled(name As String, state As String)

Set the Visible property of the named view.
SetVisible(name As String, visible As String)

Set the Top property of the named view.
SetTop(name As String, top As String)

Set the Left property of the named view.
SetLeft(name As String, left As String)

Set the Width property of the named view.
SetWidth(name As String, width As String)

Set the Height property of the named view.
SetHeight(name As String, height As String)

Bring the named view to the front of the Z order.
BringToFront(name As String)

Send the named view to the back of the Z order.
SendToBack(name As String)

Set the focus to the named view.
RequestFocus(name As String)

Set the BackgroundImage of the view to the present bitmap.
Return true if both view and bitmap are initialised otherwise return false.
SetBackgroundImage(name As String)

Set the Background property of the named view to a ColorDrawable.
SetColor(name As String, radius As String, color As String)

Set the Background property of the named view to a GradientDrawable.
Returns false if less than two colors are in the array or name not found otherwise returns true.
Orientation can be one of the following -
"TOP_BOTTOM", "TR_BL" (Top-Right To Bottom-Left, "RIGHT_LEFT", "BR_TL" (Bottom-Right To Top-Left)
"BOTTOM_TOP", "BL_TR" (Bottom-Left To Top-Right), "LEFT_RIGHT", "TL_BR" (Top-Left To Bottom-Right)
SetBackground(name As String, orientation As String, radius As String, colorsarrayname As String)

Invalidate the named view
Invalidate(name As String)

Contents

TEXTVIEW FUNCTIONS

Views containing text support these functions in addition to the View functions.

Set the Gravity property, if any, of the named view.
NO_GRAVITY = 0; TOP = 48 (0x30) ; BOTTOM = 80 (0x50; LEFT = 3; RIGHT = 5; CENTER = 17 (0x11);
CENTER_HORIZONTAL = 1; CENTER_VERTICAL = 16 (0x10) ; FILL = 119 (0x77);
SetGravity(name As String, gravityvalue As String)

Get the Text property, if any, of the named view.
GetText(name As String)

Set the Text property, if any, of the named view.
SetText(name As String, text As String)

Set the TextColor property, if any, of the named view.
SetTextColor(name As String, color As String)

Set the TextSize property, if any, of the named view.
SetTextSize(name As String, size As String)

There is one Typeface but it can be reinitialised as required.
Typeface - "Default", "Monospace", "Serif", "Sans_Serif"
Style - 0 Normal : 1 Bold : 2 Italic : 3 Bold_Italic
CreateTypeface(face As String, style As String)

Set the Typeface property, if any, of the named view to the current typeface.
SetTypeface(name As String)

Contents

EDITTEXT FUNCTIONS

EditText supports these functions in addition to the View and TextView functions.

Gets the selection start position (or the cursor position) of the EditText.
Returns -1 if there is no selection or cursor.
GetSelectionStart(name As String)

Force the EditText virtual keyboard action key to display Done by setting this value to True.
SetForceDoneButton(name As String, forcestate As String)

Set the text that will appear when the EditText is empty.
SetHint(name As String, hint As String)

Set the color of the text that will appear when the EditText is empty.
SetHintColor(name As String, hintcolor As String)

Set the value of the EditText InputType property.
NONE = 0; TEXT = 1; NUMBERS = 2; _PHONE = 3; DECIMAL_NUMBERS = 12290;
SetInputType(name As String, inputtype As String)

Set the value of the EditText PasswordMode property.
SetPasswordMode(name As String, state As String)

Sets the selection start position (or the cursor position) of the EditText.
SetSelectionStart(name As String, selectionstart As String)

Set the value of the EditText SingleLine property.
SetSingleLine(name As String, state As String)

Set the value of the EditText Wrap property.
SetWrap(name As String, state As String)

Contents

CHECKBOX, RADIOBUTTON AND TOGGLEBUTTON FUNCTIONS

Get the Checked state of a CheckBox, RadioButton or ToggleButton.
GetChecked(name As String)

Set the Checked state of a CheckBox, RadioButton or ToggleButton.
SetChecked(name As String, checked As String)

Set the TextOn property of a ToggleButton.
SetTextOn(name As String, text As String)

Set the TextOff property property of a ToggleButton.
SetTextOff(name As String, text As String)

Contents

TIMER FUNCTIONS

There is one time and the Timer Tick events are vectored to a BasicLib sub "Sub timer_tick".
If the Timer is enabled this event Sub must be present in the program.

Enable or disable the timer.
SetTimerEnabled(enabled As String)

Set the timer interval in milliseconds.
SetTimerInterval(interval As String)

Contents

SEEKBAR FUNCTIONS

Returns the current SeekBar Max value.
GetMax(seekbarname As String)

Returns the current SeekBar Value.
GetValue(seekbarname As String)

Sets the current SeekBar Max value.
SetMax(seekbarname As String, maxvalue As String)

Sets the current SeekBar Value.
SetValue(seekbarname As String, value As String)

Contents

SCROLLVIEW FUNCTIONS

Returns the current ScrollView ScrollPosition.
GetScrollPosition(scrollviewname As String)

Sets the current ScrollView ScrollPosition.
SetScrollPosition(scrollviewname As String, value As String)

Scrolls the ScrollView to the top or bottom.
FullScroll(scrollviewname As String, bottom As String)

Makes the ScrollView Panel accessible as a named Panel View.
GetPanel(scrollviewname As String, panelname As String)

Contents

SPINNER FUNCTIONS

Sets the title that will be displayed when the Spinner is opened.
SetPrompt(name As String, index As String)

Returns the index of the selected item of a Spinner. Returns -1 if no item is selected.
GetSelectedIndex(name As String)

Selects the item at the specified index of a Spinner. Pass -1 if no item is selected.
SetSelectedIndex(name As String, index As String)

Returns the the selected item of a Spinner. Returns "" if no item is selected.
GetSelectedItem(name As String)

Contents

LISTVIEW FUNCTIONS

Sets the background color that will be used while scrolling the ListView.
SetScrollColor(name As String, color As String)

Sets whether the fast scroll icon will appear when the user scrolls the list. The default Is False.
SetFastScrollEnabled(name As String, state As String)

Sets the ItemHeight of the SingleLineLayout in a ListView.
SetItemHeight(name As String, height As String)

Makes the ListView.SingleLineLayout.Label accessible as a Label view.
The layout functions of the ListView items may be changed using the label functions.
GetLabel(listviewname As String, labelname As String)

Set the ListView.SingleLineLayout.Background property of the ListView to a ColorDrawable.
SetLayoutBackgroundColor(name As String, radius As String, color As String)

Set the ListView.SingleLineLayout.Background property of the ListView to a GradientDrawable.
Returns false if less than two colors are in the array or name not found otherwise returns true.
Orientation can be one of the following -
"TOP_BOTTOM", "TR_BL" (Top-Right To Bottom-Left, "RIGHT_LEFT", "BR_TL" (Bottom-Right To Top-Left)
"BOTTOM_TOP", "BL_TR" (Bottom-Left To Top-Right), "LEFT_RIGHT", "TL_BR" (Top-Left To Bottom-Right)
SetLayoutBackgroundColorgradient(name As String, orientation As String, radius As String, colorsarrayname As String)

Contents

LISTVIEW AND SPINNER FUNCTIONS

Add an item To a ListView or Spinner.
Add(name As String, item As String)

Add an array of items to a ListView or Spinner.
AddAll(name As String, itemarrayname As String)

Clears the items from a ListView or Spinner.
Clear(name As String)

Returns the item at the specified index from a ListView or Spinner.
GetItem(name As String, index As String)

Removes the item at the specified index from a ListView or Spinner.
RemoveAt(name As String, index As String)

Returns the number of items in a ListView or Spinner.
GetSize(name As String, index As String)

Contents

TABHOST

Add a Tab and a new associated Panel to a TabHost.
The panelname may be used to add views To the Tab.
AddTab(title As String, panelname As String, parenttabhost As String)

Returns the number of tab pages.
GetTabCount(tabhostname As String)

Returns the index of the current tab page.
GetCurrentTab(tabhostname As String)

Selects the current tab page.
SetCurrentTab(tabhostname As String, tabnumber As String)

Contents

GRAPHICS FUNCTIONS

There is one bitmap but it can be reinitialised to a bitmap from a file.
BitmapInit(dir As String, fileName As String)

The one bitmap can also be reinitialised to a mutable bitmap.
BitmapInitMutable(width As String, height As String)

Get the width of the current bitmap.
BitmapWidth

Get the height of the current bitmap.
BitmapHeight

There is one canvas but it can be reinitialised on any View.
CanvasInit(imageviewname As String)

The one canvas can also be reinitialised on a mutable Bitmap if the sole Bitmap object is one.
CanvasInit2()

Draws the present bitmap
SrcRect - The subset of the Bitmap that will be drawn.
DestRect - The rectangle that the Bitmap will be drawn to.
Returns false if more or less than two points are in the rectangle arrays otherwise returns true.
DrawBitmap(srcrectarrayname As String, destrectarrayname As String)

Draws the present bitmap rotated.
SrcRect - The subset of the Bitmap that will be drawn.
DestRect - The rectangle that the Bitmap will be drawn to.
Returns false if more or less than two points are in the rectangle arrays otherwise returns true.
DrawBitmapRotated(srcrectarrayname As String, destrectarrayname As String, degrees As String)

Fills the entire canvas with the given color.
DrawColor(color As String)

Draws a circle.
DrawCircle(x As String, y As String, radius As String, color As String, filled As String, strokewidth As String)

Draws a line.
DrawLine(x1 As String, y1 As String, x2 As String, y2 As String, color As String, strokewidth As String)

Draws a set of connected lines from the points provided in a named array.
Returns false if less than two points are in the array otherwise returns true.
DrawPath(pointsarrayname As String, color As String, filled As String, strokewidth As String)

Sets a single pixel to the specified color.
DrawPoint(x As String, y As String, Color As String)

Draws a rectangle from the points provided in a named array.
Returns false if more or less than two points are in the array otherwise returns true.
DrawRect(rectarrayname As String, color As String, filled As String, strokewidth As String)

Draws a rotated rectangle from the points provided in a named array.
Returns false if more or less than two points are in the array otherwise returns true.
DrawRectRotated(rectarrayname As String, color As String, filled As String, strokewidth As String, degrees As String)

Draw text. Align is one of the following values: "LEFT", "CENTER", "RIGHT".
DrawText(text As String, x As String, y As String, textsize As String, color As String, align As String)

Draw text. Align is one of the following values: "LEFT", "CENTER", "RIGHT".
DrawTextRotated(text As String, x As String, y As String, textsize As String, color As String, align As String, degrees As String)

Contents

ARRAY FUNCTIONS

Fully or partially fills the specified array with the specified value.
FillArray(arrayname As String, start As String, len As String, value As String)

Sort the specified array into ascending order in the specified manner.
SORTCASESENSITIVE is 0, SORTCASEINSENSITIVE is 1, SORTNUMERIC = 2
Note that for use with BinarySearch SORTCASESENSITIVE should be used otherwise the result may not be accurate
SortArray(arrayname As String, sorttype As String)

Searches the specified array for the specified value using the binary search algorithm.
The array must be sorted into ascending order using SORTCASESENSITIVE otherwise the result may not be accurate
SearchArray(arrayname As String, value As String)

Contents

USER INTERACTION FUNCTIONS

Shows a Toast.
ShowToast(msg As String, longtime As String)

Get the user input from the latest InputBox, InputDate or InputTime modal dialog.
GetInput

Show a modal dialog box and prompt the user for data.
Returns a DialogResponse value with the input text available to GetInput.
InputBox(prompt As String, title As String, Positive As String, Cancel As String, Negative As String)

Show a modal dialog box and prompt the user for a date.
Returns a DialogResponse value with the input value avalable to GetInput as a ticks value.
InputDate(prompt As String, title As String, startdateticks As String, Positive As String, Cancel As String, Negative As String)

Show a modal dialog box and prompt the user for a path or file name.
Returns a DialogResponse value with the input values available to GetInput as a comma separated string.
The first part is the file path and the last part is file name. If the user selected a path the file name is an empty string.
InputFile(filepath As String, filename As String, filefilter As String, title As String, Positive As String, Cancel As String, Negative As String)

Show a modal dialog box and prompt the user for a time.
Returns a DialogResponse value with the input value available to GetInput as a ticks value.
InputTime(prompt As String, title As String, starttimeticks As String, as24hrs As String, Positive As String, Cancel As String, Negative As String)

Show a modal dialog box and prompt the user to select an item.
selecteditem is the index of the item that will first be selected or -1 if no item should be preselected.
Returns the index of the selected item or DialogResponse.Cancel if the user pressed on the back key.
InputListBox(itemarrayname As String, title As String, selecteditem As String )

Show a modal dialog box and prompt the user to select one or more items.
returns a comma separated list of indices selected that may be separated with StrSplit.
InputMultiListBox(itemarrayname As String, title As String)

Show a modal dialog box and prompt the user for an integer number.
If ShowSign is True the sign of the number corresponds to the sign entered by the user.
Returns a DialogResponse value with the input number available to GetInput.
If ShowSign is True the sign of the number corresponds to the sign entered by the user.
InputNumber(showsign As String, digits As String, number As String, title As String, Positive As String, Cancel As String, Negative As String)

Show a modal dialog box and prompt the user to make a selection.
Returns a DialogResponse
MessageBox(message As String, title As String, Positive As String, Cancel As String, Negative As String)

Show a non-modal progress dialog.
ProgressShow(text As String)

Hide a non-modal progress dialog.
ProgressHide

Allow the message loop to run, lets the progress dialog repaint itself.
CallDoEvents

Contents

FILE OPERATION FUNCTIONS

Reads the entire file and fills a named array with all lines as strings.
Returns true if successful, false otherwise.
FileReadList(dir As String, fileName As String, listarrayname As String)

Reads the entire file and returns it as a string.
Returns an empty string on failure.
FileReadString(dir As String, fileName As String)

Writes each item in the List As a single line.
Note that a value containing CRLF will be saved as two lines which will return two items when read with ReadList.
Returns true if successful, false otherwise.
FileWriteList(dir As String, filename As String, listarrayname As String)

Writes the given text to a new file.
Returns true if successful, false otherwise.
FileWriteString(dir As String, filename As String, text As String)

Deletes the specified file. If the file name is a directory then it must be empty in order to be deleted.
Returns true if the file was successfully deleted.
Files in the assets folder cannot be deleted.
Returns true if successful, false otherwise.
FileDelete(dir As String, filename As String)

Returns true if the specified FileName exists in the specified Dir.
Note that the Android file system is case sensitive.
FileExists(dir As String, filename As String)

Tests whether the specified file is a directory.
FileIsDirectory(dir As String, filename As String)

Creates the given folder (dir can be a path like "dir1/dir2", creates all folders as needed).
Returns true if successful, false otherwise.
FileMakeDir(parentdir As String, dir As String)

Fills an array with a list with all the files and directories which are stored in the specified path.
Returns true if successful, false otherwise.
FileListFiles(dir As String, filesarrayname As String)

Returns the root folder of the external storage media.
FileDirRootExternal

Returns the application default external folder which is based on the package name.
The folder is created if needed.
FileDirDefaultExternal

Returns a reference to the files added with the Files Manager. These files are read-only.
FileDirAssets

Contents