Ok, its been ALOT of work getting to this point so its a extremely disappointing when you finally get the signed apk installed on your phone and it force closes saying "unfortunately <myapp> has stopped".
When I click on "run on device" in the processing IDE, everything works like a charm. So I thought.... time to try and get the signed apk.
I followed these instructions for creating a signed apk (with great difficulty! I might add).
Initially I had java jdk 7 installed but the signed apk produced refused to install on the phone at all....
so I googled and after a couple of hours found a solution; downgrade java jdk from 7 to 6.
So I did that and everything worked as it was supposed to.... I had finally got my signed apk.
So I installed it on my phone and when I tried to run it, I got the error message "unfortunately <myapp> has stopped".
So I don't even know what question I should be asking except.... "what in the world do I do now?"
I guess the question might be.... what changes between "run on device" and "signed apk" that might cause it to not work anymore. I imagine there are LOADS of things :-s
There's no point spending months creating an app that only I can run. This might just be the one issue that puts me off programming altogether :-s
If I remove all the android stuff, this works in java mode and I can see the keys printed to the console, but when running in android mode, it just ignores all the key inputs.
So is there an android library I need to import in order to get the key inputs and is there an android method I need to call as well?
I checked the wiki but it only talks about how to get CODED inputs.
If by any chance it's not working because I'm using 2.0b6, could anyone specify how I might be able to get the inputs using only android methods?
Finally on a less important note; the keyboard doesn't show if I don't set the orientation. Also if I uncomment line 14 that says background(#FF0000); it doesnt show (Although this works fine a different program :-s).
Any help would be much appreciated as this is the final phase for my app to be app store ready!
Its a simple question but organising very large apps is not a trivial task.
I was just wondering if people had a better way to do it than what I do at the moment.
For example an app with a number of different pages such as home_screen, selection_screen etc etc;
void draw()
{
switch(pages)
{
case home_screen:
// draw the home screen gui
// check which buttons were pressed
// if selection_button was pressed, pages = selection_screen
break;
case: selection_screen:
// draw the selection screen gui
// do some more stuff here
break;
}
}
So that's basically the general arrangement and I have some functions, classes, & sections of code put into tabs and to make the app less disorganised.
This seems like the best way to me but I would like to hear other peoples methods to see if anyone has a better way.
My phone (xperia mini pro) is running android 2.3.7 and i tried it with ketai v9 (gingerbread 2.3.7)
The BluetoothCursors example didn't work so I tried to strip it down to the bare minimum for bluetooth to find out what was wrong (the code is shown below):
The program launches successfully on the phone without the line "bt = new KetaiBluetooth(this);"
But when I uncomment that line, it launches but force closes.
I also tried ketai v9 (mainline) for my galazy s3 running android 4.1.2 and its the same issue. Could anyone help with this please. Much appreciated.
Thanks.
import android.content.Intent;
import android.os.Bundle;
import ketai.net.bluetooth.*;
import ketai.net.*;
import oscP5.*;
KetaiBluetooth bt;
String msg = "inactive";
void setup()
{
orientation(PORTRAIT);
font = createFont("Courier", 15);
textFont(font);
}
void draw()
{
background(0);
fill(255);
text(msg, 10, height/2);
}
void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
// bt = new KetaiBluetooth(this); // ***********THIS IS THE PROBLEM!!!****
// msg="created bt object";
}
void onActivityResult(int requestCode, int resultCode, Intent data)
After some years of programming (lego nxt to arduino & now processing), I've realised (personally speaking) it's really just a waste of unless it's your job or you intend to make money from it somehow, because it's too stressful for a hobby!
Hence I'm hanging up my programming boots. However After receiving plenty of help from online forums, I realised I've never really given anything back, so I thought I'd post some processing code which i just finished recently.
There is a class for buttons called 'rectButtons' and a class for vertical scrolling text called 'rectText'.
The program also shows an example usage; when you run it, clicking on 'Button 1' sends you to the processing website, clicking on any of the small buttons at the lower and upper right of text box will scroll the text vertically.
I'll admit the code is not very pretty and it might be a bit difficult to follow but ah well, it works, considering I've only been using processing for just over a month or so.
It works fine in java mode but it's quite laggy in android mode. If someone wants to fix that or improve/tidy up the code in anyway, feel free, but please do post your improved code here so that others may benefit.
Any questions, just ask, n' I'll try to answer/help IF it's not too stressful.
Unfortunately some lines of code spilled over to the next line when i posted it on here so you may want to sort those out if you get errors.
test="This is some text that I am trying to use to test the scrollable text box class. This is gonna be completely anal and give me so much fooking stress I don't know why I am bothering!!! \n...update...\n it works!, it works!, it facking works biatches!!!";
//variable -b (or -ve of button number) indicates noFill() or noStroke()
// no name snColor nOpacity nFont nSize bColor bStroke bThick bOpacity bX bY bW bH bR hLight
I'm fairly new to processing (about 2 months) and I'm from a C/C++ background so I have no idea about java.
I think I've just about got to grips with all the basics & how to use most of the functions given in the reference, however every once in a while when perusing these forums I come across ALOT of things that aren't in the reference or learning topics. One of these is PApplet.
I understand creating a class that extends PApplet gives you access to the methods & members of PApplet which are 'hidden' but the question is;
where can I find the methods & functions of PApplet and more importantly is there a tutorial somewhere giving examples of why you might want to extend PApplet?
The main reason I'm interested in PApplet is because I would like to implement something like this (
https://forum.processing.org/topic/multiple-papplet-on-android) for creating multiple screens so that you can use the back button easily to go back to the previous screen in android mode + it just seems like a very elegant way to organise code. (or is there an easier way to do this?)
More questions;
Why extend PApplet, why not just create an object of PApplet and use the methods?
Where does this come from; '
gNotificationManager' which is on line 14 in the code (see above link). Unfortunately I can't remember some of the other 'alien' keywords & functions that I've found while looking through the forums but I'm guessing some of them are from pure java code? and maybe some from android sdk libraries? or even contributed libraries since people post snippets of code sometimes and not the full code.