Click here to Skip to main content
15,893,668 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi there,

I was working on a Sphero Project. This hase a .jar implement

Add code to connect to a sphero

The RobotLibrary includes a view called SpheroConnectionView which will handle connecting to a Sphero. When the view sends an onRobotConnected event you are ready to send commands.

To use the SpheroConnectionView add the following code to your Activity's xml layout file

<linearlayout> xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:removed="#ff888888" >

<orbotix.view.connection.spheroconnectionview>
android:id="@+id/sphero_connection_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:removed="#FFF" />

whenever I addiding the xml shown the following error appears:

java.lang.NullPointerException
at orbotix.robot.base.RobotProvider.<init>(RobotProvider.java:161)
at orbotix.robot.base.RobotProvider.<clinit>(RobotProvider.java:78)
at orbotix.view.connection.SpheroConnectionView.startDiscovery(SpheroConnectionView.java:236)
at orbotix.view.connection.SpheroConnectionView.<init>(SpheroConnectionView.java:215)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:379)
at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:99)
at com.android.tools.idea.rendering.LayoutlibCallback.loadView(LayoutlibCallback.java:172)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:207)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:132)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:806)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:782)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:400)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:332)
at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:350)
at com.android.tools.idea.rendering.RenderService$5.compute(RenderService.java:688)
at com.android.tools.idea.rendering.RenderService$5.compute(RenderService.java:677)
at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:932)
at com.android.tools.idea.rendering.RenderService.createRenderSession(RenderService.java:677)
at com.android.tools.idea.rendering.RenderService.render(RenderService.java:815)
at com.intellij.android.designer.designSurface.AndroidDesignerEditorPanel$6.run(AndroidDesignerEditorPanel.java:480)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:320)
at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:310)
at com.intellij.util.ui.update.MergingUpdateQueue$2.run(MergingUpdateQueue.java:254)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:269)
at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:227)
at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:217)
at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
at com.intellij.util.Alarm$Request$1.run(Alarm.java:327)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)


The Sphero view class is shown in the application, the class hase a bluethooth function to connect to this sphero "toy" when I enable the bluetooth the app crash with a security issue on the orbotix.robot.base.RobotProvider class.

So my question is if there is some pro witch knows how to fix this rendering problems and this security issue.

Kind Regards,

Wessel
Posted
Comments
Richard MacCutchan 11-Feb-15 8:39am    
You should probably ask the peple who provide the orbotix.robot.base.RobotProvider library.
Wessel Beulink 11-Feb-15 8:56am    
Its a Android studio failure... To bad Eclipse ADT bundle support this. Solved the security issue already. Still having the rendering problems.
Richard MacCutchan 11-Feb-15 8:59am    
It's not an Android Studio failure, the message clearly tells you it's in the robot library.

1 solution

Android 4.+ changed the bluethooth with a bluethooth call back. Changed the api for 4.+. If you wanna program with sphero also let me know. I can send you the api.
 
Share this answer
 
Comments
stubz151 16-Jul-19 15:47pm    
Hi I was interested in that API and was wondering whether you could share it with me? as I am struggling to get my Sphero mini to connect to my Android 4.4 phone.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900