I want to create an address book application for my office. It will be having Phones numbers and addresses of all the office colleagues. What will be the best way to do it. It should be able to add, delete, modify, search and dial or should open message box to send SMS.
"The best way" is to use a SQLite db, but it is not the fastest way, if you need to use only those data.
To post an example... we should post the whole app!
You could use Flexible Class to show your data; then a "dialog" (a transparent panel that contains another panel with the view to enter data) that is displayed when select a row. Same for SMS, using this to send it.
LucaMs is right.
You want to do a CRUD application (Create, Read, Update, Delete) at record level.
The fastet way is to use a platform supporting already it.
SQLlite is this platform.
Not so difficult to manage.
On the documentation there is a dedicate chapter of few pages.
Did you have a look at chapter 3.3 SQLite Database example program in the User's Guide.
This example is almost doing what you want, the source code is included in the SourceCode folder shiped with the guide.
I tried adding one column 'email' in the persons database in you second example exactly like the other columns been done but I am getting an error.
Error occurred on line: 43 (edit)
Error occurred on line: 43 (edit)
java.lang.RuntimeException: Object should first be initialized (EditText).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:46)
at anywheresoftware.b4a.objects.TextViewWrapper.setText(TextViewWrapper.java:39)
at anywheresoftware.b4a.objects.EditTextWrapper.setText(EditTextWrapper.java:213)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:485)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:232)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:174)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:157)
at b4a.sqlitelight2.edit.afterFirstLayout(edit.java:104)
at b4a.sqlitelight2.edit.access$100(edit.java:16)
at b4a.sqlitelight2.edit$WaitForLayout.run(edit.java:76)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4898)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1006)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:773)
at dalvik.system.NativeStart.main(Native Method)
java.lang.RuntimeException: Object should first be initialized (EditText).
at anywheresoftware.b4a.AbsObjectWrapper.getObject(AbsObjectWrapper.java:46)
at anywheresoftware.b4a.objects.TextViewWrapper.setText(TextViewWrapper.java:39)
what could be the problem. thanks