0

I have his following code:

public class MySimpleArrayAdapter extends ArrayAdapter {

@Override
public View getView(int position, View convertView, ViewGroup parent) {

    LayoutInflater inflater = (LayoutInflater) mContext
            .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

    View rowView = inflater.inflate(R.layout.todo_list, parent, false);

    TextView titleTextView = (TextView) rowView
            .findViewById(R.id.todo_row_title);
    TextView dateTextView = (TextView) rowView
            .findViewById(R.id.todo_row_date);
    ImageView imageView = (ImageView) rowView
            .findViewById(R.id.todo_row_image);

        titleTextView.setText(mTitles[position]);

..

}

and this content:

mTitles = [עברית, english, עברית]

meaning some strings in hebrew, and some in english

I run this on my physical device.

However in the UI is see only dates strings. How can I enable hebrew viewing?

Other apps on my mobile shows hebrew.

Elad Benda
  • 35,076
  • 87
  • 265
  • 471

1 Answers1

0

You will need an internationalization library to handle language conversions.

Gettext-Commons is a popular one, there are many others.

https://code.google.com/p/gettext-commons/

Here is an example that demonstrates how easy it is to use the Gettext Commons:

I18n i18n = I18nFactory.getI18n(getClass());
System.out.println(i18n.tr("This text will be translated"));
SnakeDoc
  • 13,611
  • 17
  • 65
  • 97
  • thanks, but viewing the other suggested questions-and-answer didn't mention any 3rd party lib. How come? – Elad Benda Sep 26 '13 at 15:03
  • I have not done any android yet, so maybe android includes something like this library built-in. In vanilla java, you'd have to either manually translate it all, or use something like this i18n implementation. – SnakeDoc Sep 26 '13 at 15:19