Quantcast
Channel: Android Mode - Processing 2.x and 3.x Forum
Viewing all 941 articles
Browse latest View live

Is there a way to make a processing sketch (android mode) make the mobile post an image to a tumblr?

$
0
0

Hey, how is it going?

Im developing an app for pixel art. Is there a way to enable any person using it to post the image made using the app in a certain tumblr (one that i will create)? How?

thanks in advance!


Fisica and Integration with Navigation Drawer

$
0
0

Hi, first of all, I want to share my excitement as I only realized today that PApplet was now extending Fragment rather than Activity :D

Second, I am now playing with this new PApplet and trying to place it as part of a NavigationDrawer kind of application.

However, it results in this error when switching away from the PApplet:

java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.app.Activity.getSystemService(java.lang.String)' on a null object reference
at processing.core.PGraphicsAndroid2D.imageImpl(Unknown Source)
at processing.core.PGraphics.image(Unknown Source)
at fisica.FDrawable.drawImage(FDrawable.java:97)
at fisica.FCircle.draw(FCircle.java:101)
at fisica.FDrawable.draw(FDrawable.java:119)
at fisica.FBody.draw(FBody.java:41)
at net.diyoyo.MainSketch.draw(MainSketch.java:76)
...

in my PApplet, I just attach an image to a body:

in setup():

    inner=loadImage("inner.png");
    circle1=new FCircle(inner.width);
    circle1.setPosition(width/2, height/2);
    circle1.setName("inner");
    circle1.attachImage(inner);
    //circle1.setStatic(true);
    circle1.setSensor(true);

in draw():

    background(255);
    world.step();
   // image(inner, displayWidth/2, displayHeight/2);
    circle1.draw(this);

This last line causes the error.

I am using Fisica directly from the source, but I don't understand what's wrong in the drawImage method:

protected void drawImage(PGraphics applet) {
applet.tint(255, 255, 255, m_imageAlpha);
applet.image(m_image, 0-m_image.width/2, 0-m_image.height/2);
applet.tint(255, 255, 255, 255);
}

I tried changing draw(this) by draw(this.g), but it does do anything...

I guess it's a problem of how PApplet now manages the images when it is sent to the back stack or something, isn't it?

Thanks.

How to read PC shared images, from a android application?

$
0
0

Good afternoom,

I want read a image salved in a public directory of my pc, from android app.

I'm trying this code:

String ERROR = "";
PImage requestIMG = null;
boolean loadIMG = true; 


void setup()
{
 try{
  size(1000,1000);requestImageN();
    }catch(Exception e){ERROR = ERROR + "ERROR C";}
}
void draw()
{
  delay(1000);text(ERROR,50,50);
  try{
    if(loadIMG == true && requestIMG != null && requestIMG.width > 0)
    {
      loadIMG = false; requestIMG.loadPixels();image(requestIMG, 0,50);
    }
     }catch(Exception e){ERROR = ERROR + "ERROR B ";}
}
void requestImageN()
{
if(loadIMG == true){
 try{ requestIMG = requestImage("//NAME-PC/NEWS/image/1.png");}catch(Exception e){ERROR = ERROR + "ERROR A ";}
} 
}

It works with processing from W7, but fails in Android.

I think the problem may be how to point to the directory, but I tried various changes and can not solved it.

Regards and thanks in advance,

Anthony20

Ketai keyboard not detecting some buttons

$
0
0

Hello

I am working on an Android app and to make a keyboard appear, I use the Ketai library. I can make it detect normal characters correctly (letters and numbers), but it is returning strange results when using BACKSPACE, ENTER and some other buttons (like my camera button). You can see this by trying the Ketai UI example. It has a "println(key);" which shows what you pressed on the keyboard.

Here is my result when pressing buttons that are not letters or numbers:

ketai error

I would like to be able to detect the ENTER key and BACKSPACE key, but I can't find a way to do this.

Furthermore I have found that pressing ENTER followed by the number "1" makes ketai detect the buttons as the BACKSPACE key. Pressing ENTER followed by the number "3" is detected as ENTER. This confuses me a great lot.

I hope someone can help me with detecting ENTER and BACKSPACE correctly.

Taking screenshot programmatically - result is always black screen.

$
0
0

I am using the standard android code to take a screenshot of a Processing application:

