This is my code, this was compiled as a JAVA APPLICATION. What I want to create is an Android Application. I just want to ask if how will I convert this codes into codes so that when I compile it as ANDROID APPLICATION it will produce no error.
这是我的代码,这是作为JAVA APPLICATION编译的。我想要创建的是一个Android应用程序。我只是想问一下如何将这些代码转换为代码,这样当我将它编译为ANDROID APPLICATION时,它不会产生任何错误。
Can someone help me how to do this? Thank you
有人可以帮我怎么做?谢谢
Here is my code:
这是我的代码:
public class DouglasMain extends PApplet{
public static void main(String args[]) {
PApplet.main(new String[] { "--present", "com.RDP.rdp.DouglasMain" });
}
Vector path = new Vector();
public void setup(){
size(550,550);
smooth();
}
public void draw(){
background(255);
Tuple2f pt;
noFill();
strokeWeight(1);
beginShape();
for (int i=0; i < path.size(); i++)
{
pt = (Tuple2f)path.elementAt(i);vertex(pt.x,pt.y);
}
endShape();
strokeWeight(5);
beginShape(POINTS);
for (int i=0; i < path.size(); i++)
{
pt = (Tuple2f)path.elementAt(i);vertex(pt.x,pt.y);
}
endShape();
}
public void mousePressed(){
path = new Vector();
}
public void mouseDragged(){
path.add(new Tuple2f(mouseX, mouseY));
}
public void mousePressed1(){
//to simplify, get our points into an array of Tuple2f
if (path.size() > 1)
{
Tuple2f [] tmp = new Tuple2f[path.size()-1];
for (int i =0; i < path.size()-1; i++)
{
tmp[i] = (Tuple2f)path.elementAt(i+1);
}
path = new Vector();
path.addAll(Arrays.asList(DouglasPeuckerLineSimplifier.simplifyLine2D(5,tmp)));
}
}
}
1 个解决方案
#1
2
This is a good start: http://developer.android.com/resources/tutorials/hello-world.html
这是一个很好的开始:http://developer.android.com/resources/tutorials/hello-world.html
#1
2
This is a good start: http://developer.android.com/resources/tutorials/hello-world.html
这是一个很好的开始:http://developer.android.com/resources/tutorials/hello-world.html