我正在使用opensource OI ShoppingList模板并尝试从http://www.openintents.org/修改它。
有两个库和一个主项目,我正在尝试将库移动到主项目,即“OI ShoppingList”,但它在代码中给出了错误。
我设法移动其中一个没有问题“ShoppingListLibrary”。移动DistributionLibrary时没有问题,但是当我将布局文件(“oi_distribution_eula”,“oi_distribution_infoactivity”)移动到主项目3时,源文件就崩溃了。
任何想法,我应该改变,使这项工作到处搜索,但没有运气。
这是dropbox链接到源代码。 https://www.dropbox.com/s/iisqncajbbd9gel/ShoppingList-source-1.6%20not%20working.rar
提前致谢
edit1:感谢您的反馈。这是错误在setContentView(R.layout.oi_distribution_infoactivity)中的代码之一;
在布局下错误显示“布局无法解析或不是字段”
我尝试导入R类,清理项目但仍然有错误
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mDistribution.setFirst(MENU_DISTRIBUTION_START, DIALOG_DISTRIBUTION_START);
// Check whether EULA has been accepted
// or information about new version can be presented.
if (mDistribution.showEulaOrNewVersion()) {
return;
}
setContentView(R.layout.oi_distribution_infoactivity);
init();
mApplicationStrings = new String[mApplications.length];
for (int i = 0; i < mApplications.length; i++) {
mApplicationStrings[i] = getString(mApplications[i]);
}
setListAdapter(new FontArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, mApplicationStrings));
ListView listview = getListView();
listview.setOnItemClickListener(this);
// Set message of activity
String appname = VersionUtils.getApplicationName(this);
String message = getString(R.string.oi_distribution_info_activity_text,
appname);
TextView tv = (TextView) findViewById(R.id.text);
tv.setText(message);
/*
TypedArray a = obtainStyledAttributes(mTheme, R.styleable.ShoppingList);
String typefaceName = a.getString(R.styleable.ShoppingList_textTypeface);
mTextSizeMedium = a.getDimensionPixelOffset(R.styleable.ShoppingList_textSizeMedium, 23);
mTextSizeLarge = a.getDimensionPixelOffset(R.styleable.ShoppingList_textSizeLarge, 28);
mTextColor = a.getColor(R.styleable.ShoppingList_textColor, Color.BLACK);
Drawable background = a.getDrawable(R.styleable.ShoppingList_background);
View v = findViewById(R.id.background);
v.setBackgroundDrawable(background);
mTypeface = Typeface.createFromAsset(getResources().getAssets(), typefaceName);
TextView tv = (TextView) findViewById(R.id.text);
tv.setTypeface(mTypeface);
tv.setTextSize(mTextSizeMedium);
tv.setTextColor(mTextColor);
*/
}