Android Open Source - joanne Id List Coder






From Project

Back to project page joanne.

License

The source code is released under:

GNU General Public License

If you think the Android project joanne listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.gmail.altakey.joanne.util;
/*  w w w.  jav a2 s  .  c  o  m*/
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONTokener;

import java.util.HashSet;
import java.util.Set;

public class IdListCoder {
    public String encode(Set<Long> list) {
        final JSONArray array = new JSONArray();
        for (Long id : list) {
            array.put(id);
        }
        return array.toString();
    }

    public Set<Long> decode(final String data) {
        final Set<Long> ret = new HashSet<Long>();
        try {
            final JSONArray friends = (JSONArray)new JSONTokener(data).nextValue();
            for (int i=0; i<friends.length(); ++i) {
                try {
                    ret.add(friends.getLong(i));
                } catch (JSONException e) {
                }
            }
        } catch (final JSONException e) {
        } catch (final ClassCastException e) {
        }
        return ret;
    }
}




Java Source Code List

com.gmail.altakey.joanne.activity.MainActivity.java
com.gmail.altakey.joanne.activity.SettingsActivity.java
com.gmail.altakey.joanne.fragment.ProcessingDialog.java
com.gmail.altakey.joanne.fragment.WelcomeFragment.java
com.gmail.altakey.joanne.hack.ToastAnimationCanceler.java
com.gmail.altakey.joanne.service.TweetBroadcastService.java
com.gmail.altakey.joanne.service.TwitterAuthService.java
com.gmail.altakey.joanne.util.IdListCoder.java
com.gmail.altakey.joanne.util.UserRelation.java
com.gmail.altakey.joanne.view.OutlinedTextView.java
com.gmail.altakey.joanne.view.RadioProfile.java
com.gmail.altakey.joanne.view.Radio.java
com.gmail.altakey.joanne.view.TweetDisplayBuilder.java
com.gmail.altakey.joanne.view.TweetView.java