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

Processing Android Mode + Android Device + Bluetooth + Arduino

$
0
0

I usually create my own graphical user interface (custom design) to control an arduino via an android device using an android phone, wherein the GUI and communication was coded in processing android mode. But after upgrades done during the development of processing, a problem arise. The code that I created does not run the GUI on the later versions anymore.

My previous codes using Bluetooth communication was able and still is able to run in processing 2.0b6 and 2.0b7 (old dowloads). The problem on the codes started when I tested it with processing 2.2.1 (old download) states "that the package "android" does note exist". Also problems from existing later version, from processing 2.2.1(new download) untl the last version, states that there is an "error from inside the android tools, check the console".

This was test until February 2017.

I am still currently working on projects using the android device communicating with arduino via bluetooth, and it is still working perfectly. It was fortunate that I did not delete my old versions for testing my codes.

May I know, why did the foundation remove android packages in developing android device communicating via bluetooth? Or does the later versions require a procedure to install android packages.

Are there other ways wherein I could code bluetooth communication using a custom graphic user interface to communicate with arduino using the latest version of processing. Or are there any alternatives wherein I could code making android communicate with arduino designing my own GUI?


resizing a PImage in Processing 2 and 3

$
0
0

In an Android application that I've written using Processing 2 I have the following:

void setup() {
    if (cam == null) cam = new KetaiCamera(this, camWidth, camHeight, 30);
}

void draw() {
    img = cam.get();
    img.loadPixels();
    img.updatePixels();
    // render the original image to screen, seems to be necessary before resizing...
    image(img, width/2, height/2, height, width);

    img.resize(7, 5);
    img.loadPixels();
    // render the scaled image over the original one
    image(img, width/2, height/2, height, width);
}

This has always worked fine for me while using the Processing 2 Android lib. Now I'm trying to port this to Processing 3. I had to change some details (e.g. width, height have become displayWidth, displayHeight) but what bothers me most is that I'm not able to display the scaled image over the original one. I suspecting it's related to resize() not working quite as expected but I don't know for sure. I am simply not seeing the image though I don't get an error. For testing purposes I checked the color of the first pixel of the resized image - I'm always getting 0, 0, 0 which is certainly not right but doesn't explain why I'm not seeing the image.

Does anyone know what might cause the problem? Have there been any changes between p2 and 3 regarding how resize() works?

Thanks very much, Stefan

Question, Why Error? - Open shared file

$
0
0

Hi, nice to meet you.

BufferedReader reader;
String line;
PFont font;

void setup() {
  font = createFont("aaaa.vlw", 32);

  size(1000,1500);
  // Open the file from the createWriter() example
  reader = createReader("positions.txt");
}

void draw() {


  textFont(font);
  String[] lines22;
  lines22 = loadStrings("\\\\192.168.0.202\\share\\t1.txt");
  for (int i = 0; i < lines22.length; i = i+1) {
   text(lines22[i], 300, 200 + 100*i);
  }

}

Why is there no error in JAVA? But why is not it running on Android?   The concept is to share files through shared folders. And the status of the system is visible through the shared file.

Java mode works well. But Android mode does not work well. Why?

> blendMode(), or this particular variation of it, is not available with this renderer.

        positions.txt does not exist or could not be read
        The file "\\192.168.0.202\share\t1.txt" is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.
        FATAL EXCEPTION: Animation Thread
        Process: processing.test.android_tcp, PID: 17405
        java.lang.NullPointerException: Attempt to get length of null array
          at processing.test.android_tcp.android_tcp.draw(android_tcp.java:38)
          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:818)</del>

fullScreen(), size() crashing

$
0
0

Hello everybody. I try to make app for android, but if I add fullScreen() or size() it crashed. With size(100,100), size(50,50), size(500,250) it works fine, but with size(500,500) or size(displayWidth, displayHeight)

void setup() {
  fullScreen();
  orientation(LANDSCAPE);
}

void draw() {
  background(0);
  rect(width/2,height/2,36,36);
}

WIFI Communication - PC & Smartphone - Please help me~

$
0
0

abc

Hi, nice to meet you. I want to send Korean language to the communication.

I am sending a Korean word for wireless communication between PC and PC. However, Korean is not communicated between PC and smartphone.

Is there a way?

Or can I send a txt file and read it on my cell phone? Please.

i can move point of view in cardboardsoftware?

$
0
0

Hi!

How I Can move the point of view in cardboard mode? I would move in the world that i have created! THX

WIFI list & Connection by android mode (at Processing Tool)

$
0
0

WIFI list & Connection by android mode (at Processing Tool)

------------------------------ code------------------- import android.net.wifi.*; import android.content.*; import java.util.*;

Context context;

