简体   繁体   English

Android创建具有不同首选项的多个用户个人资料

[英]Android Create Multiple User Profiles with different Preferences

I'm trying to create a Profile Management wherein the user can have many profiles. 我正在尝试创建一个配置文件管理,其中用户可以具有许多配置文件。 For example there is a Profile named "Dad" which contains information about the father like his name, age and phone number which is saved using Preferences. 例如,有一个名为“ Dad”的配置文件,其中包含有关父亲的信息,如父亲的姓名,年龄和电话号码,该信息可使用“首选项”保存。 And then the user can add another User Profile like "Mom" which contains information about the mother but with similar preferences like father but different values by clicking "Add New Profile" button. 然后,用户可以通过单击“添加新配置文件”按钮来添加另一个用户配置文件,例如“妈妈”,其中包含有关母亲的信息,但具有类似的首选项,例如父亲,但具有不同的值。

Then on a different Activity, the user can select "Mother" or "Dad" on a spinner and the data regarding those will be displayed. 然后,在其他“活动”上,用户可以在微调器上选择“母亲”或“爸爸”,然后将显示有关这些母亲的数据。 This way the user won't have to change the preference every time he can just select the profile appropriate for him/her. 这样,用户不必每次都可以选择适合自己的配置文件时就不必更改首选项。

from what i understand is that you want to create like contacts list well you can use array like this Strinig arraystring[] and within the create new new profile button extend the array length : 据我了解,您想很好地创建联系人列表,可以使用像这样的Strinig arraystring[]数组,并在创建新的new profile按钮内扩展数组长度:

int i++;
int Intarray[];
String Stringarray[];
Stringarray = new String[i];
Stringarray[i] = StringName;
Intarray[i] = new int[i];
Intarray[i] = intage;
//and save/or send the arrays using bundle
//and the array number like dad number 1 textview.setText(stringarray[1]);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM