HIII
我创建了一个我希望使用国际化的应用程序。但问题是我使用了一个由硬编码值组成的列表...因为列表包括药物,约会等,其形式为列表视图。
我想在以下代码的这一行中应用此国际化
String[] person = new String[] { "Encounter", "Medications","Weight","BloodPressure",
"BloodSugar","Lab and Test Results","Office Visit","Office Info","Data Analysis","Appointment","Allergy","Problem"};
如何对这些硬编码值使用国际化。请建议
Tab1.java
package com.example.app;
import java.util.ArrayList;
import java.util.Arrays;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.app.Activity;
import android.content.Intent;
public class Tab1 extends Activity
{
private ListView infoListView ;
private ArrayAdapter<String> listAdapter ;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tab1);
// Find the ListView resource.
infoListView = (ListView) findViewById( R.id.infoListView );
// Create and populate a List of planet names.
String[] person = new String[] { "Encounter", "Medications","Weight","BloodPressure",
"BloodSugar","Lab and Test Results","Office Visit","Office Info","Data Analysis","Appointment","Allergy","Problem"};
ArrayList<String> personList = new ArrayList<String>();
personList.addAll( Arrays.asList(person) );
// Create ArrayAdapter using the planet list.
listAdapter = new ArrayAdapter<String>(this, R.layout.inforow, personList);
// Set the ArrayAdapter as the ListView's adapter.
infoListView.setAdapter( listAdapter );
/* infoListView.setOnItemClickListener(new OnItemClickListener()
{
@Override
public void onItemClick(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
Intent i3=new Intent(Info.this,Call.class);
startActivity(i3);
}
});*/
infoListView.setOnItemClickListener(new AdapterView.OnItemClickListener()
{
@Override
public void onItemClick(AdapterView<?> arg0, View arg1,
int position, long arg3)
{
switch (position)
{
/*case :
Intent i1= new Intent (Tab1.this ,Person.class);
startActivity(i1);
break;*/
case 0 :
Intent i2 = new Intent (Tab1.this ,History.class);
startActivity(i2);
break;
case 1 :
Intent i3 = new Intent (Tab1.this , Medications.class);
startActivity(i3);
break;
case 2:
Intent i4 = new Intent (Tab1.this , Weight.class);
startActivity(i4);
break;
case 3:
Intent i5 = new Intent (Tab1.this , BloodPressure.class);
startActivity(i5);
break;
case 4:
Intent i6 = new Intent (Tab1.this , BloodSugar.class);
startActivity(i6);
break;
case 5:
Intent i7 = new Intent (Tab1.this , LabAndTestResults.class);
startActivity(i7);
break;
case 6:
Intent i8 = new Intent (Tab1.this , OfficeVisit.class);
startActivity(i8);
break;
case 7:
Intent i9 = new Intent (Tab1.this , Office_info_button.class);
startActivity(i9);
break;
case 8:
Intent i10 = new Intent (Tab1.this ,SimpleListActivity.class);
startActivity(i10);
break;
case 9:
Intent i11 = new Intent (Tab1.this ,Appointment1.class);
startActivity(i11);
break;
case 10:
Intent i12 = new Intent (Tab1.this ,Allergy.class);
startActivity(i12);
break;
case 11:
Intent i13 = new Intent (Tab1.this ,ProblemButton.class);
startActivity(i13);
break;
}
}
});
}
}
Tab1.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ListView android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/infoListView">
</ListView>
</LinearLayout>
请帮助......