void connect_to_wifi(){

  //create wifi connection
        String networkSSID = "";
        String networkPass = "";

        WifiConfiguration conf = new WifiConfiguration();
        conf.SSID = "\"" + networkSSID + "\"";   // Please note the quotes. String should contain ssid in quotes

         //For WPA network you need to add passphrase like this:

            conf.preSharedKey = "\""+ networkPass +"\"";

        //Then, you need to add it to Android wifi manager settings:
        WifiManager wifiManager = (WifiManager)context.getSystemService(Context.WIFI_SERVICE);
        wifiManager.addNetwork(conf);

        //And finally, you might need to enable it, so Android conntects to it:
        List<WifiConfiguration> list = wifiManager.getConfiguredNetworks();
        for( WifiConfiguration i : list ) {
            if(i.SSID != null && i.SSID.equals("\"" + networkSSID + "\"")) {
                 wifiManager.disconnect();
                 wifiManager.enableNetwork(i.networkId, true);
                 wifiManager.reconnect();

                 break;
            }
         }
}

void setup() {
  size(480,800);
  noStroke();
  fill(255);
  rectMode(CENTER);     // This sets all rectangles to draw from the center point
  connect_to_wifi();
}

void draw() {
  background(0);
  rect(width/2, height/2, 150, 150);
}

Error Message : FATAL EXCEPTION: Animation Thread Please solve the problem. Help.

Smartphone to work even when it is turned off. I need your help. Please help me.

$
0
0

qu

Detailed description> You will create an application program to monitor. ( at app.) 1. Start the program and watch the monitoring value. 2. The screen of the cell phone turns off. 3. Enables the alarm to be triggered when an event occurs.

For example,   1) It is similar to the message coming from messenger program.   2) Can the program always wait on the smartphone?   3) I want to be able to operate the smartphone when I send a signal from outside (WiFi, Internet, etc.).

To summarize, I want my smartphone to work even when it is turned off.

I need your help. Please help me.


How to save score

$
0
0

How to save score in game and then using it when highscore button is clicked

How to set live wallappers?

$
0
0

If I develope a normal android app, and I have the apk of a live wallapper saved into a folder of my normal app, how can I set/preview the live wallapper from the normal app?

I have coded some android live wallappers with processing in the mode showed in this image Immagine but the wallappers i create can be set or previwed only by an external app.

can't compile sketch with ketai, oscp5 and external Jar ! weird

$
0
0

hi all. weird stuff here. I use jcifs to make samba connection (jar is placed in code folder). My problem is the compiler stops when I import ketai.ui.* and oscp5.* library... Can you reproduce this issue ? It's weird...when I just import ketai.ui.*ui, the compiler works just fine. output of processing compiler: Converting compiled files and external libraries into C:\Users\plouf\AppData\Local\Temp\android867514671559174877sketch\bin\classes.dex...

BUILD FAILED
C:\Users\plouf\Documents\modes\AndroidMode\sdk\tools\ant\build.xml:888: The following error occurred while executing this line:
C:\Users\plouf\Documents\modes\AndroidMode\sdk\tools\ant\build.xml:890: The following error occurred while executing this line:
C:\Users\plouf\Documents\modes\AndroidMode\sdk\tools\ant\build.xml:902: The following error occurred while executing this line:
C:\Users\plouf\Documents\modes\AndroidMode\sdk\tools\ant\build.xml:283: null returned: -1073740791

here's my simple sketch:

import ketai.ui.*;
import oscP5.*;
import netP5.*;
import jcifs.smb.NtlmPasswordAuthentication;
import jcifs.smb.SmbFile;
import jcifs.smb.SmbFileOutputStream;

float rouge=random(255);
float vert=random(255);
float bleu=random(255);
void setup()
{
  fullScreen();
  background(rouge, vert, bleu);
}

void draw()

{
  background(rouge, vert, bleu);
}

void mousePressed()
{
  rouge=random(255);
  bleu=random(255);
  vert=random(255);
}
/*
can compile:


 import jcifs.smb.NtlmPasswordAuthentication;
 import jcifs.smb.SmbFile;
 import jcifs.smb.SmbFileOutputStream;
 import netP5.*;
 import oscP5.*;
 ************************************************
  ketai.ui.* alone
 *************************************************
  */

thanks in advance !!!

Two finger zoom in procrssing for android

$
0
0

Source code tow finger zoom in processing for android?

DisplayWidth in Android mode behave differently than in eclipse

$
0
0

Hello! I'm totaly stuck. Same sketch gives 2 differents results with displaywidth (phone HTC desire 510) Eclipse=790 px Android mode=854 px It seems in android mode displaywidth take in acount the control Bar while not in eclipse. Can anyone help me? Thanks in advance Pascal

Monitoring Memory Usage

$
0
0

