活动开始。这些代码框架通过得很好。
// Initialize array adapters. One for already paired devices and
// one for newly discovered devices
mPairedDevicesArrayAdapter = new ArrayAdapter<String>(this, 0x7f060008);
mNewDevicesArrayAdapter = new ArrayAdapter<String>(this, 0x7f06000b);
// Find and set up the ListView for paired devices
ListView pairedListView = (ListView) findViewById(R.id.paired_devices);
pairedListView.setAdapter(mPairedDevicesArrayAdapter);
pairedListView.setOnItemClickListener(mDeviceClickListener);
构造函数顺利通过。应用程序崩溃并显示错误消息:
10-12 17:07:59.960: E/AndroidRuntime(11557): FATAL EXCEPTION: main
10-12 17:07:59.960: E/AndroidRuntime(11557): android.content.res.Resources $NotFoundException: Resource ID #0x7f060008 type #0x12 is not valid
XML资源文件如下:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/device_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_vertical|center_horizontal"
android:orientation="vertical" >
<EditText
android:id="@+id/xaccel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="fill_horizontal|center_vertical"
android:gravity="center_vertical|center_horizontal"
android:inputType="text"
android:text="@string/paired_devices" >
</EditText>
<ListView
android:id="@+id/paired_devices"
android:layout_width="match_parent"
android:layout_height="128dp"
android:layout_weight="0.04" >
</ListView>
<Button
android:id="@+id/button_scan"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/scanning" />
<EditText
android:id="@+id/title_new_devices"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical|center_horizontal"
android:inputType="text"
android:text="@string/other_available" >
</EditText>
<ListView
android:id="@+id/new_devices"
android:layout_width="match_parent"
android:layout_height="122dp"
android:layout_weight="0.70" >
</ListView>
</LinearLayout>
R.java如下:
package medynets.dmytro;
public final class R {
public static final class attr {
}
public static final class drawable {
public static final int ic_launcher=0x7f020000;
}
public static final class id {
public static final int BluCar=0x7f060000;
public static final int button_connect=0x7f060002;
public static final int button_forward=0x7f060004;
public static final int button_light=0x7f060003;
public static final int button_reverse=0x7f060005;
public static final int button_scan=0x7f060009;
public static final int device_list=0x7f060007;
public static final int new_devices=0x7f06000b;
public static final int paired_devices=0x7f060008;
public static final int textView1=0x7f060001;
public static final int title_new_devices=0x7f06000a;
public static final int xaccel=0x7f060006;
}
public static final class layout {
public static final int activity_blucar=0x7f030000;
public static final int device_list=0x7f030001;
}
public static final class string {
public static final int app_name=0x7f04000e;
public static final int bt_not_enabled_leaving=0x7f04000f;
public static final int connect=0x7f040003;
public static final int connected=0x7f040010;
public static final int device_list_activity=0x7f04000d;
public static final int devices=0x7f040012;
public static final int disconnected=0x7f040011;
public static final int forward=0x7f040005;
public static final int ledOFF=0x7f04000b;
public static final int ledON=0x7f04000a;
public static final int light=0x7f040004;
public static final int no_bt_device=0x7f04000c;
public static final int none_found=0x7f040008;
public static final int none_paired=0x7f040009;
public static final int other_available=0x7f040007;
public static final int paired_devices=0x7f040001;
public static final int reverse=0x7f040006;
public static final int scanning=0x7f040002;
public static final int select_device=0x7f040000;
}
public static final class style {
/**
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
backward-compatibility can go here.
*/
public static final int AppBaseTheme=0x7f050000;
/** Application theme.
All customizations that are NOT specific to a particular API-level can go here.
*/
public static final int AppTheme=0x7f050001;
}
}
请帮我。我不知道。我将根据您的要求发送任何其他信息。