private void Screenshot() {

    try {
        String mPath = Environment.getExternalStorageDirectory().toString() + "/screenshot.jpg";

        View v1 = getWindow().getDecorView().getRootView();
        v1.setDrawingCacheEnabled(true);
        Bitmap bitmap = Bitmap.createBitmap(v1.getDrawingCache());
        v1.setDrawingCacheEnabled(false);

        File imageFile = new File(mPath);

        FileOutputStream outputStream = new FileOutputStream(imageFile);
        bitmap.compress(Bitmap.CompressFormat.JPEG, 100, outputStream);
        outputStream.flush();
        outputStream.close();

    } catch (Throwable e) {
        e.printStackTrace();
    }
}

The code is working, the screenshot is taken, it is about 13kB in size. Howeever, it is all black, no matter the contents on the screen.

Do you know how to solve the issue? Maybe the canvas should be accessed in a different way than using:

View v1 = getWindow().getDecorView().getRootView();

?

Thank you in advance for your help.

Android SDK could not be loaded in MAC

$
0
0

I am using Mac OS, and I just got the newest processing at this link: https://processing.org/download/?processing

I also got the "Android SDK Manager", I have checked and everything shows as installed. When I click the Android Mode in the Processing, it gives me the error message as "The Android SDK could not be loaded. Use of Android Mode will be all but disabled" The same message keeps popping out at all time when i try. I am unable to tell the processing the location of the SDK, I installed the Android SDK too.

The SDK Location that I have downloaded is from http://developer.android.com/sdk/index.html#Other the package i download is android-sdk_r24.3.4-macosx.zip

Somehow i found the path of the SDK Path as shown here --> /Users/Nisha/Library/Android/sdk

How do I link it to the processing when it requests for the SDK Link to manually search? When I search using the processing, I am unable to see the Library folder in drive and to point to Android and SDK.

I also tried downloading the through the Add Mode > Contribution Manager, however it downloads and give me the same message as above. Hence I tried several method to make this work.

I even tried the method showed in this forum http://forum.processing.org/two/discussion/12665/android-sdk-could-not-be-loaded to save the link in the preferences.txt, and it does not save my link.

Kindly someone please help to solve this problem!

Thank you.

Where to get Android Mode library from?

$
0
0

I am developing using Eclipse.

So far I have used the 2.2.1 version of Android mode. The library I imported to Eclipse was "android-core.jar". Since Processing 3.0 is out, I would like to replace the current library that I have with the newest version. I downloaded Processing for Windows. I tried to download the Android mode using the "Add mode..." button. However, each time the mode download window opens, the following message appears:

"Could not connect to the Processing server. Contributions cannot be installed or updated without an Internet connection. Please verify your network connection again, then try connecting again."

My Internet connection is fine. Since this method is not working, do you know where I can get the right newest android mode library from?

Thanks in advance.

Run android keyboard

$
0
0

Good afternoon,

I'm designing an android app and do not know how I can use the virtual keyboard.

Is there a way to call android keyboard while the application is running? or Should I create a keyboard on my own?

Thanks in advance

Anthony20


Can't get emulator to run a sketch, what do I do? (3.0)

$
0
0

New Processing user here, very excited to develop my app!

I got it to Run on Device but I'd also like to get the emulator working (especially since my colleagues will be using the emulator exclusively). I'm using Processing 3.0, fresh install of the latest Android Studio as well.

When I click Run in Emulator, the emulator boots up (eventually) and I checked and there's an entry for the Processing emulator in the AVD manager.

But when the console gets to "Debug..." and the little grey bar says "Sketch launched on the emulator", nothing has happened. The emulator is still blank (all black screen) and no phone OS even ever came up. (Btw the emulator window looks jenky—big grey half on the right with buttons—just to give you an idea which emulator window is showing up.)

What do I do to get this working?

Android live wallpaper

$
0
0

Is there any way to make android live wallpaper for android device with processing?

Android is not compatible ......

$
0
0

Hello, I just update version 3 Processing under Windows 10. When I install I get an error message: " android is not compatible with this version of processing updating the mode". Maybe you have already found the solution ? thank you in advance

"Android mode is not compatible with this revision of Processing"

$
0
0

Hi.

I wanted to get started with this function, but I cannot install it, but when I put the AndroidMode folder in "modes" and I try to select it in Processing, it says that it's not compatible. I definitely don't know why because it seems a simple process and I checked some guides trying to solve this.

