私は次のようなレイアウトを持っています
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:gravity="center_vertical|center_horizontal"
android:orientation="horizontal" >
<EditText
android:id="@+id/et_OK"
android:layout_width="400dip"
android:layout_height="50dip"
android:layout_toRightOf="@id/tv_patientNOK"
android:background="@android:drawable/editbox_background" />
<Button
android:id="@+id/btn_show"
android:layout_width="100dip"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_gravity="center"
android:layout_toRightOf="@id/btn_Continue"
android:paddingLeft="5dip"
android:text="show" />
</LinearLayout>
コードは次のようになります
Button Show;
EditText et_OK;
String[] stringArray;
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState)
{
// define the Data
View view = inflater.inflate(
R.layout.searchmainscreen,
container,
false);
this.et_OK = ((EditText) view.findViewById(R.id.et_OK));
this.Show= (Button)view.findViewById(R.id.btn_show);
this.Show.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Select Color Mode");
ListView modeList = new ListView(this);
stringArray = new String[] { "Bright Mode", "Normal Mode" };
ArrayAdapter<String> modeAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, stringArray);
modeList.setAdapter(modeAdapter);
modeList.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
FillControl(position) ;
}});
builder.setView(modeList);
final Dialog dialog = builder.create();
dialog.show();
}
});
return view;
}
public void FillControl(int Postion)
{
/*
* TextView Result ;
Button Continue ;
Button Clear;
EditText
NOK ;
CheckBox Registered ;
// 1 regi
*
*
* */
Log.d(" the arrayaaaaaaaa"," the array is has "+ PatientSearchResult.size() + "With Postion" + Postion);
String test = stringArray[Postion] ;
et_OK.settext(test); // it crash here
}
}
それはエラーを発生させます
07-01 15:12:10.860: D/the arrayaaaaaaaa(32020): the array is has 18With Postion4
07-01 15:12:10.860: W/ResourceType(32020): No package identifier when getting value for resource number 0x00002736
07-01 15:12:10.860: D/AndroidRuntime(32020): Shutting down VM
07-01 15:12:10.860: W/dalvikvm(32020): threadid=1: thread exiting with uncaught exception (group=0x4023f760)
07-01 15:12:10.880: E/AndroidRuntime(32020): FATAL EXCEPTION: main
07-01 15:12:10.880: E/AndroidRuntime(32020): android.content.res.Resources$NotFoundException: String resource ID #0x2736
07-01 15:12:10.880: E/AndroidRuntime(32020): at android.content.res.Resources.getText(Resources.java:238)
07-01 15:12:10.880: E/AndroidRuntime(32020): at android.widget.TextView.setText(TextView.java:3229)
07-01 15:12:10.880: E/AndroidRuntime(32020): at com.appnetics.PatientSearch.FillControl(PatientSearch.java:336)
07-01 15:12:10.880: E/AndroidRuntime(32020): at com.appnetics.PatientSearch$3.onItemClick(PatientSearch.java:293)
07-01 15:12:10.880: E/AndroidRuntime(32020): at android.widget.AdapterView.performItemClick(AdapterView.java:282)
07-01 15:12:10.880: E/AndroidRuntime(32020): at android.widget.AbsListView.performItemClick(AbsListView.java:1148)
07-01 15:12:10.880: E/AndroidRuntime(32020): at android.widget.AbsListView$PerformClick.run(AbsListView.java:2643)
07-01 15:12:10.880: E/AndroidRuntime(32020): at android.widget.AbsListView.onTouchEvent(AbsListView.java:3466)
07-01 15:12:10.880: E/AndroidRuntime(32020): at android.widget.ListView.onTouchEvent(ListView.java:3805)
07-01 15:12:10.880: E/AndroidRuntime(32020): at android.view.View.dispatchTouchEvent(View.java:4640)
07-01 15:12:10.880: E/AndroidRuntime(32020): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1554)
07-01 15:12:10.880: E/AndroidRuntime(32020): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1320)
07-01 15:12:10.880: E/AndroidRuntime(32020): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
07-01 15:12:10.880: E/AndroidRuntime(32020): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
07-01 15:12:10.880: E/AndroidRuntime(32020): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
07-01 15:12:10.880: E/AndroidRuntime(32020): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
07-01 15:12:10.880: E/AndroidRuntime(32020): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
07-01 15:12:10.880: E/AndroidRuntime(32020): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
07-01 15:12:10.880: E/AndroidRuntime(32020): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
07-01 15:12:10.880: E/AndroidRuntime(32020): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
07-01 15:12:10.880: E/AndroidRuntime(32020): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
07-01 15:12:10.880: E/AndroidRuntime(32020): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
07-01 15:12:10.880: E/AndroidRuntime(32020): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
07-01 15:12:10.880: E/AndroidRuntime(32020): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
07-01 15:12:10.880: E/AndroidRuntime(32020): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1881)
07-01 15:12:10.880: E/AndroidRuntime(32020): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1296)
07-01 15:12:10.880: E/AndroidRuntime(32020): at android.app.Dialog.dispatchTouchEvent(Dialog.java:720)
07-01 15:12:10.880: E/AndroidRuntime(32020): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1854)
07-01 15:12:10.880: E/AndroidRuntime(32020): at android.view.View.dispatchPointerEvent(View.java:4708)
07-01 15:12:10.880: E/AndroidRuntime(32020): at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2448)
07-01 15:12:10.880: E/AndroidRuntime(32020): at android.view.ViewRoot.handleMessage(ViewRoot.java:2109)
07-01 15:12:10.880: E/AndroidRuntime(32020): at android.os.Handler.dispatchMessage(Handler.java:99)
07-01 15:12:10.880: E/AndroidRuntime(32020): at android.os.Looper.loop(Looper.java:132)
07-01 15:12:10.880: E/AndroidRuntime(32020): at android.app.ActivityThread.main(ActivityThread.java:4123)
07-01 15:12:10.880: E/AndroidRuntime(32020): at java.lang.reflect.Method.invokeNative(Native Method)
07-01 15:12:10.880: E/AndroidRuntime(32020): at java.lang.reflect.Method.invoke(Method.java:491)
07-01 15:12:10.880: E/AndroidRuntime(32020): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
07-01 15:12:10.880: E/AndroidRuntime(32020): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
07-01 15:12:10.880: E/AndroidRuntime(32020): at dalvik.system.NativeStart.main(Native Method)
07-01 15:17:16.430: I/Process(32020): Sending signal. PID: 32020 SIG: 9
07-01 15:17:20.440: D/CLIPBOARD(32199): Hide Clipboard dialog at Starting input: finished by someone else... !
07-01 15:17:31.575: D/dalvikvm(32199): GC_FOR_ALLOC freed 115K, 4% free 6655K/6919K, paused 20ms
07-01 15:17:37.000: D/dalvikvm(32199): GC_CONCURRENT freed 102K, 4% free 6938K/7175K, paused 2ms+3ms
07-01 15:17:37.940: D/EEEEEEEEEEEEEEEEEE(32199): Am here wanna play
07-01 15:17:38.130: D/the arrayaaaaaaaa(32199): the array is has 18
07-01 15:17:38.145: D/the arrayaaaaaaaa(32199): the array is has 18
07-01 15:17:38.145: D/EEEEEEEEEEEEEEEEEE(32199): 18
07-01 15:17:38.145: D/EEEEEEEEEEEEEEEEEE(32199): Am here wanna play 123
07-01 15:17:38.185: D/dalvikvm(32199): GC_FOR_ALLOC freed 367K, 8% free 6984K/7559K, paused 35ms
07-01 15:17:38.185: I/dalvikvm-heap(32199): Grow heap (frag case) to 7.379MB for 513744-byte allocation
07-01 15:17:38.215: D/dalvikvm(32199): GC_FOR_ALLOC freed <1K, 8% free 7485K/8071K, paused 17ms
07-01 15:17:38.275: D/dalvikvm(32199): GC_CONCURRENT freed 4K, 6% free 7605K/8071K, paused 1ms+2ms
07-01 15:17:39.625: D/the arrayaaaaaaaa(32199): the array is has 18With Postion3
07-01 15:17:39.625: W/ResourceType(32199): No package identifier when getting value for resource number 0x00002734
07-01 15:17:39.625: D/AndroidRuntime(32199): Shutting down VM
07-01 15:17:39.625: W/dalvikvm(32199): threadid=1: thread exiting with uncaught exception (group=0x4023f760)
07-01 15:17:39.645: E/AndroidRuntime(32199): FATAL EXCEPTION: main
07-01 15:17:39.645: E/AndroidRuntime(32199): android.content.res.Resources$NotFoundException: String resource ID #0x2734
07-01 15:17:39.645: E/AndroidRuntime(32199): at android.content.res.Resources.getText(Resources.java:238)
07-01 15:17:39.645: E/AndroidRuntime(32199): at android.widget.TextView.setText(TextView.java:3229)
07-01 15:17:39.645: E/AndroidRuntime(32199): at com.appnetics.PatientSearch.FillControl(PatientSearch.java:336)
07-01 15:17:39.645: E/AndroidRuntime(32199): at com.appnetics.PatientSearch$3.onItemClick(PatientSearch.java:293)
07-01 15:17:39.645: E/AndroidRuntime(32199): at android.widget.AdapterView.performItemClick(AdapterView.java:282)
07-01 15:17:39.645: E/AndroidRuntime(32199): at android.widget.AbsListView.performItemClick(AbsListView.java:1148)
07-01 15:17:39.645: E/AndroidRuntime(32199): at android.widget.AbsListView$PerformClick.run(AbsListView.java:2643)
07-01 15:17:39.645: E/AndroidRuntime(32199): at android.widget.AbsListView.onTouchEvent(AbsListView.java:3466)
07-01 15:17:39.645: E/AndroidRuntime(32199): at android.widget.ListView.onTouchEvent(ListView.java:3805)
07-01 15:17:39.645: E/AndroidRuntime(32199): at android.view.View.dispatchTouchEvent(View.java:4640)
07-01 15:17:39.645: E/AndroidRuntime(32199): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1554)
07-01 15:17:39.645: E/AndroidRuntime(32199): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1320)
07-01 15:17:39.645: E/AndroidRuntime(32199): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
07-01 15:17:39.645: E/AndroidRuntime(32199): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
07-01 15:17:39.645: E/AndroidRuntime(32199): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
07-01 15:17:39.645: E/AndroidRuntime(32199): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
07-01 15:17:39.645: E/AndroidRuntime(32199): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
07-01 15:17:39.645: E/AndroidRuntime(32199): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
07-01 15:17:39.645: E/AndroidRuntime(32199): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
07-01 15:17:39.645: E/AndroidRuntime(32199): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
07-01 15:17:39.645: E/AndroidRuntime(32199): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
07-01 15:17:39.645: E/AndroidRuntime(32199): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
07-01 15:17:39.645: E/AndroidRuntime(32199): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:1560)
07-01 15:17:39.645: E/AndroidRuntime(32199): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1333)
07-01 15:17:39.645: E/AndroidRuntime(32199): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1881)
07-01 15:17:39.645: E/AndroidRuntime(32199): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1296)
07-01 15:17:39.645: E/AndroidRuntime(32199): at android.app.Dialog.dispatchTouchEvent(Dialog.java:720)
07-01 15:17:39.645: E/AndroidRuntime(32199): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1854)
07-01 15:17:39.645: E/AndroidRuntime(32199): at android.view.View.dispatchPointerEvent(View.java:4708)
07-01 15:17:39.645: E/AndroidRuntime(32199): at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2448)
07-01 15:17:39.645: E/AndroidRuntime(32199): at android.view.ViewRoot.handleMessage(ViewRoot.java:2109)
07-01 15:17:39.645: E/AndroidRuntime(32199): at android.os.Handler.dispatchMessage(Handler.java:99)
07-01 15:17:39.645: E/AndroidRuntime(32199): at android.os.Looper.loop(Looper.java:132)
07-01 15:17:39.645: E/AndroidRuntime(32199): at android.app.ActivityThread.main(ActivityThread.java:4123)
07-01 15:17:39.645: E/AndroidRuntime(32199): at java.lang.reflect.Method.invokeNative(Native Method)
07-01 15:17:39.645: E/AndroidRuntime(32199): at java.lang.reflect.Method.invoke(Method.java:491)
07-01 15:17:39.645: E/AndroidRuntime(32199): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
07-01 15:17:39.645: E/AndroidRuntime(32199): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
07-01 15:17:39.645: E/AndroidRuntime(32199): at dalvik.system.NativeStart.main(Native Method)
それを修正する方法はありますか