我需要帮助AppConstant.PAYPAL,
我需要本地化之后的每一行中的以下java android应用程序的本地化部分
"Withdraw 10$ with PayPal / 10000 Credits"
到
getString(R.string.pay1)
我添加了
<string name="pay1">Withdraw 10$ with PayPal / 10000 Credits</string>
到我的strings.xml但它失败了
我想要
arr.add(new Reward("res.cloudinary.com/ddtivxyzk/image/upload/v1493349411/…;, AppConstant.PAYPAL, "Withdraw 10$ with PayPal / 10000 Credits", "10000", "10"));
就像:
arr.add(new Reward("res.cloudinary.com/ddtivxyzk/image/upload/v1493349411/…;, AppConstant.PAYPAL, getString(R.string.pay1), "10000", "10"));
但它不起作用
package com.earn.money.db;
import com.earn.money.constant.AppConstant;
import com.earn.money.model.Reward;
import java.util.ArrayList;
import java.util.List;
public class DataProvider {
public static List<Reward> getRewardList() {
ArrayList<Reward> arr = new ArrayList<>();
arr.add(new Reward("http://res.cloudinary.com/ddtivxyzk/image/upload/v1493349411/paypal_e1s9xf.png", AppConstant.PAYPAL, "Withdraw 10$ with PayPal / 10000 Credits", "10000", "10"));
arr.add(new Reward("http://res.cloudinary.com/ddtivxyzk/image/upload/v1493349411/paypal_e1s9xf.png", AppConstant.PAYPAL, "Withdraw 25$ with PayPal / 25000 Credits", "25000", "25"));
arr.add(new Reward("http://res.cloudinary.com/ddtivxyzk/image/upload/v1493349411/paypal_e1s9xf.png", AppConstant.PAYPAL, "Withdraw 50$ with PayPal / 50000 Credits", "50000", "50"));
arr.add(new Reward("http://res.cloudinary.com/ddtivxyzk/image/upload/v1493349714/googleplay_v8rwwu.png", AppConstant.GOOGLE_PLAY, "Gift Card 10$ with Google Play / 10000 Credits", "10000", "10"));
arr.add(new Reward("http://res.cloudinary.com/ddtivxyzk/image/upload/v1493349714/googleplay_v8rwwu.png", AppConstant.GOOGLE_PLAY, "Gift Card 25$ with Google Play / 25000 Credits", "25000", "25"));
arr.add(new Reward("http://res.cloudinary.com/ddtivxyzk/image/upload/v1493349714/googleplay_v8rwwu.png", AppConstant.GOOGLE_PLAY, "Gift Card 50$ with Google Play / 50000 Credits", "50000", "50"));
arr.add(new Reward("http://res.cloudinary.com/ddtivxyzk/image/upload/v1493349711/amazon_eelqab.png", AppConstant.AMAZON, "Gift Card 10$ with Amazon / 10000 Credits", "10000", "10"));
arr.add(new Reward("http://res.cloudinary.com/ddtivxyzk/image/upload/v1493349711/amazon_eelqab.png", AppConstant.AMAZON, "Gift Card 25$ with Amazon / 25000 Credits", "25000", "25"));
arr.add(new Reward("http://res.cloudinary.com/ddtivxyzk/image/upload/v1493349711/amazon_eelqab.png", AppConstant.AMAZON, "Gift Card 50$ with Amazon / 50000 Credits", "50000", "50"));
arr.add(new Reward("http://res.cloudinary.com/ddtivxyzk/image/upload/v1493349709/webmoney_jptfkw.jpg", AppConstant.WEBMONEY, "Withdraw 10$ with WebMoney / 10000 Credits", "10000", "10"));
arr.add(new Reward("http://res.cloudinary.com/ddtivxyzk/image/upload/v1493349709/webmoney_jptfkw.jpg", AppConstant.WEBMONEY, "Withdraw 25$ with WebMoney / 25000 Credits", "25000", "25"));
arr.add(new Reward("http://res.cloudinary.com/ddtivxyzk/image/upload/v1493349709/webmoney_jptfkw.jpg", AppConstant.WEBMONEY, "Withdraw 50$ with WebMoney / 50000 Credits", "50000", "50"));
return arr;
}
}
答案 0 :(得分:0)
你需要这个
context.getResources().getString(R.string.pay1)
但请显示您的错误日志。
答案 1 :(得分:0)
通过添加解决问题
import com.earn.money.R
到java文件
感谢所有回答我并试图帮助我的人