I am running a test on an app that someone provided me the code for, and I got everything going except my activity.java, it says R.layout.main and it says main can’t be resolved. Its declared, why won’t it detect it? Here it is below
Activity.java
package magic.test.namespace;
import android.R;
import android.app.Activity;
import android.os.Bundle;
public class SaytheMagicWordActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}
main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Button
android:id="@+id/bt_speak"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Speak"
/>
<TextView
android:id="@+id/tv_result"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text=""
/>
</LinearLayout>
Remove
import android.Rso it will look forR.layout.mainin your project instead ofandroid.R