Android Open Source - trivial-lists Category

From Project

Back to project page trivial-lists.


The source code is released under:

MIT License

If you think the Android project trivial-lists 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 org.hbabcock.triviallists;
/*from www  .  ja v a 2s .  c o m*/
import java.util.UUID;

import org.json.JSONException;
import org.json.JSONObject;

public class Category {
  private static final String JSON_ID = "id";
  private static final String JSON_NAME = "name";

  private UUID mId;
  private String mName;

  public Category(String name){
    mId = UUID.randomUUID();
    mName = name;
  public Category(JSONObject json) throws JSONException {
    mId = UUID.fromString(json.getString(JSON_ID));
    mName = json.getString(JSON_NAME);
  public UUID getId(){
    return mId;
  public String getName(){
    return mName;
  public void setName(String name){
    mName = name;
  public JSONObject toJSON() throws JSONException {
    JSONObject json = new JSONObject();
    json.put(JSON_ID, mId.toString());
    json.put(JSON_NAME, mName);
    return json;


Java Source Code List