Back to project page calendar-contacts-shortcuts.
The source code is released under:
GNU General Public License
If you think the Android project calendar-contacts-shortcuts listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/* * Copyright (C) 2012 Dominik Schrmann <dominik@dominikschuermann.de> */* ww w .j a v a 2s . c o m*/ * This file is part of Shortcuts for Calendar/Contacts. * * Shortcuts for Calendar/Contacts is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Shortcuts for Calendar/Contacts is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Shortcuts for Calendar/Contacts. If not, see <http://www.gnu.org/licenses/>. * */ package org.shortcuts; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import android.content.Context; public class Utils { /** * Reads html files from /res/raw/example.html to output them as string. See * http://www.monocube.com/2011/02/08/android-tutorial-html-file-in-webview/ * * @param context * current context * @param resourceID * of html file to read * @return content of html file with formatting */ public static String readContentFromResource(Context context, int resourceID) { InputStream raw = context.getResources().openRawResource(resourceID); ByteArrayOutputStream stream = new ByteArrayOutputStream(); int i; try { i = raw.read(); while (i != -1) { stream.write(i); i = raw.read(); } raw.close(); } catch (IOException e) { e.printStackTrace(); } return stream.toString(); } }