如何在android中存储arraylist中的注册表数据
我是android的初学者,分配任务。如何将以下数据存储在arraylist中并在另一个活动中显示为、、,,, 例如:沙菲 沙坡 密码 24如何在android中存储arraylist中的注册表数据,android,Android,我是android的初学者,分配任务。如何将以下数据存储在arraylist中并在另一个活动中显示为、、,,, 例如:沙菲 沙坡 密码 24 请参见下图并帮助我。您需要像这样使用intent传递数据 Intent intent = new Intent(Search.this, Details.class); intent.putExtra("cost", item.getCost()+""); startActivity(intent); 在另一个活动中,您可以使用get extra获取这些
请参见下图并帮助我。您需要像这样使用intent传递数据
Intent intent = new Intent(Search.this, Details.class);
intent.putExtra("cost", item.getCost()+"");
startActivity(intent);
在另一个活动中,您可以使用get extra获取这些值
Intent intent = getIntent();
String id = intent.getStringExtra("cost");
您需要像这样使用intent传递数据
Intent intent = new Intent(Search.this, Details.class);
intent.putExtra("cost", item.getCost()+"");
startActivity(intent);
在另一个活动中,您可以使用get extra获取这些值
Intent intent = getIntent();
String id = intent.getStringExtra("cost");
尝试使用共享首选项。
优势:
1.您可以检查用户是否已登录。
2.您可以在应用程序中的任何时间点检索这些数据。
3.您可以启用自动备份并包含共享首选项,以帮助您在用户从Google play的同一帐户重新安装应用程序时获取相同的数据。
还有更多
尝试使用共享首选项。
优势:
1.您可以检查用户是否已登录。
2.您可以在应用程序中的任何时间点检索这些数据。
3.您可以启用自动备份并包含共享首选项,以帮助您在用户从Google play的同一帐户重新安装应用程序时获取相同的数据。
还有更多
您可以使用intent将数据传递给其他活动:
String name,surname, pass, age;
name = edtName.getText().toString();
surname = edtSurname.getText().toString();
pass = edtPass.getText().toString();
age = edtAge.getText().toString();
Intent intent = new Intent(this, MainActivity.class);
intent.putExtra("name", name);
intent.putExtra("sname", surname);
intent.putExtra("pass", pass);
intent.putExtra("age", age);
startActivity(intent);
finish();
and in the mainActivity get like this:
Intent intent = getIntent();
String name = intent.getStringExtra("name");
String surname = intent.getStringExtra("surname");
您可以使用intent将数据传递给其他活动:
String name,surname, pass, age;
name = edtName.getText().toString();
surname = edtSurname.getText().toString();
pass = edtPass.getText().toString();
age = edtAge.getText().toString();
Intent intent = new Intent(this, MainActivity.class);
intent.putExtra("name", name);
intent.putExtra("sname", surname);
intent.putExtra("pass", pass);
intent.putExtra("age", age);
startActivity(intent);
finish();
and in the mainActivity get like this:
Intent intent = getIntent();
String name = intent.getStringExtra("name");
String surname = intent.getStringExtra("surname");
单击listener上的register按钮使用此代码
ArrayList al = new ArrayList();
// add elements to the array list
al.add(name, username,password,age);
//passing arraylist from MainActivity to Second Actiivty
Intent intent = new Intent(MainActivity.this, Second.class);
intent.putExtra("array_list", arr);
startActivity(intent);
要在第二个活动中获取数据,请使用
ArrayList<String> fetchList= new ArrayList<String>();
fetchList= getIntent().getStringArrayListExtra("array_list");
ArrayList fetchList=new ArrayList();
fetchList=getIntent().getStringArrayListExtra(“数组_列表”);
单击“侦听器”,在“注册”按钮上使用此代码
ArrayList al = new ArrayList();
// add elements to the array list
al.add(name, username,password,age);
//passing arraylist from MainActivity to Second Actiivty
Intent intent = new Intent(MainActivity.this, Second.class);
intent.putExtra("array_list", arr);
startActivity(intent);
要在第二个活动中获取数据,请使用
ArrayList<String> fetchList= new ArrayList<String>();
fetchList= getIntent().getStringArrayListExtra("array_list");
ArrayList fetchList=new ArrayList();
fetchList=getIntent().getStringArrayListExtra(“数组_列表”);
当我点击注册按钮时。数据应保存在数组列表中。我该怎么做。你的意思是当我点击寄存器按钮时,你想在数组列表中存储寄存器列表。数据应保存在数组列表中。我该怎么做呢?你的意思是要在数组列表中存储寄存器列表