Android Open Source - xkcd Comic






From Project

Back to project page xkcd.

License

The source code is released under:

Apache License

If you think the Android project xkcd 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.nightlynexus.xkcd;
//from   ww w .j a  v  a 2  s  . com
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Locale;

public class Comic {

    private final int num;
    private final String link;
    private final String news;
    private final String safeTitle;
    private final String title;
    private final String transcript;
    private final String alt;
    private final String img;
    private final String day;
    private final String month;
    private final String year;

    public Comic(int num, String link, String news, String safeTitle,
                 String title, String transcript, String alt, String img,
                 String day, String month, String year) {
        this.num = num;
        this.link = link;
        this.news = news;
        this.safeTitle = safeTitle;
        this.title = title;
        this.transcript = transcript;
        this.alt = alt;
        this.img = img;
        this.day = day;
        this.month = month;
        this.year = year;
    }

    public int getNum() {
        return num;
    }

    public String getLink() {
        return link;
    }

    public String getNews() {
        return news;
    }

    public String getSafeTitle() {
        return safeTitle;
    }

    public String getTitle() {
        return title;
    }

    public String getTranscript() {
        return transcript;
    }

    public String getAlt() {
        return alt;
    }

    public String getImg() {
        return img;
    }

    public String getDay() {
        return day;
    }

    public String getMonth() {
        return month;
    }

    public String getYear() {
        return year;
    }

    public String getDate() {
        try {
            final SimpleDateFormat format = new SimpleDateFormat("dd-MM-yyyy", Locale.US);
            final SimpleDateFormat df2 = new SimpleDateFormat("MMM dd, yyyy", Locale.US);
            return df2.format(format.parse(day + "-" + month + "-" + year));
        } catch (ParseException e) {
            return null;
        }
    }
}




Java Source Code List

com.nightlynexus.xkcd.ApplicationTest.java
com.nightlynexus.xkcd.ComicActivity.java
com.nightlynexus.xkcd.ComicFragment.java
com.nightlynexus.xkcd.ComicService.java
com.nightlynexus.xkcd.Comic.java