I have got the code:
package com.finalyearproject.cookmefood;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ListView;
import android.widget.TextView;
public class SearchActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ListView recipes = (ListView)findViewById(R.id.recipes);
}
}
Which is giving me the error “id cannot be resolved”.
I have tried cleaning the project but that results in me creating errors in file which currently are fine.
My XML is:
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp" >
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="5dp">
<ListView
android:id="@+id/recipes"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:entries="@array.recipes"/>
</LinearLayout>
</FrameLayout>
</LinearLayout>
</TabHost>
Any help would be appreciated, where can I go from here?
@array.recipesin the xml should be@array/recipes.A simple typo like this will prevent your
Rclass from building meaning you can’t find any id’s or other resources.You should also make sure that you get the correct
Ras you are using bothandroid.Rand yourR