Any idea about what should I do? I use Processing 3.0a5 and, of course, I tried other versions, but the same problem appears. A screenshot: http://s1323.photobucket.com/user/Anti_2/media/processingandroid_zpsuruchl32.png.html

Thank you.

loading quickstart.SIKIO_C0 on my samsung galaxy tab 4 is wrong

$
0
0

after loading quickstart.SIKIO_C0 on my samsung galaxy tab 4 i get the message "SIKIO_Co_quickstart has stopped OK" Loading Android applications works correctly but when IOIO board is involved.

I get this message on my PC with windows 7 64 bits.

FATAL EXCEPTION: Animation Thread Process: processing.test.sikio_c0_quickstart, PID: 1447 java.lang.VerifyError: sikio/SikioManager at processing.test.sikio_c0_quickstart.SIKIO_C0_quickstart.setup(SIKIO_C0_quickstart.java:79) at processing.core.PApplet.handleDraw(Unknown Source) at processing.core.PGraphicsAndroid2D.requestDraw(Unknown Source) at processing.core.PApplet.run(Unknown Source) at java.lang.Thread.run(Thread.java:841)

How do i get sound to play on the phone

$
0
0

The code below works fine in java mode, but it doesn't work in Android mode. I just want a simple code that will play a mp3 file when clicked. I'm pretty sure the problem is in the import of Minim, I'm guessing it doesn't work for Android. If that is the case what do I need to use?

import ddf.minim.*; AudioPlayer player; Minim minim;
void setup(){minim = new Minim(this);} void draw(){} void mousePressed() { player = minim.loadFile("sin1.mp3" ); player.play(); } void stop() { player.close(); minim.stop(); super.stop(); }

Real-time GPS on Android and computer ?

$
0
0

So I have recently been learning about processing. So i'm still a newbie. I have also done a project where processing is reading a CSV file with coordinates (that was made in Openpaths). I want to take this to the next level by connecting my phone (LG G2, Android) that sends real time coordinates to my computer (as long as there is internet) which you can see moving (I will later on connect that dot with grasshopper as an attractor point).

I found a script too earlier that was maybe suitable as a good start:

import android.content.Context;
import android.location.Location;
import android.location.LocationManager;
import android.location.LocationListener;
import android.location.GpsStatus.Listener;
import android.location.GpsStatus.NmeaListener; // not needed yet, but going for nmea data next!
import android.os.Bundle;

String[] fontList;
PFont androidFont;

LocationManager locationManager;
MyLocationListener locationListener;

// Variables to hold the current GPS data
float currentLatitude  = 0;
float currentLongitude = 0;
float currentAccuracy  = 0;
String currentProvider = "";

//-----------------------------------------------------------------------------------------

void setup() {
size(screenWidth, screenHeight);
background(0);
fontList = PFont.list();
androidFont = createFont(fontList[4], 35, true);
textFont(androidFont);
}

//-----------------------------------------------------------------------------------------

void draw() {
background(0);
// Display current GPS data
text("Latitude: "+currentLatitude, 20, 40);
text("Longitude: "+currentLongitude, 20, 75);
text("Accuracy: "+currentAccuracy, 20, 110);
text("Provider: "+currentProvider, 20, 145);  
}

//-----------------------------------------------------------------------------------------

void onResume() {
super.onResume();
// Build Listener
locationListener = new MyLocationListener();
// Acquire a reference to the system Location Manager
locationManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
// Register the listener with the Location Manager to receive location updates
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, locationListener);
}

void onPause() {
super.onPause();
}

//-----------------------------------------------------------------------------------------

// Define a listener that responds to location updates
class MyLocationListener implements LocationListener {
void onLocationChanged(Location location) {
// Called when a new location is found by the network location provider.
  currentLatitude  = (float)location.getLatitude();
  currentLongitude = (float)location.getLongitude();
  currentAccuracy  = (float)location.getAccuracy();
  currentProvider  = location.getProvider();
}
void onProviderDisabled (String provider) { 
  currentProvider = "";
}

void onProviderEnabled (String provider) { 
  currentProvider = provider;
}

void onStatusChanged (String provider, int status, Bundle extras) {
  // Nothing yet...
}

}

But when I run this on my phone is gives me an error about the size() command. After filling the size I get "expecting EOF, found '}' "

Any help would be highly appreciated. Thanks in advance !


problems with android examples in processing 3

$
0
0

