public class SelectProfileActivity extends AppCompatActivity implements ProfileAdapter.ProfileAdapterItemCallBack {
private List<Profile> Profiles;
private RecyclerView morral;
private GridLayoutManager correa;
private ProfileAdapter adapter;
private SharedPreferencesController spc;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
public void crearPerfil(View view){
Intent inten=new Intent(this,RegistrarPerfil.class);
startActivity(inten);
}
@Override
protected void onResume() {
super.onResume();
spc = new SharedPreferencesController(this);
setContentView(R.layout.activity_select_profile);
//la lista donde se agregaran los perfiles
Profiles = new ArrayList<Profile>();
//Consulta para obtener todos los perfiles
Profiles=App.getProfFromUser(spc.getPrefUID());
adapter = new ProfileAdapter(Profiles, this);
if (Profiles.isEmpty()){
App.showMessage("No se encontraron Perfiles",this);
}
else
{
//RecyclerView donde se van a mostrar los elementos
morral = (RecyclerView)findViewById(R.id.rv_all_profiles);
correa = new GridLayoutManager(this,3);
morral.setLayoutManager(correa);
morral.setAdapter(adapter);
}
}
@Override
public void onProfileItemSelected(Profile perfil) {
spc.saveProfile(perfil);
Intent inte = new Intent(this, CategoryActivity.class);
startActivity(inte);
finish();
}
}
答案 0 :(得分:0)
您的代码中出现了很多问题。