I have developed a Blackberry application and running it on Simulator(9800) now what i want that it should also work for non touch device. Problem is when I tested on non touch simulator ie. 9780 the two component are missing
Please help me out. below is the code for my login screen.
public class JLoginScreen extends MyFramePageForLogin
{
public MyHttpConnectionClass myhttp=new MyHttpConnectionClass();
MyParser mypar=new MyParser();
private LabelField lblalreadymember,lblnotamember;//cotegories for exixtence
private LabelField lbllogin,lblpassword,rmtemp1,rmtemp2,rmtemp3,rmtemp4;
private CustomRoundBorderTextBoxField rblogin;
private CustomRoundBorderPasswordField rbpassword;
private LabelField linkforgetpwd;
private CustomButtonField cbflogin,cbfregisternow;
CheckboxField checkRemeberMe;
CheckboxField cbField;
int mCheckBoxesCount = 5;
public static String membername,person_fname,person_lname,address,
contactperson,mail,phone,mobile,membertitle,memberid;
private GridFieldManager gfmlogin;
private GridFieldManager gfmtxt;
private GridFieldManager hfmforgetlogin;
Font fontlistfield;
MyConnectionClass my_con=new MyConnectionClass();
MyFont myfont=new MyFont();
private int isVal=0;
public JLoginScreen()
{
lblalreadymember=new LabelField("Already A Member ?")
{
public void paint(Graphics g)
{
//g.setColor(0x585858);
super.paint(g);
}
};
lblalreadymember.setFont(myfont.headfont);
lblalreadymember.setMargin(10,0,0, 10);
//Login
lbllogin=new LabelField("Login",NON_FOCUSABLE)
{
public void paint(Graphics g)
{
g.setColor(0x585858);
super.paint(g);
}
};
lbllogin.setFont(myfont.boldfont);
lbllogin.setMargin(0,0,0,10);
lblpassword=new LabelField("Password")
{
public void paint(Graphics g)
{
g.setColor(0x585858);
super.paint(g);
}
};
lblpassword.setFont(myfont.boldfont);
linkforgetpwd=new LabelField("Forget Password?")
{
public void paint(Graphics g)
{
g.setColor(0x585858);
super.paint(g);
}
};
linkforgetpwd.setPadding(0,0, 0,5);
linkforgetpwd.setFont(myfont.contentdata);
rblogin=new CustomRoundBorderTextBoxField(200,25,3);
rblogin.setFont(myfont.contentdata);
rbpassword=new CustomRoundBorderPasswordField(200,25,3);
rbpassword.setFont(myfont.loginpassword);
//rbpassword.setPadding(5,0, 0,2);
rmtemp1=new LabelField("")
{
public void paint(Graphics g)
{
g.setColor(0x585858);
super.paint(g);
}
};
rmtemp2=new LabelField("")
{
public void paint(Graphics g)
{
g.setColor(0x585858);
super.paint(g);
}
};
rmtemp3=new LabelField("")
{
public void paint(Graphics g)
{
g.setColor(0x585858);
super.paint(g);
}
};
rmtemp4=new LabelField("")
{
public void paint(Graphics g)
{
g.setColor(0x585858);
super.paint(g);
}
};
checkRemeberMe = new CheckboxField("Remember Me", false)
{
public void paint(Graphics g)
{
g.setColor(0x585858);
super.paint(g);
}
};
checkRemeberMe.setPadding(0,0, 0,10);
checkRemeberMe.setFont(MyFont.contentdata);
//CustomButtonField For Login
cbflogin=new CustomButtonField(" Login ", Color.BLACK);
cbflogin.setPadding(0,0, 0, 200);
cbflogin.setFont(MyFont.contentdata);
cbflogin.setChangeListener(new FieldChangeListener()
{
public void fieldChanged(Field field, int context)
{
try
{
String url="http://www.jewelvicinity.com/pushmobile.aspx?cmdtype=LOGIN&email="+rblogin.getText()+"&pwd="+rbpassword.getText()+"";
String response =MyHttpConnectionClass.getPage(url);
String isActive =mypar.getWIGIBarcodeInfo(response,"<MemberActive>","</MemberActive>",14);
membername =mypar.getWIGIBarcodeInfo(response,"<MemberName>","</MemberName>",12);
person_fname =mypar.getWIGIBarcodeInfo(response,"<MemberPersonFName>","</MemberPersonFName>",19);
person_lname =mypar.getWIGIBarcodeInfo(response,"<MemberPersonLName>","</MemberPersonLName>",19);
membertitle=mypar.getWIGIBarcodeInfo(response,"<MemberTitle>","</MemberTitle>",13);
memberid=mypar.getWIGIBarcodeInfo(response,"<MemberID>","</MemberID>",10);
address =mypar.getWIGIBarcodeInfo(response,"<MemberAdd1>","</MemberAdd1>",12);
phone =mypar.getWIGIBarcodeInfo(response,"<MemberPhone1>","</MemberPhone1>",14);
mobile =mypar.getWIGIBarcodeInfo(response,"<MemberMobile>","</MemberMobile>",14);
mail =mypar.getWIGIBarcodeInfo(response,"<MemberEMail>","</MemberEMail>",13);
//boolean isActive=Boolean.isActive;
//Dialog.alert(""+response);
//Dialog.alert(""开发者_StackOverflow+memberid);
if(isVal==0)
{
if(isActive.equalsIgnoreCase("true"))
{
UiApplication.getUiApplication().pushScreen(new JSearchDiamondPage());
rblogin.setText("");
rbpassword.setText("");
Setting.setMemberID(memberid);
}
else
{
Dialog.alert("Enter correct user name and Password");
rblogin.setText("");
rbpassword.setText("");
rblogin.setFocus();
}
}
}
catch(Exception ex)
{
Dialog.alert(""+ex);
}
}
});
hfmforgetlogin =new GridFieldManager(3,2,1|GridFieldManager.NON_FOCUSABLE);
hfmforgetlogin.setPadding(0, 0, 0, 0);
hfmforgetlogin.setColumnProperty(0, GridFieldManager.FIXED_SIZE, 160);
hfmforgetlogin.setColumnProperty(1, GridFieldManager.FIXED_SIZE, 220);
hfmforgetlogin.add(rmtemp1);
hfmforgetlogin.add(rmtemp2);
hfmforgetlogin.add(checkRemeberMe,Field.NON_FOCUSABLE);
hfmforgetlogin.add(linkforgetpwd);
hfmforgetlogin.add(rmtemp3);
hfmforgetlogin.add(rmtemp4);
//hfmforgetlogin.add(cbflogin);
//Grid Field Manager
gfmlogin=new GridFieldManager(2,1,1|GridFieldManager.NON_FOCUSABLE);
gfmlogin.setRowProperty(0,GridFieldManager.FIXED_SIZE,30);
gfmlogin.setRowProperty(1,GridFieldManager.FIXED_SIZE,10);
gfmlogin.setPadding(10,0, 0, 10);
gfmlogin.setFont(myfont.contentdata);
//gfmlogin.nextFocus(2,1);
gfmlogin.add(lbllogin,GridFieldManager.FIELD_LEFT);
gfmlogin.add(lblpassword);
gfmtxt=new GridFieldManager(2,1,1|GridFieldManager.FOCUSABLE);
gfmtxt.setPadding(10,0, 0, 10);
gfmtxt.setFont(myfont.contentdata);
//gfmtxt.setFocus(67,97,);
gfmtxt.nextFocus(0,0);
gfmtxt.add(rblogin,FOCUSABLE);
gfmtxt.add(rbpassword,FOCUSABLE);
HorizontalFieldManager hfm=new HorizontalFieldManager();
hfm.setPadding(0,0,0,0);
hfm.add(gfmlogin);
hfm.add(gfmtxt);
MyFramePageForLogin.contentarea.add(lblalreadymember);
MyFramePageForLogin.contentarea.add(hfm);
MyFramePageForLogin.contentarea.add(hfmforgetlogin);
MyFramePageForLogin.contentarea.add(cbflogin);
/********************************************************/
//Adding line as image
BitmapField lineimg = new BitmapField(Bitmap.getBitmapResource("line.png"), BitmapField.LEFT);
lineimg.setPadding(20, 30, 10, 10);
MyFramePageForLogin.contentarea.add(lineimg);
/**************END of adding Line***********************/
lblnotamember=new LabelField("Not a Member ?")
{
public void paint(Graphics g)
{
//g.setColor(0x585858);
super.paint(g);
}
};
//lblnotamember.setPadding(Display.getHeight()/2+100,0,0,10);
lblnotamember.setFont(myfont.headfont);
lblnotamember.setPadding(10,10,10,10);
MyFramePageForLogin.contentarea.add(lblnotamember);//End
/******Adding Register Button**************/
/* ButtonField bf=new ButtonField("HEllo");
contentarea.add(bf);*/
cbfregisternow=new CustomButtonField(" Register Now", Color.CYAN);
cbfregisternow.setPadding(5,10,10,200);
cbfregisternow.setFont(MyFont.contentdata);
cbfregisternow.setChangeListener(new FieldChangeListener()
{
public void fieldChanged(Field field, int context)
{
//Dialog.alert("Mobile:"+umobile+",Created On:"+ucreated_on+",Active:"+uactive+",Paid"+umember_paid+",Appr"+umember_appr);
UiApplication.getUiApplication().pushScreen(new JNewRegistrationPage());
//UiApplication.getUiApplication().pushScreen(new JVendorDetailsPage(name1,person,address,phone,mobile,mail));
}
});
MyFramePageForLogin.contentarea.add(cbfregisternow);
rblogin.setFocus();
//setFocus();
}
protected boolean onSavePrompt()
{
return true;
}
}
in above code 2 components that are not displayed on non touch screen are
- rblogin
- rbpassword
this are the custom text fields.
The componenets rblogin and rbpassword as I see are custom made (ref : className - CustomRoundBorderTextBoxField )
The following could cause the problems that you are facing :
The class that CustomRoundBorderTextBoxField is extending might not be available in the OS 5.0 (9780 comes with two OS Versions 5.0 and 6.0 depending on the model)
The Fields might be misplaced due to screen sizes remember 9800 is 360x480 and 9780 is small size
One might forgot it to add to the screen :)
If the problem doesnt get solved still, leave a comment
Thanks Dheeraj Jami
精彩评论