Here's a trivial test program that illustrates the problem. it "works" (ie; produces glitchy graphics)
on both real android devices and DuOS under windows.
package com.mycompany.myapp;
import com.codename1.io.Log;
import com.codename1.ui.Button;
import com.codename1.ui.Component;
import com.codename1.ui.Container;
import com.codename1.ui.Display;
import com.codename1.ui.FontImage;
import com.codename1.ui.Form;
import com.codename1.ui.Graphics;
import com.codename1.ui.Image;
import com.codename1.ui.Label;
import com.codename1.ui.animations.CommonTransitions;
import com.codename1.ui.events.ActionEvent;
import com.codename1.ui.events.ActionListener;
import com.codename1.ui.geom.Dimension;
import com.codename1.ui.layouts.BorderLayout;
import com.codename1.ui.layouts.BoxLayout;
import com.codename1.ui.layouts.FlowLayout;
import com.codename1.ui.layouts.LayeredLayout;
import com.codename1.ui.plaf.UIManager;
import com.codename1.ui.util.Resources;
import com.codename1.ui.util.UITimer;
import java.io.IOException;
class DisplayComponent extends Component
{ public Image fixed = null;
public Image front = null;
public void fillFixed()
{ int w = getWidth();
int h = getHeight();
Graphics g = fixed.getGraphics();
g.setColor(0xd0d0d0);
g.fillRect(0,0,w,h);
}
int frame = 0;
public Dimension getPreferredSize()
{ Container parent = getParent();
return(new Dimension(parent.getWidth(),parent.getHeight()));
}
public void fillFront()
{ int w = getWidth();
int h = getHeight();
frame++;
Graphics g = front.getGraphics();
g.drawImage(fixed,0,0);
g.setColor(0);
g.fillRect(w/3,0,w/4,h);
g.setColor(0xff);
g.drawLine(0,0,w,h);
g.setColor(0xff00);
g.drawString("Frame "+frame,w/2,h/2);
}
public void paint(Graphics g)
{ int w = getWidth();
int h = getHeight();
if(fixed==null) { fixed = Image.createImage(w,h); fillFixed(); }
if(front==null) { front = Image.createImage(w,h); fillFront(); }
if(front!=null)
{
g.drawImage(front,0,0);
// prepare the next frame
fillFront();
repaint();
}
}
}
public class MyApplication {
private Form current;
private Resources theme;
private DisplayComponent display = null;
public void init(Object context) {
theme = UIManager.initFirstTheme("/theme");
// Pro only feature, uncomment if you have a pro subscription
// Log.bindCrashProtection(true);
}
public void start() {
if (current != null) {
current.show();
return;
}
Form hi = new Form("Welcome", new BorderLayout(BorderLayout.CENTER_BEHAVIOR_CENTER_ABSOLUTE));
display = new DisplayComponent();
display.setVisible(true);
hi.add("Center",display);
hi.show();
}
public void stop() {
current = Display.getInstance().getCurrent();
}
public void destroy() {
}
}