R cannot be resolved
package com.example.android_listview;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.app.Activity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.os.Build;
public class MainActivity extends Activity {
private ListView listView;
private ArrayAdapter<String>arr_adapter;
private SimpleAdapter simp_adapter;
private Object android;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
listView=(ListView) findViewById(R.id.listView);
//1.新建一个数据适配器
//ArrayAdapter(上下文,当前LisView加载的每一个列表项所对应的布局文件,数据源)
//2、适配器加载数据源
String[]arr_data={"慕课网1","慕课网2","慕课网3","慕课网4"};
arr_adapter=new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,data_object); //提示我R cannot be resolved....咋回事.?报错也是这行。
//3.视图(ListView)加载适配器
listView.setAdapter(arr_adapter);
}
}