Hello
I am new to Android and I have completed my J2ME application (CIH)Control in Hand actually now I wish to port it on Android 4.0,4.0.3 in which main screen works like a list that show currently active device that connected now pl tell me some one that how i can port it to Android i bind the UI source code J2ME here pl guide me how it can be possible for me..
package com.testing;
import com.sun.lwuit.Component;
import com.sun.lwuit.Container;
import com.sun.lwuit.geom.Dimension;
import com.sun.lwuit.Font;
import com.sun.lwuit.Label;
import com.sun.lwuit.List;
import com.sun.lwuit.layouts.BorderLayout;
import com.sun.lwuit.layouts.BoxLayout;
import com.sun.lwuit.list.ListCellRenderer;
import com.sun.lwuit.plaf.Border;
import com.sun.lwuit.table.TableLayout;
import com.sun.lwuit.TextArea;
public class ContactsRenderer extends Container implements ListCellRenderer {
//private Label upperText = new Label("");///////for Device ID
private Label SwitchID = new Label("");
private Label lowerText = new Label("");
private Label deviceID = new Label("");
private Label pic = new Label(""); //////for main Picture
private Label pic2 = new Label("");
private Label pic3 = new Label("");
//private Label Rmk = new Label("");//////for remarks
private Label focus = new Label("");
//private Label SwitchName = new Label("");
private TextArea txtDev = new TextArea();
public ContactsRenderer() {
setLayout(new BorderLayout());
pic.setPreferredSize(new Dimension(43,63));
//pic2.setPreferredSize(new Dimension(26,26));
//pic3.setPreferredSize(new Dimension(28,26));
pic.setAlignment(Label.LEFT);
pic.getStyle().setBgTransparency(0);
pic2.getStyle().setBgTransparency(0);
pic3.getStyle().setBgTransparency(0);
addComponent(BorderLayout.WEST, pic);
TableLayout tblLayout = new TableLayout(2,2);
Container Chcnt = new Container(tblLayout);
Container cnt = new Container(new BoxLayout(BoxLayout.Y_AXIS));
lowerText.getStyle().setBgTransparency(0);
lowerText.getStyle().setFont(Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_LARGE));
lowerText.setAlignment(Label.LEFT);
txtDev.getStyle().setBgTransparency(0);
txtDev.getStyle().setFont(Font.createSystemFont(Font.FACE_SYSTEM, Font.STYLE_PLAIN, Font.SIZE_SMALL));
txtDev.getStyle().setBorder(Border.createEmpty());
txtDev.setAlignment(TextArea.LEFT);
//////this is for the table layout for the constraint on main screen
TableLayout.Constraint tblCnt = tblLayout.createConstraint();
tblCnt.setWidthPercentage(85);
Chcnt.addComponent(tblCnt,txtDev);
//tblCnt = tblLayout.createConstraint();
//tblCnt.setWidthPercentage(20);
Chcnt.addComponent(pic3);
tblCnt = tblLayout.createConstraint();
tblCnt.setWidthPercentage(85);
//tblCnt.setHeightPercentage(20);
Chcnt.addComponent(tblCnt,lowerText);
tblCnt = tblLayout.createConstraint();
tblCnt.setWidthPercentage(15);
Chcnt.addComponent(tblCnt,pic2);
cnt.addComponent(Chcnt);
addComponent(BorderLayout.CENTER, cnt);
focus.getStyle().setBgTransparency(100);
}
public Component getListCellRendererComponent(List list, Object value, int index, boolean isSelected) {
if(!( value instanceof ListItem))
throw new IllegalArgumentException("Value is not instance of ListItem");
ListItem item = (ListItem)value;
if (item.GetSwName()==null){
txtDev.setText(item.getText());
}
else{
txtDev.setText(item.getText());
String Msg = txtDev.getText();
Msg = Msg + " | " + item.GetSwName();
txtDev.setText(Msg);
}
if (item.getText2().equalsIgnoreCase("0N")){
lowerText.getStyle().setFgColor(0x308014);
}else{
lowerText.getStyle().setFgColor(0x000000);
}
//Rmk.setText(item.getPrc());
//txtDev.setText(item.getText());
SwitchID.setText(item.getswID());
lowerText.setText(item.getText2());
deviceID.setText(item.getText3());
pic.setIcon(item.getImg());
pic2.setIcon(item.getImg2());
pic2.getStyle().setBgTransparency(0);
pic3.setIcon(item.getImg3());
pic3.getStyle().setBgTransparency(0);
getStyle().setBorder(Border.createBevelRaised());
return this;
}
public Component getListFocusComponent(List list) {
return focus;
}
}