i want to check the text if it was arabic show the letter in the other text if it is for example was english or korean show the error message saying enter an arabic text but it shows the error message both ways if i write arabic or english or any other language and iam 100% sure about the letters i entered on the text matches the ascii on the if statment so what iam i doing wrong ??!!!
public class MainActivity extends Activity {
EditText te1;
EditText te2;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
te1 = (EditText) findViewById(R.id.t1);
te2 = (EditText) findViewById(R.id.t2);
final AlertDialog ad;
ad = new AlertDialog.Builder(this).create();
ad.setTitle("رسالة خطأ");
ad.setMessage("رجاء ادخل نص عربي ");
ad.setButton("موافق^_*", new DialogInterface.OnClickListener() {
@Override
public void onClick(final DialogInterface dialog, final int which) {
// TODO Auto-generated method stub
dialog.dismiss();
}
});
final Button v = (Button) findViewById(R.id.b1);
v.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
// imva.setImageResource(R.id.b1);
for ( int j = 0 ; j < te1.length() ; j++)
{
String l = te1.toString();
char coverLetter =l.charAt(j);
if ((coverLetter >= 1569) && (coverLetter <= 1594) || (coverLetter >= 1600) && (coverLetter<= 1610))
{
te2.setText("غ ");
}
else
{
ad.show();
}
}// for
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}