Tag Archives: Programming

Android development tricks

This is a summay of the tricks I have learned making an application called courseApp project.  This application was developed in the Mobile Information Systems that I took at University of Oslo. Eclipse is a very good tool to use for Android development. To start with you need to download Andriod SDK. After installing both of these(and ofcourse Java Development Kit, JDK which is a pre-requirement for both of these), you need to make Eclipse and Android SDK talk together. This is done by a plugin called “ADT plugin for Eclipse” from Google. You can read more about how to install this plugin by clicking hereIn case of Android SDK installation(the exe file) doesn’t recognize JDK on your computer, you can simply download the zip file and extract it. Don’t forget appending that folder to the %PATH% environment variable. Now some more tips follows :

Continue reading

Dashed line at Java/Processing

This code is a little bit edited and re-posted again from a post I found on Processing forum. Check the source at the bottom of the post for the original post.
[java]
import java.awt.*;

float[] dashes = { 16.0f, 8.0f, 4.0f, 8.0f };
BasicStroke pen;

void setup(){
size(400, 400);
noLoop();
pen = new BasicStroke(4.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER, 4.0f, dashes, 0.0f);
Graphics2D g2 = ((PGraphicsJava2D) g).g2;
g2.setStroke(pen);
}

void draw(){
line(0, 0, width, height);
line(0, height, width, 0);
}
[/java]
source : http://processing.org/discourse/yabb2/YaBB.pl?board=Syntax;action=display;num=1217445670

Processing & Arrow keys

Although in the Processing API it is mentioned that key returns the value of the pressed key, but when it comes to arrows it just returns question mark !!! The magic is to use keyCode :-)

[java]
void keyPressed(){
//print(keyCode);
if (keyCode == RIGHT){
//GO RIGHT
}
else if (keyCode == LEFT){
//GO LEFT
}
<div>else if (keyCode == UP){</div>
<div>//GO UP</div>
<div>}</div>
<div>else if (keyCode == DOWN){</div>
<div>//GO DOWN</div>
<div>}</div>
}//end of keyPressed

[/java]