0

嗨,我在这里做一个应用程序,我需要在edittext中输入一些内容,单击按钮后的数据我需要保存在数据库中,到这里我的代码工作正常。但问题在另一个活动列表视图中,如果用户选择法语,我有 10 种语言,那个时候如果在edittext中输入数据那我需要以法语格式在编辑文本中写入数据并将数据保存在数据库中也是法语格式..或者用户选择印地语意味着我需要以印地语格式在编辑文本中写入数据和将数据保存在数据库中也是印地语格式。但在我的应用程序中,默认语言是英语,请问我该怎么做建议我...

   Language.class: 
   public class Language extends Activity {

 RelativeLayout main,sub;
public void setNoTitle() {
    requestWindowFeature(Window.FEATURE_NO_TITLE);
} 
 float screenHeight,screenWidth,screendensity;
 TextView heading;
 Button back;
 private ListView lv;
 private EditText et;
 private String listview_array[] = { "Arabic", "Dutch", "English", "French", "German",
 "Hindi", "Italian", "Japanese", "Portuguese", "Russian" };
 private ArrayList<String> array_sort= new ArrayList<String>();
 int textlength=0;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
     setNoTitle();
     getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
     DisplayMetrics displaymetrics = new DisplayMetrics();
     getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
     screenHeight = displaymetrics.heightPixels;
     screenWidth = displaymetrics.widthPixels;
     screendensity = displaymetrics.densityDpi;
    setContentView(R.layout.language);

      lv = (ListView) findViewById(R.id.ListView01);
         et = (EditText) findViewById(R.id.EditText01);
         lv.setAdapter(new ArrayAdapter<String>(this,
         android.R.layout.simple_list_item_1, listview_array));

         et.addTextChangedListener(new TextWatcher()
         {
         public void afterTextChanged(Editable s)
         {
                                                                         // Abstract Method of TextWatcher Interface.
         }
         public void beforeTextChanged(CharSequence s,
         int start, int count, int after)
         {
         // Abstract Method of TextWatcher Interface.
         }
         public void onTextChanged(CharSequence s,
         int start, int before, int count)
         {
         textlength = et.getText().length();
         array_sort.clear();
         for (int i = 0; i < listview_array.length; i++)
         {
         if (textlength <= listview_array[i].length())
         {
         if(et.getText().toString().equalsIgnoreCase(
         (String)
         listview_array[i].subSequence(0,
         textlength)))
         {
                                                                                                                         array_sort.add(listview_array[i]);
                                                                                                         }
                                                                                         }
                                                                         }
         lv.setAdapter(new ArrayAdapter<String>
         (Language.this,
         android.R.layout.simple_list_item_1, array_sort));
         }
         });

         lv.setOnItemClickListener(new OnItemClickListener() {

            public void onItemClick(AdapterView<?> arg0, View arg1,
                    int arg2, long arg3) {
                // TODO Auto-generated method stub

                String 


                if (language.equals("English US")) {

                } else if (language.equals("Francais")) {

                } else if (language.equals("Espanol")) {

                }
            }
        });
}
}
4

0 回答 0