我的目标是重写语言更改视图。我已成功分离并附加当前片段,但抽屉项目未翻译。我不要想要使用 View myView = (View)findViewById(R.id.my_view);
myView.invalidate();
,我已经尝试过:
Caused by: java.sql.SQLException: javax.resource.ResourceException: IJ000457: Unchecked throwable in managedConnectionReconnected() cl=org.jboss.jca.core.connectionmanager.listener.TxConnectionListener@14729cfa[state=NORMAL managed connection=org.jboss.jca.adapters.jdbc.local.LocalManagedConnection@6a370d1a connection handles=0 lastUse=1467805740289 trackByTx=false pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@7a5d9cca pool internal context=SemaphoreArrayListManagedConnectionPool@31c571ea[pool=CartaoDS] xaResource=LocalXAResourceImpl@11061a5f[connectionListener=14729cfa connectionManager=4b45c7aa warned=false currentXid=null] txSync=null]
at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:147)
at org.hibernate.service.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:141)
at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:281)
at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.obtainConnection(LogicalConnectionImpl.java:297)
... 175 more
Caused by: javax.resource.ResourceException: IJ000457: Unchecked throwable in managedConnectionReconnected() cl=org.jboss.jca.core.connectionmanager.listener.TxConnectionListener@14729cfa[state=NORMAL managed connection=org.jboss.jca.adapters.jdbc.local.LocalManagedConnection@6a370d1a connection handles=0 lastUse=1467805740289 trackByTx=false pool=org.jboss.jca.core.connectionmanager.pool.strategy.OnePool@7a5d9cca pool internal context=SemaphoreArrayListManagedConnectionPool@31c571ea[pool=CartaoDS] xaResource=LocalXAResourceImpl@11061a5f[connectionListener=14729cfa connectionManager=4b45c7aa warned=false currentXid=null] txSync=null]
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.reconnectManagedConnection(AbstractConnectionManager.java:604)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:467)
at org.jboss.jca.adapters.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:139)
... 178 more
Caused by: javax.resource.ResourceException: IJ000461: Could not enlist in transaction on entering meta-aware object
at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.managedConnectionReconnected(TxConnectionManagerImpl.java:474)
at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.reconnectManagedConnection(AbstractConnectionManager.java:599)
... 180 more
Caused by: javax.transaction.SystemException: IJ000356: Failed to enlist: java.lang.Throwable: Unabled to enlist resource, see the previous warnings. tx=TransactionImple < ac, BasicAction: 0:ffff0a0a0546:2fd05d09:577134fa:61c7a status: ActionStatus.ABORT_ONLY >
at org.jboss.jca.core.connectionmanager.listener.TxConnectionListener$TransactionSynchronization.checkEnlisted(TxConnectionListener.java:552)
at org.jboss.jca.core.connectionmanager.listener.TxConnectionListener.enlist(TxConnectionListener.java:282)
at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.managedConnectionReconnected(TxConnectionManagerImpl.java:467)
... 181 more
没有成功......
答案 0 :(得分:1)
我的建议是通过单个功能进行UI修改。并根据您的代码从onActivityCreated或onCreateView调用它。所以,现在只要你改变语言,只需调用该函数,它就会自动更新所有视图。
答案 1 :(得分:0)
使用以下配置更新AndroidManifest文件:
android:configChanges="locale"
在活动级别。这将触发:
onConfigurationChanged(Configuration newConfig)
您可以在代码中覆盖此方法并从那里刷新视图。有关详细信息,请查看at this link