JSON + Vector

Try to use com.adobe.derialization.JSON, but no Vector support: what is the best way to add it?

Kind regards

I was using adobe to encode/decode JSON serialization a vector.

I solved it by converting the vector of an array before encoding and the array to a vector after decoding.

Kind regards

Tags: BlackBerry Developers

Similar Questions

  • view the json data in the custom list field

    Hi, I did analysis json and I created the custom list field. Now, I want to display only the data analyzed in my custom list field. I'll post my analyzed data from json and here is the code for my custom list field
    data analyzed.
    I have THREE channels of json and I want to show content tittle and date in the list filed. I'll post the screenshot of my list.

    JSONArray jsnarry = new JSONArray(responce);
                System.out.println("\n--length----- "+jsnarry.length());
                //System.out.println("....................................................=");
                for (int i = 0; i < jsnarry.length(); i++){
    
                    JSONArray inerarray = jsnarry.getJSONArray(i);
                        //System.out.println("\n-inerarray-values----- "+inerarray.getString(i1));
                        String TITTLE = inerarray.getString(1);
                        String CONTENT = inerarray.getString(2);
                        String DATE = inerarray.getString(3);
                                                           System.out.println("TITTLE= "+TITTLE);
                        System.out.println("CONTENT= "+CONTENT);
                        System.out.println("DATE= "+DATE);
    
    }
    

    output

    [0.0] --length----- 2
    [0.0]
    [0.0] -innerarray-length----- 6
    
    [0.0] TITTLE= BJP State President Sanjay Tandon's visit to Amita Shukla's Home
    [0.0] CONTENT=  BJP President Chandigarh Sanjay Tandon at Amita Shukla's Home
    [0.0] DATE= 2013-01-04
    [0.0] ................................................
    [0.0] TITTLE= Sanjay Tandon at mahasamadhi of Satya Shri Sai baba.
    [0.0] CONTENT= BJP Chandigarh President, Sanjay Tandon mahasmadhi of Sri Satya Sai Baba.(Andhra Pradesh)
    [0.0] DATE= 2013-01-13
    

    and my custom list field

           super(NO_VERTICAL_SCROLL);
    
             String TITTLE="TITTLE";
             String CONTENT = "CONTENT";
             String DATE = "DATE";
    
             v.addElement(new ListRander(listThumb, TITTLE, CONTENT,DATE, navBar));
    
             myListView = new CustomListField(v){
    
                 protected boolean navigationClick(int status, int time) {
                     //Dialog.alert(" time in milisec :" + time);
                     return true;
                 }
             };
    

    CustomListField.java

    public class CustomListField extends ListField implements ListFieldCallback {
    
        private Vector _listData;
        private int _MAX_ROW_HEIGHT = 100;
    
        public CustomListField (Vector data) {
    
            _listData = data;
            setSize(_listData.size());
            setSearchable(true);
            setCallback(this);
            setRowHeight(_MAX_ROW_HEIGHT);
    
        }
    
        public int moveFocus (int amount, int status, int time) {
    
            this.invalidate(this.getSelectedIndex());
            return super.moveFocus(amount, status, time);
    
        }
    
        public void onFocus (int direction) {
    
            super.onFocus(direction);
    
        }
    
        protected void onUnFocus () {
    
            this.invalidate(this.getSelectedIndex());
    
        }
    
        public void refresh () {
    
            this.getManager().invalidate();
    
        }
    
        public void drawListRow (ListField listField, Graphics graphics, int index, int y, int w) {
    
            ListRander listRander = (ListRander)_listData.elementAt(index);
            graphics.setGlobalAlpha(255);
            graphics.setFont(Font.getDefault().getFontFamily().getFont(Font.PLAIN, 24));
            final int margin =5;
    
            final Bitmap thumb= listRander.getListThumb();
            final String listHeading = listRander.getListTitle();
            final String listDesc= listRander.getListDesc();
            final String listDesc2= listRander.getListDesc2();
            final Bitmap nevBar = listRander.getNavBar();
    
            //list border
            graphics.setColor(Color.BLACK);
            graphics.drawRect(0, y, w, _MAX_ROW_HEIGHT);
    
            graphics.drawBitmap(margin, y+margin+10, thumb.getWidth(), thumb.getHeight(), thumb, 0, 0);
    
            graphics.drawText(listHeading, 3*margin+thumb.getWidth(), y+margin);
            graphics.setColor(Color.BLACK);
    
            graphics.drawText(listDesc, 3*margin+thumb.getWidth(), y+ margin+30);
            graphics.drawText(listDesc2, 3*margin+thumb.getWidth(), y+ margin+60);
    
        }
    
        public Object get(ListField listField, int index) {
    
            String rowString = (String) _listData.elementAt(index);
            return rowString;
    
        }
    
        public int indexOfList (ListField listField, String prefix, int start) {
    
            for (Enumeration e = _listData.elements(); e.hasMoreElements(); ) {
    
                String rowString = (String) e.nextElement();
                if (rowString.startsWith(prefix)) {
    
                    return _listData.indexOf(rowString);
    
                }
    
            }
    
            return 0;
    
        }
    
        public int getPreferredWidth(ListField listField) {
    
            return 3 * listField.getRowHeight();
    
        }
    
    }
    

    Listrander.Java

    public class ListRander {}

    private bitmap listThumb = null;
    incognito bar Bitmap = null;
    private String listTitle = null;
    private String listDesc = null;
    private String listDesc2 = null;

    public ListRander (Bitmap listThumb, String listTitle, String listDesc, String listDesc2, Bitmap navBar) {}
    this.listDesc = listDesc;
    this.listDesc2 = listDesc2;
    this.listThumb = listThumb;
    this.listTitle = listTitle;
    this.navBar = bar navigation;
    }
    public getListThumb() {Bitmap image
    Return listThumb;
    }
    {} public void setListThumb (listThumb Bitmap)
    this.listThumb = listThumb;
    }
    public getNavBar() {Bitmap image
    return the navigation bar;
    }
    {} public void setNavBar (navigation bar of the Bitmap)
    this.navBar = bar navigation;
    }
    public String getListTitle() {}
    Return listTitle;
    }
    {} public void setListTitle (String listTitle)
    this.listTitle = listTitle;
    }
    public String getListDesc() {}
    Return listDesc;
    }
    {} public void setListDesc (String listDesc)
    this.listDesc = listDesc;
    }
    public String getListDesc2() {}
    Return listDesc2;
    }
    public void setListDesc2 (String listDesc2) {}
    this.listDesc2 = listDesc2;
    }
    }

    You seem to have two problems here and are confusing them.  You must break the problem into two parts

    (1) extract the data from the entry and create the objects you want to display

    2) display in a list, a set of objects.

    Let's get the sorted first premiera.

    I will suggest what to do here, but in practice, you might actually think about this yourself as part of the design phase of your application.  You should do this, not me, because then you will have all the information available.  At the present time, I have just what you said, which is not much.  So maybe what I'm telling you is not correct for your application.  Only you can decide that.  And be blunt here, you should have decided this before you start coding.  Do you want you could lead down the wrong path.  You must think of your application as a home - as the architect must design all the rooms, and how they will be built, before you start building the House.  You do not, then we are building the rooms on the fly.  Who knows if they will be fit at home?

    In this case, I think you need to create an object that represents each of the elements in the internal array of new data.  call this object

    NewsItem

    This object will have attributes, such as its title, content, date, the linked image and so on, each of whom have will get and set methods.  While you treat each inner element fetch you the associated entry and update the object.

    When you have finished the inner loop of processing, you now have a complete

    NewsItem

    Object, so you will add it to a collection, an array of NewsItem objects, call this _newsItems.  You will create it at the beginning - you know how many entries it takes because it is the number of entries in your outdoor table.

    So before you start to deal with JSON, create your table and the 'index' value of 0.

    Once you have created your Newsitem, add this in the table to the position 'index' and increment "index".

    And once you have analyzed all the JSON, you will have a complete picture.  This is part 1 finished!

    And note in your drawListRow, you are given a clue - that is the index in your tables in _newsItems.  So you can easily find which entry to view and display it correctly.  But it is part 2 and is a separate issue.

  • Unable to fill ListView with vector

    I'm using a sample I got on the internet to create a listfield

    that contains an image and the data contained in a vector.

    Data are obtained from a JSON array that is created from a script php accessing a mysql database.

    The problem is that the listfield poster not only any content, even if there are items in the table.

    This is the code I use to get the JSON array data :

    JSONArray items_array=job.getJSONArray("items");
                        for(int i=0;i
    

    The code for the ListFieldCallback:

    class MyListModel implements ListFieldCallback
           {
    
               private ListField _view;
               private int _defaultRowHeight=32;
               private int _defaultRowWidth=_defaultRowHeight;
               private int _txtImagePadding=5;
               private Bitmap _bitmap;
                private Vector _data;
               public MyListModel(ListField list,Vector data)
                     {
                         _view=new ListField();
                        _data=new Vector();
                         _data=MyScreen.data_vec;
                         _view=list;
                         list.setCallback(this);
                        // _view.setSize(_data.size());
                         _view.setRowHeight(_defaultRowHeight);
                         _bitmap=null;
    
                         //list.setSize(_data.size());                     
    
                         }
    
               public void drawListRow(ListField list,Graphics g,int index,int y,int w)
               {
                   Items itemToDraw=(Items)this.get(list,index);
                   String name=itemToDraw.getName();
                   g.drawText(name,_defaultRowWidth+_txtImagePadding,y,DrawStyle.LEADING|DrawStyle.ELLIPSIS,w-_defaultRowWidth-_txtImagePadding);
    
                   g.drawBitmap(0,y,_bitmap.getWidth(),_bitmap.getHeight(),_bitmap,0,0);
    
                   }
    

    The code for the method of success which must now fill listview:

    public void success(final Vector listboys)
            { 
    
              UiApplication.getApplication().invokeLater(new Runnable()
              {public void run()
              {
                 data_vec=new Vector();
              data_vec=listboys;
              Items it1=(Items)data_vec.elementAt(0);
              error("Vector Main Screen " +it1.getName());
                                 final MyListField myListView=new MyListField();
          final  MyListModel myListModel=new MyListModel(myListView,data_vec);
         myListView.addToContextMenu(myListModel.getAddMenuItem(0,0));
        myListView.addToContextMenu(myListModel.getRemoveMenuItem(0,0));
        myListView.addToContextMenu(myListModel.getModifyMenuItem(0,0));
        myListView.addToContextMenu(myListModel.getEraseMenuItem(0,0));
    
        {
            Manager vfm=getMainManager();
            vfm.add(myListView);
            vfm.add(new SeparatorField(SeparatorField.LINE_HORIZONTAL));
            setTitle("List Demo Title");
    
            }
    

    The listview is always empty. I don't see where data is passed to display. Whenever I call:

    list.setSize(_data.size());
    

    I always get a null pointer exception. How can I get the listview to display the data contained in the vector itemsholder. Thank you

    using images in a listfield is not difficult, to improve that worked for you.

    You can use drawBitmap to draw the image in the listfield.

  • I want to move the bookmarks to a no start Win disk (format jspn) to win 10 PC. The import dialog box wants html, not json format

    the motherboard on my old PC to WIn 7 has become damaged. I took the hard e drive: toward a new win 10 PC. I can find the Archives of bookmark on the old disk - files are in json format, but when I try to import the bookmarks file I can only find a way to import them into html format. How do I resolve this condition glare?

    If the file is in json format, then it replaces the current file.

    To open the bookmark, Manager press the ALT or F10 to rise
    the tool, then select bookmarks.
    Access key is < Control >(Mac = < Command >) < shift > B.

    Once the window is open, the top of the page, press the button
    Import and backup. Select export bookmarks to HTML and follow
    prompts and save it in a HTML file. Copy the file to another computer.
    Repeat the above instructions, BUT select Import Bookmarks in HTML,

    JSON files. Do as above, but select restore. The file must be in the
    Bookmarks backup folder.

  • All IT gurus out there who know Firefox... have lost the passwords saved when FF created a new profile and delete old files key3.dbf and logins.json profile.

    All IT gurus out there who know Firefox... have lost the passwords saved when FF created a new profile and delete old files key3.dbf and logins.json profile. Any ideas, anyone?

    So it's not a logins.json file?

    I see a signons3.txt file and a file signons.sqlite older, if you can try to see if you can import passwords stored in this file.

    You can force Firefox to re-import the passwords in the file signons.sqlite and regenerate the file logins.json with the following steps:

    • reset the signon.importedFromSqlite pref on the topic: config page by default via the context menu
    • Delete the logins.json file in the closed Firefox with Firefox profile folder

    When you restart Firefox, then you should have the pref signon.importedFromSqlite with the value set to true.
    You have passwords that are imported in the password manager, unless there were errors or signons.sqlite signons3.txt.

    You can open the topic: config page via the address bar.
    You can accept the warning and click on "I'll be careful" to continue.

    You can use this button to go to the current Firefox profile folder:

  • Is it possible to recover the logins.json.corrupt?

    Yesterday, I lost all my passwords after a bizarre episode (see https://support.mozilla.org/en-US/questions/1085073 and https://support.mozilla.org/en-US/questions/1085300 ). I have a file logins.json in the folder of my profile with any passwords, I was able to rebuild, and in the same folder is logins.json.corrupt (27K, 24740 characters according to the Texpad, but none of them visible - blank page). This response (https://support.mozilla.org/en-US/questions/1054932 ) - reset signon.importedFromSqlite, close FF, delete logins.json and re - open - did not work. But I have re-set 'value (user)' in signon.importedFromSqlite - maybe I should reset 'value '?

    Just checked - reset the value did not help either.

    COR - el said

    You can check if there are previous versions of the files logins.json and key3db.

    • Right click: properties > Previous Versions

    There is no way of knowing if you have a correct signons3.txt file.
    If it works, then you see the names in the password manager.
    Otherwise, you will see an error message or a blank password Manager window.

    Yes! Thank you 1 million. Get all of my passwords.

    For those who have found this answer: I opened my profiles, right-click on logins.json file, having consulted the "Previous Versions" property page He produced a list of three. In the list, right click on one of the last week, the option is useful that was 'copy '. Copied and pasted on the desktop, where logins.json recovered appeared. Then copied logins.json current profiles Safe Placez_ the (fair value), and then deleted the Profiles folder and replaced with the recovered version.

  • I'm trying to import and backup/restore/Choose file... / after backup correctly and I see the file, but there is no JSON extension. What can I do?

    I'm trying to import and backup/restore/Choose file... / after backup correctly and I see the file, but there is no JSON extension. What can I do?

    I backed up my favorites using 'import and backup/Backup' on an external HD, installed Windows 10 and went to restore my bookmarks and noticed the file named "Firefox bookmarks-2015-09-04"had no extension and does not work."

    Please advise! Thank you! Sincerely, s

    If you add the .json extension, it works then? Why people who design browsers or extensions them do create files with no extension name, in spite that these extension names are essential to make the files can be restored? I could never understand that.

  • Does not start, need more and more memory, then crashes. It is SOLVED by deleting DB, panacea.dat, foldertree.json CAUSE global messages: uknown

    As a user of Thunderbird long term (currently version 38.2.0 on Win7 x 86 US) today, I caught myself (negatively) by the following problem: at the launch at the start of Thunderbird, the window will appear last closed (and for a short while, I see my files, etc., as left behind, during the last closure of Thunderbird), but then it turns into State "Not responding" (nothing works). When we look in the Task Manager, I see that Thunderbird seizes more and more memory, before this date - after a few seconds - crashing. I really hope that for some help fast, if possible (I desperately need a solution for e-mail job well - ideally the one I had, i.e. Thunderbird with my settings).

    What I tried:
    -Uninstall Thunderbird and install it again (did not help)
    -Uninstall Thunderbird and install an older version (I tried 38.1.0, 38.0.2, and 31.8.0 - nothing has worked)
    -from Thunderbird in SafeMode (same problem)
    -from Thunderbird in safe mode of Windows (same problem)
    -from Thunderbird in offline mode (did not help)

    My main question to know how to solve this problem, includes questions such as
    ? Should I try to delete some files of Thunderbird and try again (which ones?)?
    ? Can I use a command line "tricks" to get Thunderbird started?
    Etc.

    Thanks for your help!

    I think I solved my problem: delete messages from global reach DB and panacea.dat foldertree.json helped - once Thunderbird started again interactively and now I can restore my data files/messages.

  • Is there a way to convert the compressed files jsonlz4 in json?

    Hi, is it possible to learn how to properly restore a session of bookmarks via the jsonlz4 file? Firefox lost all my favorites, and when you try to restore using the recovery with the latest jsonlz4 file session the process simply does not end, starts but after a few hours, is still running, with warnings of continuos scripts held or stopped responding. Is it possible to do this correctly? Or a tool to convert the jsonlz4 compressed into json, perhaps html.
    Thank you.

    Well gentlemen: I definitely gave up; whatever the reason, the issue is not resolved. I stay with the old bookmark html, necessarily.
    Thanks for jscher and co - ADR efforts and goodbye.

  • "Failed to process the backup file" - bookmarks JSON file

    I deleted my appdata files without thinking and then allowed my trash. When I opened firefox again all my favorites have disappeared. I used piriform recuva to find my deleted files and recover the backup JSON files 10 bookmark. When I try to restore my bookmarks, I get the message "failed to process the backup file". "Files are 95 KB in size, but when I open them with Notepad that they are empty, however, when you use the Restore tool, it is said ' elements of 480", which I assume is the amount of bookmarks, I had, which means that firefox can see data. The same happens for all ten backups that I recovered.

    Any help would be appreciated.

    What is the name of this file?

    Firefox can only look at the file name for the number of items.

    • < number > _ < hash > .json bookmark-YYYY-MM-JJ_

    The files in the bookmarkbackups folder are currently in compressed format .jsonlz4 (i.e., they show data binary like a ZIP compressed archive) and cannot be easily unzipped for access the JSON text format.
    The files are compressed means that a single error in the file will make it impossible to unpack the file.

    Have you checked all the available JSON backup to see if everything works?

    A backup created manually JSON is always not compressed, so can be easily inspected or opened in a text editor (Notepad > "Pretty Print"), but with a compressed file, it is much more difficult.

    Recovery of a file via an undelete utility is no guarantee that the space occupied by the file has not been used by another file, and so is corrupt.

  • differences in the use of a backup Favorites file ".json" and a file of bookmarks '.html '.

    Hi all
    What is the difference between the use of a backup Favorites file ".json" and a file of bookmarks ".html"? It seems that both of them do the same job. If this is the case, then why there are two options (.json and .html) to do the same job? If this isn't the case, then what is the reason for the availability of the two options and how are they different? Although I read the material, it didn't quite clear form me again. Please be so kind enough to elaborate on the question so that I can get a clear understanding of their good use (s).
    Thank you very much in advance for your time and skills

    Hello

    See questions/684284

  • Cannot import a brand book .json file (a file HTML BM or BM Chrome)

    Started FF with no plugins and he locked up tight when you try to import a json file has recently made my PC who died.
    Did the same thing with less desirable HTML bookmarks or import Chrome bookmarks.

    This behavior of shit years and followed me across 5 or 6 PC...

    In a similar thread a year or two there, after much back and forth, the user has finished by reports that finally restored Firefox bookmarks successfully and unlock after being greeted a long period of time to complete the operation.

    I don't know how long you let go but maybe give it 10 minutes and see if that helps? You can open the task manager of Windows 7 (Ctrl + Shift + Esc) in the processes tab, monitor that Firefox is active or dead.

  • How can I recharge my favorites if I can't find the file "date.json" in my backup?

    My hard drive crashed and everything had to be recovered and reinstalled. I have a data folder Firefox but can not find the file "date.json" which is indicated to open the troubleshooting instructions. Y at - it another option?

    Hello

    If you have the latest version of Firefox, the file places.sqlite is what keeps your bookmarks. See the article for recovery of data from an old profile for more information.

  • Vector art &amp; culture in pictures

    I imported a vector (.ai) file in the photos. It retains the .ai suffix, but it seems to have been converted into a raster format when it is placed in a photo book. What format does get converted to (PNG, JPEG, etc.)?

    And why Photos automatically crop the image? The Options allow you to zoom in the image, but it does not zoom out so the entire image is visible in the image on the page of the book.

    Photos Version 1.5 (370.42.0)

    iMac 27 "late 2009

    OS X El Cap

    Probably JPEG - I only did this so am not positive - in the book in most of the themes you can right click on the placed image and select adjust the framework in the case that you placed another photo of ratio in a 4:3 photo frame

    LN

  • I want to restore my favorites but cannot find the .json file in my backup time machine.

    In fact, I can't find any folder named "Firefox" in the "Application support" folder backup library. It could be somewhere else? Thank you very much.

    I managed to get my favorites! OSX Lion automatically hide certain folders, also on the backup drive. Follow these steps to display hidden files: http://www.macworld.com/article/1051830/showallfinder.html. Copy and paste the last json in the bookmarksbackup folder (which is now visible) file on your desktop and replace it.

Maybe you are looking for