Java Android stringToList:未定义类型 - guava
我正在开发 Android SDK-NDK,并且对以下代码片段有问题:
case ColorArray:
List<Color> lIdList = stringToList
( new Function<String, Color>()
{
public Color apply(String pSubValue)
{ return new Color(pSubValue);
}
},
lValue
);
break;
这是 Eclipse IDE 给出的 FC16 上的消息:
The method stringToList(new Function<String,Color>(){}, String) is undefined for the type StoreActivity
为了解决它,我已包含:
import com.google.common.base.Function;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.google.common.primitives.Ints;
import java.util.ArrayList;
import java.util.List;
我还添加了“guava-11.0.1.jar” ' 在项目中>属性> Java 构建路径 >图书馆。
但问题并没有消失。
高度赞赏所有意见和建议。
I am working on Android SDK-NDK and have a problem with the following piece of code:
case ColorArray:
List<Color> lIdList = stringToList
( new Function<String, Color>()
{
public Color apply(String pSubValue)
{ return new Color(pSubValue);
}
},
lValue
);
break;
This is the message on FC16 that Eclipse IDE gives:
The method stringToList(new Function<String,Color>(){}, String) is undefined for the type StoreActivity
To solve it, I have included:
import com.google.common.base.Function;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.google.common.primitives.Ints;
import java.util.ArrayList;
import java.util.List;
I have also added 'guava-11.0.1.jar' in Project > Properties > Java Build Path > Libraries.
But the problem doesn't go away.
All comments and suggestions are highly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
StoreActivity
类没有使用此签名定义的stringToList
方法 (stringToList(new Function(){}, String)
),是吗?Class
StoreActivity
doesn't havestringToList
method defined with this signature (stringToList(new Function<String,Color>(){}, String)
), does it?@Xaerxess 和 Louis Wasserman
你是对的。方法定义是让代码运行所缺少的。序列中定义了 stringToList 方法:
它解决了问题。感谢您提出的宝贵意见和意见。
@Xaerxess and Louis Wasserman
You are right. The method definition is what was missing to get the code running. In the sequence is the stringToList Method defined:
It solved the problem. Thanks for the valuable comments and remarks.