Hi Ytai.
thank you for your replay. Unfortunately i cannot make sense of the Log Cat.
Would you mind taking a look at the file yourself?
I really am grateful for your help.
(File attached)

Regards
Francesco

On Sunday, March 23, 2014 10:41:55 PM UTC, Ytai wrote:
>
> Look at the logcat output. When an android app crashes it writes a log 
> message with the reason.
> On Mar 23, 2014 2:47 PM, "Francesco Cembrola" 
> <[email protected]<javascript:>> 
> wrote:
>
>>
>> Hi everybody,
>> I am new to the forum.
>> I have written a small app that uses two buttons to turn ON and OFF two 
>> LEDs.
>> It compiles with no errors.
>> The console says it was installed on my tablet correctly...but then it 
>> crashes when run.
>>
>> Can someone take a look at the code below and help me, please?
>> By the way I am new to Java and android!
>>
>> Regards
>>
>> Francesco cembrola
>>
>> =========================================================
>>
>> package com.example.timobot;
>>
>> import ioio.lib.api.DigitalOutput;
>> import ioio.lib.api.exception.ConnectionLostException;
>> import ioio.lib.util.BaseIOIOLooper;
>> import ioio.lib.util.IOIOLooper;
>> import ioio.lib.util.android.IOIOActivity;
>> import android.os.Bundle;
>> import android.view.MotionEvent;
>> import android.view.View;
>> import android.view.View.OnTouchListener;
>> import android.widget.Button;
>>
>>
>> public abstract class MainActivity extends IOIOActivity implements 
>> OnTouchListener {
>>     
>>     private final int Left_Pin = 6;
>>     private final int Right_Pin = 3;
>>     boolean LeftTurnState=false;
>>     boolean RightTurnState=false;
>>     private Button LEFT_Button,RIGHT_Button;
>>       
>>     @Override
>>     public void onCreate(Bundle savedInstanceState) {
>>         super.onCreate(savedInstanceState);
>>         setContentView(R.layout.activity_main);
>>         
>>         LEFT_Button = (Button) findViewById(R.id.LEFT);
>>         LEFT_Button.setOnTouchListener(this);
>>         
>>         RIGHT_Button = (Button) findViewById(R.id.RIGHT);
>>         RIGHT_Button.setOnTouchListener(this);
>>         }        
>>     
>>         class Looper extends BaseIOIOLooper {
>>           public    DigitalOutput LeftTurn;        
>>          public    DigitalOutput RightTurn;
>>          
>>              
>>          @Override
>>          protected void setup() throws ConnectionLostException {
>>             LeftTurn = ioio_.openDigitalOutput(Left_Pin, false);
>>             RightTurn = ioio_.openDigitalOutput(Right_Pin, false);
>>             }
>>
>> @Override
>> public void loop() throws ConnectionLostException {
>>     
>>             LeftTurn.write(LeftTurnState);        
>>             RightTurn.write(RightTurnState);   
>>            
>>
>>             try {
>>                 Thread.sleep(100);
>>                 }catch (InterruptedException e) {
>>             }
>>             
>>         }
>>     }
>> protected IOIOLooper createIOIOLooper(){ 
>>     return new Looper();
>>     
>> }
>>     @Override
>>     public boolean onTouch(View arg0, MotionEvent arg1) {
>>         
>>         switch (arg0.getId()) 
>>         {
>>         
>>         case R.id.LEFT:
>>             {
>>             
>>             if(arg1.getAction()==MotionEvent.ACTION_DOWN)
>>                 {
>>              LeftTurnState=true;
>>                    
>>                 }
>>             if (arg1.getAction()==MotionEvent.ACTION_UP)
>>                {
>>                 LeftTurnState=false;
>>                 
>>                }
>>             
>>         }
>>         break;
>>         
>>         case R.id.RIGHT:
>>          {
>>             if(arg1.getAction()==MotionEvent.ACTION_DOWN)
>>              {
>>                 RightTurnState=true;
>>                   
>>              }
>>             if (arg1.getAction()==MotionEvent.ACTION_UP)
>>              {
>>                 RightTurnState=false;
>>                 
>>             }
>>             break;
>>             
>>         }
>>         
>>         }
>>         return false;
>>     
>> }
>>
>>     }
>>
>>
>>
>>      
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "ioio-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected]<javascript:>
>> .
>> Visit this group at http://groups.google.com/group/ioio-users.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"ioio-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/ioio-users.
For more options, visit https://groups.google.com/d/optout.
01-06 23:41:35.215: D/dalvikvm(4446): Late-enabling CheckJNI
01-06 23:41:35.280: D/dalvikvm(4446): newInstance failed: p0 i0 [0 a1
01-06 23:41:35.285: D/AndroidRuntime(4446): Shutting down VM
01-06 23:41:35.285: W/dalvikvm(4446): threadid=1: thread exiting with uncaught 
exception (group=0x4146f2a0)
01-06 23:41:35.285: E/AndroidRuntime(4446): FATAL EXCEPTION: main
01-06 23:41:35.285: E/AndroidRuntime(4446): java.lang.RuntimeException: Unable 
to instantiate activity 
ComponentInfo{com.example.timobot/com.example.timobot.MainActivity}: 
java.lang.InstantiationException: can't instantiate class 
com.example.timobot.MainActivity
01-06 23:41:35.285: E/AndroidRuntime(4446):     at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2034)
01-06 23:41:35.285: E/AndroidRuntime(4446):     at 
android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2135)
01-06 23:41:35.285: E/AndroidRuntime(4446):     at 
android.app.ActivityThread.access$700(ActivityThread.java:140)
01-06 23:41:35.285: E/AndroidRuntime(4446):     at 
android.app.ActivityThread$H.handleMessage(ActivityThread.java:1237)
01-06 23:41:35.285: E/AndroidRuntime(4446):     at 
android.os.Handler.dispatchMessage(Handler.java:99)
01-06 23:41:35.285: E/AndroidRuntime(4446):     at 
android.os.Looper.loop(Looper.java:137)
01-06 23:41:35.285: E/AndroidRuntime(4446):     at 
android.app.ActivityThread.main(ActivityThread.java:4921)
01-06 23:41:35.285: E/AndroidRuntime(4446):     at 
java.lang.reflect.Method.invokeNative(Native Method)
01-06 23:41:35.285: E/AndroidRuntime(4446):     at 
java.lang.reflect.Method.invoke(Method.java:511)
01-06 23:41:35.285: E/AndroidRuntime(4446):     at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
01-06 23:41:35.285: E/AndroidRuntime(4446):     at 
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
01-06 23:41:35.285: E/AndroidRuntime(4446):     at 
dalvik.system.NativeStart.main(Native Method)
01-06 23:41:35.285: E/AndroidRuntime(4446): Caused by: 
java.lang.InstantiationException: can't instantiate class 
com.example.timobot.MainActivity
01-06 23:41:35.285: E/AndroidRuntime(4446):     at 
java.lang.Class.newInstanceImpl(Native Method)
01-06 23:41:35.285: E/AndroidRuntime(4446):     at 
java.lang.Class.newInstance(Class.java:1319)
01-06 23:41:35.285: E/AndroidRuntime(4446):     at 
android.app.Instrumentation.newActivity(Instrumentation.java:1068)
01-06 23:41:35.285: E/AndroidRuntime(4446):     at 
android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2025)
01-06 23:41:35.285: E/AndroidRuntime(4446):     ... 11 more
01-06 23:45:37.485: I/Process(4446): Sending signal. PID: 4446 SIG: 9

Reply via email to