• Increase font size
  • Default font size
  • Decrease font size

How to test Android mode

I needed to run specific code only in android mode. To test the mode I developed this code:

 

 

1. In main file import this:

import java.lang.reflect.Method;

 

2. Add new static class cGlobalSettings

static class cGlobalSettings{
static boolean bDebug = false;
static int     iMode  = 1;
static long    iDblClickInterval = 300;
static boolean bAndroidMode = getAndroidMode();
 
static boolean getAndroidMode(){
boolean ret = false;
 
Class pappletClass = PApplet.class;
 
//Get the methods
Method[] methods = pappletClass.getDeclaredMethods();
 
//Loop through the methods and print out their names
for (Method method : methods) {
if (method.getName().compareTo("surfaceTouchEvent") == 0){
ret = true;
System.out.println("Android methos is presented: " + method.toGenericString());
}
}
 
//println("Android mode: " + ret);
 
return ret;
}
}

 

3. Than you can access the variable anywhere in the code this way:

//Then access it by
if (cGlobalSettings.bAndroidMode){
//do something
}

 

Comments  

 
0 #5 tienda erótica 2015-01-31 20:10
May I simply say what a relief to discover someone that actually knows what they are discussing on the web.
You definitely realize how to bring a problem to light and make it important.

A lot more people really need to check this out and
understand this side of your story. I was surprised you are not more popular
because you definitely have the gift.
Quote
 
 
0 #4 http://lolatoys.com 2014-12-12 04:04
Howdy! This is my first visit to your blog! We are a collection of
volunteers and starting a new initiative in a community in the same niche.
Your blog provided us useful information to work on. You
have done a marvellous job!
Quote
 
 
0 #3 http://lolatoys.com 2014-11-28 01:26
Hey there! I've been following your weblog for a while now and finally
got the bravery to go ahead and give you a shout out from New Caney Texas!

Just wanted to mention keep up the fantastic work!
Quote
 
 
0 #2 sex shop online 2014-10-20 11:35
Hi! This is my first visit to your blog! We are
a collection of volunteers and starting a new
project in a community in the same niche. Your blog provided us valuable information to work on. You have done
a outstanding job!
Quote
 
 
0 #1 sex shop Valencia 2014-10-20 11:26
You made some decent points there. I looked on the web to learn more about the issue and found most people will go along with your views on this
web site.
Quote
 

Add comment

No bad words.


Security code
Refresh


New articles

Differential Equations - Simple spring model Machine Learning and Robotics
Read More 1631 Hits
Kalman Filter implementation Machine Learning and Robotics
Read More 2412 Hits
Inverse kinematics Machine Learning and Robotics
Read More 2928 Hits
gpsim tutorial Machine Learning and Robotics
Read More 5255 Hits

New articles

Differential Equations - Simple spring model Machine Learning and Robotics
Read More 1631 Hits
Kalman Filter implementation Machine Learning and Robotics
Read More 2412 Hits
Inverse kinematics Machine Learning and Robotics
Read More 2928 Hits
gpsim tutorial Machine Learning and Robotics
Read More 5255 Hits
Design by i-cons.ch / etosha-namibia.ch