Solution: Create Contact

netchicken

Active Member
Licensed User
Longtime User
I am in the same boat, I can't create an entry as I am getting the same error

java.lang.RuntimeException: Object should first be initialized (Map).

Are there any other libraries that might do this as well?
 

Stulish

Active Member
Licensed User
Longtime User
Hi all i just tried to implement the library v1.07 and keep getting the following error:

java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer


at lilivel.b4a.miscUtil.miscUtil.createContactEntry2(miscUtil.java:79)
at lishsoft.android.saynoto0870.main._msg_click(main.java:1182)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:834)
at anywheresoftware.b4a.keywords.Common.CallSubNew3(Common.java:799)
at lishsoft.android.saynoto0870.clschecklist._pnlsv_click(clschecklist.java:1811)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:169)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:153)
at anywheresoftware.b4a.agraham.reflection.Reflection$2.onClick(Reflection.java:985)
at android.view.View.performClick(View.java:4211)
at android.view.View$PerformClick.run(View.java:17267)
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.ClassCastException: java.lang.String cannot be cast to java.lang.Integer

the code is:

B4X:
Dim mu As miscUtil
Dim phones As Map, c As Contact
Dim addrH,addrW,mails As Map
phones.Initialize
mu.Initialize
addrH.Initialize
addrH.Put(0,"")
addrH.Put(1,"")
addrH.Put(2,"")
addrH.Put(3,"")
addrW.Initialize
addrW.Put(0,"")
addrW.Put(1,"")
addrW.Put(2,"")
addrW.Put(3,"")
mails.Initialize
mails.Put(c.EMAIL_HOME,"")
Dim name As String = line.Company
phones.Put(c.PhoneNumber,line.num1)
phones.Put(c.PhoneNumber,line.num2)
phones.Put(c.PhoneNumber,line.num3)
mu.createContactEntry2(name,Null,phones,mails,"","","",addrH,addrW)

What am i doing wrong :'(
 

Attachments

  • error1.png
    error1.png
    108.1 KB · Views: 260

Stulish

Active Member
Licensed User
Longtime User
Ok thanks Erel
 

Stulish

Active Member
Licensed User
Longtime User
I have used the ContactUtils module and its all working great, thanks
 
Top