Java 将动态数据存储到标签
我正在尝试开发我的第一个应用程序,但我需要一些帮助。 所以,要进入我的应用程序,你必须写下自己的用户名和密码登录。 我的应用程序在左边有一个滑动菜单,我使用jfeinstein10库。 现在,我想在这个菜单的第一行显示用户的用户名,这样你就知道这是一个动态字符串 这是我所在行的.xml代码:Java 将动态数据存储到标签,java,android,eclipse,login,sharedpreferences,Java,Android,Eclipse,Login,Sharedpreferences,我正在尝试开发我的第一个应用程序,但我需要一些帮助。 所以,要进入我的应用程序,你必须写下自己的用户名和密码登录。 我的应用程序在左边有一个滑动菜单,我使用jfeinstein10库。 现在,我想在这个菜单的第一行显示用户的用户名,这样你就知道这是一个动态字符串 这是我所在行的.xml代码: <item name="list_item_municipio_id" type="slidingmenu" /> <item name="list_item_municipio_labe
<item name="list_item_municipio_id" type="slidingmenu" />
<item name="list_item_municipio_label" type="slidingmenu">"Municipio"</item>
<item name="list_item_municipio_icon " type="slidingmenu">"@drawable/iconamunicipio"</item>
“市政”
“@drawable/iconamunicipio”
现在显示为“市政”,下面是一段代码,说明如何将信息保存到SharedReference
SharedPreferences settings = this.getActivity().getSharedPreferences("MyApp", 0);
SharedPreferences.Editor editor = settings.edit();
String user = "foobar";
editor.putString("user", user);
editor.commit();
感谢这段有用的代码,现在我想知道如何将这个字符串放在滑动菜单中我的行中。我必须使用.xml文件吗?或者什么?好吧,伙计,让我们来解释一下怎么做!:)
SharedPreferences settings = this.getActivity().getSharedPreferences("MyApp", 0);
SharedPreferences.Editor editor = settings.edit();
String user = "foobar";
editor.putString("user", user);
editor.commit();