Ezio Ezio - 1 year ago 68
Android Question

Android Remote View not picking up the correct layout based on the language

I am developing an app which supports both English and Arabic languages. The app shows custom notifications to the user for which I am using remote views.I have added layouts for both english and arabic languages is respective layout resource files.

My problem is my app shows correct notifications when the app language is English but when I change the language to Arabic it is not picking up the arabic layout, it still shows the English layout.

FYI :- I am using a Service to show the notifications (because I need to make some network calls).

RemoteViews largeRemoteView = new RemoteViews(context.getPackageName(), R.layout.layout_new_download_notification);
RemoteViews smallRemoteView = new RemoteViews(context.getPackageName(), R.layout.layout_new_download_notification_small);

NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
Notification notification = builder.setSmallIcon(R.drawable.ic_launcher)
notificationManager.notify(mNotificationId, notification);

I have
in both layout and layout-ar files but android is not picking up the arabic layout on language change.

Thanks in advance

Answer Source

Changing the device language to the specific language did the trick

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download