answering a question about playing sound with android mode i have given 2 solutions (one with APWidget lib, the other with android mediaPlayer class); the twos tested with 3 phones and processing 2, they run fine. However the user tells me that it does not work... and i understood (finally!) that he was using Processing 3 android mode. So i downloaded the last version of P3 (it is 3.06 beta , osX) and installed it on OSX, yosemite.

you can see the question && snippet i posted here: forum.processing.org/two/discussion/12819/how-do-i-get-sound-to-play-on-the-phone#latest

When i runned the code i have posted for android mediaPlayer class (because i was quite sure that APWidgets which was not updated since 2011 cannot work with P3) i firstly get an error from the compiler at the very beginning when i code:

AssetFileDescriptor afd = getAssets().openFd("myp3.mp3");

--- which is a line of code i have often used for that in Eclipse.

Compiler says, as the oop tells (see its picture) that getAssets() does not exists. Of course i have all imports ok.

----I thought that it was a problem with context.

So i tried ::

AssetFileDescriptor afd = this.getAssets().openFd("myp3.mp3");

---same error from ...

So i tried to add to imports the android Context class && wrote::

  (Context)  context = context.getApplicationContext();
    AssetFileDescriptor afd = context.getAssets().openFd("myp3.mp3");

--- here it accepts to compile and install the sketch on the phone... Happy! ----But once installed the app crashes and i get another error, NPE::

"Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' on a null object reference"

----which means that context is null

--- So i decided, in order to verify, to add a very simple class extending Application class from android:::

      public class Appverify extends Application  {

        private  Context ctx;

        public  Context getContext() {
            return ctxt;
        }

        public  void setContext(Context mContext) {
            this.ctxt = ctxt;
        }

    --- then i created an instance of Appverify and called this class + println(context) from its return::

--------result was as i was afraid of:: null

------- Here i begin to be really puzzled and decided to verify with the examples for android, compass && accelerometer -------and found exactly the same results

--------in the twos the constructor does not compile with "this"

(compass = new CompassManager(this);

--------if i change this for context (same method, imports and so on) the error disappears, it compiles, but the app crashes immediately on the phone with the same error "Attempt to invoke virtual method on a null object reference"

----- so, what to do???

last phone with which i tested is running lollipop 5.1, if it matters...

thanks in advance

PS another error i have found is that the line number indicated by console (for errors) does not match the left numbers for the coded lines.

This version of Android is not compatible ...

$
0
0

Hi, I've installed time ago Processing 2 and processing 3.0 alpha plus android SDK, and also if I've not been able to run any sketch on Android device or Device emulator, all the other modes were working well. Few minutes ago I've installed Processing 3.0 because advised that there were an update available. Running Processing3.0 I got the message that this version of Android isn't compatible with this Processing version, but what is drammatic is that now running Processing 2 or 3.o alpha I got the same message. The only way that I've found to run again Processing 2.0 and 3.0 alpha is restart the PC ,but then If I try again to run the 3.0 I got the error and also the other versions are effected.

Any Idea about how fix the issue ? Thanks. P.S. I can't change the mode because the program stop before arrive to the starting editor page.

"Could not create a virtual device for the emulator".

$
0
0

I just did a fresh (today) install of Processing 3.0 (latest download available from processing.org), and installed the Android SDK - Android 6.0 (API 23) and Android 2.3.3 (API 10).

In older versions of Processing for Android which I happily used for a long time, a virtual device was (eventually) created automatically when you ran the emulator the first time. This seems to not happen anymore. Now, if I start with no virtual device, or matter what device profile I do create in the AVD Manager, whenever I try to run a sketch in the emulator, even when I manually start it, I get "Could not create a virtual device for the emulator". Anyone else getting this error? Anyone have a solution?

I read on the old forum that deleting Intel Atom x86 System Image can work, but it didn't.

I am running Windows 7 64-bit. Java version 8 update 60.

Keystore

$
0
0

Hi I have an existing keystore file for use when creating signed apk's (using AIDE)

Can it be used with Processing, or am I stuck with the one Processing created for me (somewhere?!) when I first did a signed export?

Mark

Displaying text makes my frameRate fall

$
0
0

Hello, I have a little problem. On a processing project for android, I have to display a lot of text on the screen. I use :

string myString = "lots of words";
textFont(myFont, 20);
text(myString, x, y);

but the performances are very low (5 fps). Does anyone has an advice for a best performance?

Thanks a lot, JM

Viewing all 941 articles
Browse latest View live