1
I have a question in creating an App.
I need to put the user profile photo in my Nav_header_tela_princial.
I already have a profile screen, but I need to use the same image of the user profile screen for my NAV.
The profile screen is working correctly, I can save the image, but I only need to use the same Uri on the other screen.
I haven’t been able to create any code yet because I have no idea what to research. I need a light on how to accomplish this.
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_settings);
Bundle bundle = new Bundle();
bundle.putString("foto", resultUri.toString());
Intent intent = new Intent(SettingsActivity.this, TelaPrincipalActivity.class);
intent.putExtras(bundle);
startActivity(intent);
edtNameField = (EditText) findViewById(R.id.edtName);
edtPhoneField = (EditText) findViewById(R.id.edtPhone);
imgProfileImage = (ImageView) findViewById(R.id.imgProfileImage);
btnBack = (Button) findViewById(R.id.btnBack);
btnConfirm = (Button) findViewById(R.id.btnConfirm);
mAuth = FirebaseAuth.getInstance();
userID = mAuth.getCurrentUser().getUid();
mCustomerDatabase = FirebaseDatabase.getInstance().getReference().child("Users").child(userID);
getUserInfo();
imgProfileImage.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_PICK);
intent.setType("image/*");
startActivityForResult(intent, 1);
}
});
This would be the Activity that should receive the data from Uri.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_tela_principal);
Intent intent = getIntent();
Bundle bundle = intent.getExtras();
String foto = bundle.getString("foto");
btnTest = (Button) findViewById(R.id.BtnTest);
btnTest.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
openBtnTest();
}
});
edtSearch = (TextView) findViewById(R.id.edtSearch);
edtSearch.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
search();
}
});
Your question is very shallow. Your doubt is how to recover the image? How to present it inside the
ImageView
?– LMaker
If it is for how to recover the image, you must specify where you are saving it. So, it is easier to help you
– LMaker