get Strings from Resource - Android App

Android examples for App:Resource

Description

get Strings from Resource

Demo Code

/*******************************************************************************
 * Copyright (c) 2012 Vincenzo Marzano.// www  .j  a v a  2 s .  c  om
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Public License v3.0
 * which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/gpl.html
 * 
 * Contributors:
 *     Vincenzo Marzano - initial API and implementation
 ******************************************************************************/
//package com.java2s;

import android.content.Context;

public class Main {
    public static String getStrings(Context c, int... id) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < id.length; i++)
            sb.append(c.getResources().getString(id[i]) + " ");
        return sb.toString();
    }
}

Related Tutorials