Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ImageDescription extends MainScreen implements FieldChangeListener
- {
- VerticalFieldManager vertical,ver;
- HorizontalFieldManager hor;
- Font font = Font.getDefault().derive(Font.BOLD, 15);
- // private CommonFeedBean obj;
- private HorizontalFieldManager hr1;
- private LabelField label[];
- ResponseHandler_Review response = new ResponseHandler_Review();
- // private LabelField label1[];
- public Bitmap scaleBit[];
- public Bitmap bit[];
- // private BitmapField bit;
- public ImageDescription()
- {
- System.out.println("inside the ImageDescription Constructor");
- if(ResponseHandler_Review.vectorLocation1.size()==0){
- System.out.println("inside the No data availabel method");
- UiApplication.getUiApplication().invokeLater(new Runnable() {
- public void run() {
- Dialog.inform("No data available");
- }
- });
- System.out.println("outside the No data availabel method");
- }else{
- createGUI();
- System.out.println("goint into the createGUI method");
- }
- }
- public void createGUI()
- {
- System.out.println("inside the createGUI method");
- label = new LabelField[ResponseHandler_Review.vectorLocation1.size()];
- System.out.println("label Data"+label.toString());
- vertical = new VerticalFieldManager(VERTICAL_SCROLL|VERTICAL_SCROLLBAR){
- protected void sublayout(int maxWidth, int maxHeight) {
- super.sublayout(Display.getWidth(),Display.getHeight());
- setExtent(Display.getWidth(),Display.getHeight());
- }
- };
- System.out.println("after vertical field manager");
- vertical.setBackground(BackgroundFactory.createSolidBackground(0x95B9C7));
- ver = new VerticalFieldManager(VERTICAL_SCROLL|VERTICAL_SCROLLBAR);
- String arg1[];
- System.out.println("at second vertical field manager");
- System.out.println("vectorlocation size " +ResponseHandler_Review.vectorLocation1.size());
- arg1 = new String[ResponseHandler_Review.vectorLocation1.size()];
- for(int k = 0; k< ResponseHandler_Review.vectorLocation1.size(); k++){
- arg1[k] = String.valueOf(ResponseHandler_Review.vectorLocation1.elementAt(k));
- System.out.println("Vector element is "+k+" = "+arg1[k]);
- }
- for(int i=0;i<ResponseHandler_Review.vectorLocation1.size();i++)
- {
- System.out.println("inside the for loop");
- // obj = (CommonFeedBean) ResponseHandler_Review.vectorLocation1.elementAt(i);
- System.out.println("inside the obj++++++");
- hr1 = new HorizontalFieldManager(){
- protected void onFocus(int direction) {
- invalidate();
- super.onFocus(direction);
- }
- protected void onUnfocus() {
- invalidate();
- super.onUnfocus();
- }
- public void paint(Graphics graphics) {
- if (isFocus()) {
- graphics.setBackgroundColor(Color.WHITE);
- graphics.clear();
- }
- super.paint(graphics);
- }
- };
- String arg[] ;
- System.out.println("vectorlocation size " + ResponseHandler_Review.vectorLocation1.size());
- arg = new String[ResponseHandler_Review.vectorLocation1.size()];
- for(int j = 0; j< ResponseHandler_Review.vectorLocation1.size(); j++){
- arg[j] = String.valueOf(ResponseHandler_Review.vectorLocation1.elementAt(j));
- System.out.println("Vector element is "+j+" = "+arg[j]);
- bit[j] = response.getImage(arg[j]);
- scaleBit[j] = new Bitmap(162, 120);
- bit[j].scaleInto(scaleBit[j], Bitmap.FILTER_LANCZOS);
- hr1.add(new BitmapField(scaleBit[j]));
- }
- try{
- // label[i] = new LabelField(obj.getTitle(), Field.FIELD_VCENTER|Field.FOCUSABLE)
- // {
- // public int getPreferredWidth()
- // {
- // return Display.getWidth()-150;
- // }
- // protected boolean navigationClick(int status, int time) {
- // fieldChangeNotify(0);
- //// obj.getLink();
- // return true;
- //
- // }
- //
- // };
- // label[i].setFont(font);
- // label[i].setChangeListener(this);
- // label[i].setPadding(5, 5, 0, 5);
- //
- System.out.println("print all the labels++++++++++++"+label[i]);
- // hr1.add(label[i]);
- //
- ver.add(hr1);
- ver.add(new SeparatorField());
- }catch(Throwable e){
- System.out.println("not printing the label field ");
- System.out.println(e.toString());
- e.printStackTrace();
- }
- }
- vertical.add(ver);
- add(vertical);
- }
- public void fieldChanged(Field field, int context)
- {
- for(int i=0;i<ResponseHandler_Review.vectorLocation1.size();i++){
- if(field==label[i]){
- Dialog.inform("details"+i);
- }
- }
- }
- public boolean onClose() {
- UiApplication.getUiApplication().popScreen(UiApplication.getUiApplication().getActiveScreen());
- return true;
- }
Add Comment
Please, Sign In to add comment