我正面临着iOS的问题。
我有一个在Android上完美运行的应用程序。我为Android Debug构建它,当我尝试显示我的表单时,我得到了 IndexOutOfBoundsException
这是我的代码:
package com.idenovia.calendovia.form;
public class FichePro extends Form {
public static Site site;
public static Boolean isFavorite = false;
public static List<Performance> performances = new ArrayList<Performance>();
public static Long canContactTakeEvent;
public FichePro(final int idPro,final String searchWho, final List<Site> savedSites){
try {
Dialog ip = new InfiniteProgress().showInifiniteBlocking();
ip.getContentPane().getStyle().setBgTransparency(0, true);
ip.getContentPane().getComponentAt(0).getStyle().setBgTransparency(0, true);
Map<String,Object> result;
if(CalendoviaApp.isConnected ==1 && CalendoviaApp.customer.getId() != 0)
result = AccessSite.getSiteFromId(idPro,CalendoviaApp.customer.getId());
else
result = AccessSite.getSiteFromId(idPro,0);
if(result.containsKey("sites")){
site = (Site) result.get("sites");
}else{
site = null;
}
if(result.containsKey("performances")){
performances = (List<Performance>) result.get("performances");
}else{
performances = null;
}
if(result.containsKey("canContactTakeEvent")){
canContactTakeEvent = (Long) result.get("canContactTakeEvent");
}else{
canContactTakeEvent = null;
}
ip.dispose();
} catch (Exception e1) {
e1.printStackTrace();
}
/*
* Form theming and configuring
*/
if(site != null)
setTitle("Dr. "+site.getSiteYou().getShowname());
else{
SearchList searchList = new SearchList(searchWho,"",savedSites);
searchList.show();
}
Container content = new Container(new BoxLayout(BoxLayout.Y_AXIS));
content.setUIID("ctrContent");
setLayout(new BorderLayout());
setTransitionInAnimator(CommonTransitions.createFade(200));
final Font fnt = Font.createTrueTypeFont("CALENDOVIA_APP", "CALENDOVIA_APP.ttf");
Container ctrPhoto = new Container(new BorderLayout());
ctrPhoto.setUIID("ctrPhoto");
// try {
Image image = CalendoviaApp.res.getImage("placeholderProvider").scaled((int)(Display.getInstance().getDisplayWidth()*0.25),(int)(Display.getInstance().getDisplayWidth()*0.25));
for (Site favoris : CalendoviaApp.favorites) {
if(favoris.getId().equals(site.getId())){
isFavorite = true;
}
}
final CheckBox favButton2 = new CheckBox();
final Button favButton = new Button();
if(isFavorite){
favButton.setIcon(FontImage.createFixed("\ue900", fnt, 0x2995d0,(int)(Display.getInstance().getDisplayWidth()*0.2), (int)(Display.getInstance().getDisplayWidth()*0.2)));
}else{
favButton.setIcon(FontImage.createFixed("\ue931", fnt, 0x2995d0,(int)(Display.getInstance().getDisplayWidth()*0.2), (int)(Display.getInstance().getDisplayWidth()*0.2)));
}
favButton.setTextPosition(Component.BOTTOM);
favButton.getStyle().setBgTransparency(0,true);
favButton.getPressedStyle().setBgTransparency(0,true);
favButton.getDisabledStyle().setBgTransparency(0,true);
favButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
if(isFavorite){
do some stuff like seticon or network access
}else{
do some stuff too
}
}
});
ctrPhoto.add(BorderLayout.WEST, image);
ctrPhoto.add(BorderLayout.EAST, favButton);
Container ctrglobalInfosFichePro = new Container(new BoxLayout(BoxLayout.Y_AXIS));
ctrglobalInfosFichePro.setScrollVisible(false);
ctrglobalInfosFichePro.setScrollableY(true);
ctrglobalInfosFichePro.setUIID("ctrglobalInfosFichePro");
//First Part
Container ctrglobalInfosFirstPart = new Container(new BoxLayout(BoxLayout.Y_AXIS));
ctrglobalInfosFirstPart.setScrollableY(false);
ctrglobalInfosFirstPart.setUIID("ctrglobalInfosFirstPart");
Label lblProviderName = new Label("Dr "+site.getSiteYou().getShowname());
lblProviderName.setUIID("lblNameProvider");
ctrglobalInfosFichePro.add(lblProviderName);
try{
Label lblProviderSpe = new Label(new SectorConvert().getValue(site.getSiteYou().getSectorfirst().intValue()).toString());
lblProviderSpe.setUIID("lblSpeProvider");
ctrglobalInfosFichePro.add(lblProviderSpe);
}catch(Exception e){
} if(site.getSiteOption().getCbcard()||site.getSiteOption().getCheckp()||site.getSiteOption().getSpecies()){
Label lblPaiement = new Label("MOYENS DE PAIEMENT");
lblPaiement.setUIID("lblTitleForSpanLabel");
lblPaiement.setVerticalAlignment(Component.CENTER);
String acceptedPaiement ="";
if(site.getSiteOption().getCbcard()){
acceptedPaiement+=" CB /";
}
Label lblAcceptedPaiement = new Label(acceptedPaiement);
ctrglobalInfosFirstPart.add(lblPaiement);
ctrglobalInfosFirstPart.add(lblAcceptedPaiement);
}
//Second Part
Container ctrglobalInfosSecondPart= new Container(new BorderLayout());
if(site.getSiteYou().getPhonepro().trim().length() != 0){
ctrglobalInfosSecondPart.setUIID("ctrglobalInfosFirstPart");
Button btnAppeler = new Button("Appeler");
btnAppeler.setUIID("btnAppelerFichePro");
btnAppeler.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
Display.getInstance().dial(site.getSiteYou().getPhonepro());
}
});
ctrglobalInfosSecondPart.add(BorderLayout.EAST,btnAppeler);
}
ctrglobalInfosFichePro.add(ctrglobalInfosFirstPart);
ctrglobalInfosFichePro.add(ctrglobalInfosSecondPart);
content.add(ctrglobalInfosFichePro);
/*
* Building Form
*/
if(site.getCanaccess()){
Button btnTakeAppointement = new Button("");
btnTakeAppointement.setUIID("");
btnTakeAppointement.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
if(site.getNewcontactblocked()){
if(canContactTakeEvent != null && CalendoviaApp.isConnected==1 && CalendoviaApp.customer.getId() != 0){
switch(canContactTakeEvent.intValue()){
case 0:
FicheProCannotTakeEvent ficheProCannotTakeEvent = new FicheProCannotTakeEvent(site, canContactTakeEvent, savedSites, searchWho,true);
ficheProCannotTakeEvent.show();
break;
case 1:
FicheProRdvSelect ficheProRdvSelect = new FicheProRdvSelect(performances,site, savedSites, searchWho, null);
ficheProRdvSelect.show();
break;
[...]
default:
FicheProCannotTakeEvent ficheProCannotTakeEvent4 = new FicheProCannotTakeEvent(site, new Long(4), savedSites, searchWho,true);
ficheProCannotTakeEvent4.show();
break;
}
}else{
FicheProCannotTakeEvent ficheProCannotTakeEvent = new FicheProCannotTakeEvent(site, new Long(0), savedSites, searchWho,false);
ficheProCannotTakeEvent.show();
}
}
else{
FicheProRdvSelect ficheProRdvSelect = new FicheProRdvSelect(performances,site, savedSites, searchWho, null);
ficheProRdvSelect.show();
}
}
});
addComponent(BorderLayout.SOUTH,btnTakeAppointement);
}else{
Button btnParrainage = new Button("");
btnParrainage.setUIID("btnTakeRdvBig");
btnParrainage.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent evt) {
Parrainage parrainage = new Parrainage(site, getComponentForm());
parrainage.show();
}
});
addComponent(BorderLayout.SOUTH,btnParrainage);
}
addComponent(BorderLayout.NORTH, ctrPhoto);
addComponent(BorderLayout.CENTER, content);
}
}
我无法找到它发生的错误,为什么......
谢谢你的帮助