the problem I am facing is that when i test it on device simulator. the button action for contact button works fine.
But when i send the built for android i get a apk in which on clicking contact button i got null pointer error
can you tell me what i am doing wrong as for my testing side i.e. on PC it work fine but on actual device it gives error.
If you are experiencing an issue please mention the full platform your issue applies to: IDE: IDEA Desktop OS: Ubuntu Simulator: Default Device: Android 6.0
Chen Fishbein
unread,
Oct 12, 2016, 2:18:39 AM10/12/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to CodenameOne Discussions
Please connect the device with cable to the pc and provide the full stacktrace with the android ddms tool.
Jugraj Singh
unread,
Oct 12, 2016, 4:10:46 AM10/12/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to codenameone...@googlegroups.com
On Wed, Oct 12, 2016 at 11:48 AM, Chen Fishbein <cf2...@gmail.com> wrote:
> Please connect the device with cable to the pc and provide the full
> stacktrace with the android ddms tool.
>
How to do so please tell.
I am unable to get the trace
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to CodenameOne Discussions
See this from your log:
java.lang.NullPointerException: value == null
10-12 15:32:08.991: W/System.err(21384): at java.util.Hashtable.put(Hashtable.java:362)
10-12 15:32:08.991: W/System.err(21384): at userclasses.StateMachine.onMain_ButtonAction(StateMachine.java:75)
Check out line 75...
Jugraj Singh
unread,
Oct 13, 2016, 5:49:08 AM10/13/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to codenameone...@googlegroups.com
This is the code around line 75
73 for (String phoneContact : phoneContacts) {
74 Contact contact = Display.getInstance().getContactById(phoneContact);
75 Hashtable<String, String> temp = new Hashtable<>();
76 temp.put("phone",contact.getPrimaryPhoneNumber());
77 temp.put("name",contact.getDisplayName());
78 con.add(temp);
79 }
I did not see anything wrong there.
Jugraj Singh
unread,
Oct 13, 2016, 5:51:01 AM10/13/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to codenameone...@googlegroups.com
On Thu, Oct 13, 2016 at 3:18 PM, Jugraj Singh <jugraj...@gmail.com> wrote:
<snip>
>
> This is the code around line 75
> 73 for (String phoneContact : phoneContacts) {
> 74 Contact contact = Display.getInstance().getContactById(phoneContact);
> 75 Hashtable<String, String> temp = new Hashtable<>();
> 76 temp.put("phone",contact.getPrimaryPhoneNumber());
> 77 temp.put("name",contact.getDisplayName());
> 78 con.add(temp);
> 79 }
>
> I did not see anything wrong there.
>
The exception i getting is null pointer value == null but i initialise
the temp variable here.
Shai Almog
unread,
Oct 13, 2016, 11:21:18 PM10/13/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to CodenameOne Discussions
I'm guessing you changed the lines a bit since the stack points at passing a null to the put method which means that either display name is null or the primary phone number is null. You need to account for cases when these are null.