Hi All I am trying to find a means of monitoring memory usage and ultimately would like to have a background thread that will warn users when an app's memory usage is in danger of reaching the heap limit. I currently use try/catch to deal with out of memory issues but now want to anticipate issues in advance if possible. So far I have the code below that gives me allocated heap size and system memory usage but I cannot find a way to just get heap usage for an app. Is there a straight forward way to do this? Mark

import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityManager.MemoryInfo ;
import android.os.Environment;
import android.content.Context;

Activity activity ;
Context context ;
MemoryInfo myMemInfo ;
ActivityManager myActivityManager ;
long heapSize ;

void setup() {
  fullScreen(P2D) ;
  activity = this.getActivity();
  context = activity.getApplicationContext();
  heapSize = Runtime.getRuntime().maxMemory();
  myMemInfo = new MemoryInfo();
  myActivityManager = (ActivityManager) context.getSystemService(activity.ACTIVITY_SERVICE);
  fill(255); // text colour
  textAlign(CENTER, CENTER);
}

void draw() {
  background(0) ;
  displayMemInfo() ;
}// end draw()

void displayMemInfo() {
  myActivityManager.getMemoryInfo(myMemInfo) ;
  text("availMem = " + myMemInfo.availMem/1048576 + "MB" + "\n"
    + "appMemory = " + myActivityManager.getMemoryClass() + "MB" + "\n"
    + "lowMemory =  " + myMemInfo.lowMemory + "\n"
    + "threshold =  " + myMemInfo.threshold/1048576 + "MB" + "\n"
    + "heapSize = " + heapSize/1048576 + "MB" + "\n"
    , 0, 0, width, height);
}

How to stop the music when game is received to the background ?

$
0
0

How to stop the music when game is received to the background ?


Is there any one Who to know add advertisement to processing Android app?

$
0
0

Is there any one Who to know add advertisement to processing Android app?

how can i set game icon(which is app icon)?

$
0
0

how can i set game icon(which is app icon)?

Creating an event in Google Calendar using Processing for Android.

$
0
0

I am trying to write a Processing program for Android that can create an event in Google Calender.

I've written a program, that creates a .csv file which through this method can be imported into Google Calendar via a computer: support.google.com/calendar/answer/37118?hl=en

Transfering a .csv file from my phone to a computer, just to create an event in google Calendar, is obviously not a very user friendly method. As both the 'READ_CALENDAR' and 'WRITE_CALENDAR' permissions are present in Android Mode, there must be a proper way to create an event in Google Calendar with Processing, and yet the closest i've gotten to finding a solution, is this one from Google's website: developer.android.com/guide/topics/providers/calendar-provider.html#intent-insert

Calendar beginTime = Calendar.getInstance(); beginTime.set(2012, 0, 19, 7, 30); Calendar endTime = Calendar.getInstance(); endTime.set(2012, 0, 19, 8, 30); Intent intent = new Intent(Intent.ACTION_INSERT) .setData(Events.CONTENT_URI) .putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, beginTime.getTimeInMillis()) .putExtra(CalendarContract.EXTRA_EVENT_END_TIME, endTime.getTimeInMillis()) .putExtra(Events.TITLE, "Yoga") .putExtra(Events.DESCRIPTION, "Group class") .putExtra(Events.EVENT_LOCATION, "The gym") .putExtra(Events.AVAILABILITY, Events.AVAILABILITY_BUSY) .putExtra(Intent.EXTRA_EMAIL, "rowan@example.com,trevor@example.com"); startActivity(intent);

Is it possible to adapt the code in the link above, in order to create an event in Google Calendar using Processing for android, or use some other method and if so, how?

This thread is somewhat similar to this one: forum.processing.org/two/discussion/18459/using-the-google-calendar-api/p1

can anyone help me to get game apk ?

$
0
0

can anyone help me to get game apk ?

FullScreen removed after soft keyboard use

$
0
0
Hello, my sketch runs in fullscreen (and orientation(landscape))and it's OK. But when I open a soft keyboard with:

void showSoftKeyboard() {
android.view.inputmethod.InputMethodManager imm = (android.view.inputmethod.InputMethodManager) getActivity().getSystemService(android.content.Context.INPUT_METHOD_SERVICE);
  imm.showSoftInput(getActivity().getCurrentFocus(), 0);
   }

void hideSoftKeyboard() {
android.view.inputmethod.InputMethodManager imm = (android.view.inputmethod.InputMethodManager) getActivity().getSystemService(android.content.Context.INPUT_METHOD_SERVICE);
  imm.hideSoftInputFromWindow(getActivity().getCurrentFocus().getWindowToken(), 0);
  deci=0;
   }

The fullscreen disappears and it's impossible to remove the task bar on the right of the screen.
Any idea?
Thanks in advance
Viewing all 941 articles
Browse latest View live