Reputation: 31
hello hope you doing well
I have problem with passing data to another page idk why I'm sure of code so please can anyone help
this is my login code
myref2.addListenerForSingleValueEvent(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot snapshot) {
for (DataSnapshot ds1:snapshot.getChildren())
{
Donors a=ds1.getValue(Donors.class);
if(Ad_Email.getText().toString().equals(a.d_email)&& ad_pass.getText().toString().equals(a.d_pass))
{
flag=1;
break;
}
}
if(flag==0)
Toast.makeText(donor_login.this,"Invalid User",Toast.LENGTH_SHORT).show();
else
{
Intent intent = new Intent(getApplicationContext(),Donor_page.class);
intent.putExtra("email",Ad_Email.getText().toString());
startActivity(intent);
}
}
@Override
public void onCancelled(@NonNull DatabaseError error) {
}
});
i want pass the email in this page but when i run it the email not show idk why
donate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String email = getIntent().getStringExtra("email");
emaildonor.setText(email);
}
});
}
this error come in layout
2020-12-24 00:50:52.338 12910-13062/com.example.adopt_pet_app W/libEGL: EGLNativeWindowType 0xe16cd808 disconnect failed
2020-12-24 00:50:52.338 12910-13062/com.example.adopt_pet_app D/OpenGLRenderer: eglDestroySurface = 0xe37852a0, 0xe16cd800
2020-12-24 00:50:52.358 12910-12910/com.example.adopt_pet_app D/ViewRootImpl@cf4b434[donor_login]: Relayout returned: old=[0,0][1080,1920] new=[0,0][1080,1920] result=0x5 surface={false 0} changed=true
2020-12-24 00:50:52.360 12910-12910/com.example.adopt_pet_app D/ViewRootImpl@cf4b434[donor_login]: stopped(true) old=false
2020-12-24 00:52:51.008 12910-12910/com.example.adopt_pet_app D/InputMethodManager: prepareNavigationBarInfo() DecorView@c9ad26f[Donor_page]
2020-12-24 00:52:51.009 12910-12910/com.example.adopt_pet_app D/InputMethodManager: getNavigationBarColor() -855310
2020-12-24 00:52:51.009 12910-12910/com.example.adopt_pet_app V/InputMethodManager: Starting input: tba=com.example.adopt_pet_app ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
2020-12-24 00:52:51.010 12910-12910/com.example.adopt_pet_app D/InputMethodManager: startInputInner - Id : 0
2020-12-24 00:52:51.010 12910-12910/com.example.adopt_pet_app I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
2020-12-24 00:52:51.015 12910-12910/com.example.adopt_pet_app D/InputTransport: Input channel constructed: fd=76
2020-12-24 00:52:51.016 12910-12910/com.example.adopt_pet_app D/InputTransport: Input channel destroyed: fd=86
2020-12-24 00:52:51.545 12910-12910/com.example.adopt_pet_app D/ViewRootImpl@95dfa80[Donor_page]: stopped(true) old=false
2020-12-24 00:52:56.108 12910-13062/com.example.adopt_pet_app W/libEGL: EGLNativeWindowType 0xcf042808 disconnect failed
2020-12-24 00:52:56.109 12910-13062/com.example.adopt_pet_app D/OpenGLRenderer: eglDestroySurface = 0xe17af620, 0xcf042800
2020-12-24 00:52:56.140 12910-12910/com.example.adopt_pet_app D/ViewRootImpl@95dfa80[Donor_page]: Relayout returned: old=[0,0][1080,1920] new=[0,0][1080,1920] result=0x5 surface={false 0} changed=false
2020-12-24 00:52:56.141 12910-12910/com.example.adopt_pet_app D/ViewRootImpl@95dfa80[Donor_page]: MSG_WINDOW_FOCUS_CHANGED 0 1
2020-12-24 00:52:56.142 12910-12910/com.example.adopt_pet_app D/InputMethodManager: prepareNavigationBarInfo() DecorView@c9ad26f[Donor_page]
2020-12-24 00:52:56.142 12910-12910/com.example.adopt_pet_app D/InputMethodManager: getNavigationBarColor() -855310
2020-12-24 00:53:03.743 12910-12910/com.example.adopt_pet_app D/ViewRootImpl@95dfa80[Donor_page]: stopped(false) old=true
2020-12-24 00:53:03.769 12910-12910/com.example.adopt_pet_app D/ViewRootImpl@95dfa80[Donor_page]: stopped(false) old=false
2020-12-24 00:53:03.831 12910-12910/com.example.adopt_pet_app D/ViewRootImpl@95dfa80[Donor_page]: Relayout returned: old=[0,0][1080,1920] new=[0,0][1080,1920] result=0x7 surface={true 3782006784} changed=true
2020-12-24 00:53:03.838 12910-13062/com.example.adopt_pet_app D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000, [1080x1920]-format:1
2020-12-24 00:53:03.838 12910-13062/com.example.adopt_pet_app D/OpenGLRenderer: eglCreateWindowSurface = 0xe17af620, 0xe16cd808
2020-12-24 00:53:03.905 12910-12910/com.example.adopt_pet_app D/ViewRootImpl@95dfa80[Donor_page]: MSG_WINDOW_FOCUS_CHANGED 1 1
2020-12-24 00:53:03.905 12910-12910/com.example.adopt_pet_app D/InputMethodManager: prepareNavigationBarInfo() DecorView@c9ad26f[Donor_page]
2020-12-24 00:53:03.906 12910-12910/com.example.adopt_pet_app D/InputMethodManager: getNavigationBarColor() -855310
2020-12-24 00:53:03.918 12910-12910/com.example.adopt_pet_app D/InputMethodManager: prepareNavigationBarInfo() DecorView@c9ad26f[Donor_page]
2020-12-24 00:53:03.918 12910-12910/com.example.adopt_pet_app D/InputMethodManager: getNavigationBarColor() -855310
2020-12-24 00:53:03.918 12910-12910/com.example.adopt_pet_app V/InputMethodManager: Starting input: tba=com.example.adopt_pet_app ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
2020-12-24 00:53:03.919 12910-12910/com.example.adopt_pet_app D/InputMethodManager: startInputInner - Id : 0
2020-12-24 00:53:03.919 12910-12910/com.example.adopt_pet_app I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
2020-12-24 00:53:03.954 12910-12910/com.example.adopt_pet_app D/InputTransport: Input channel constructed: fd=78
2020-12-24 00:53:03.954 12910-12910/com.example.adopt_pet_app D/InputTransport: Input channel destroyed: fd=76
2020-12-24 00:53:05.609 12910-12910/com.example.adopt_pet_app D/ViewRootImpl@95dfa80[Donor_page]: MSG_WINDOW_FOCUS_CHANGED 0 1
2020-12-24 00:53:05.609 12910-12910/com.example.adopt_pet_app D/InputMethodManager: prepareNavigationBarInfo() DecorView@c9ad26f[Donor_page]
2020-12-24 00:53:05.609 12910-12910/com.example.adopt_pet_app D/InputMethodManager: getNavigationBarColor() -855310
2020-12-24 00:53:05.640 12910-12910/com.example.adopt_pet_app D/ViewRootImpl@95dfa80[Donor_page]: stopped(true) old=false
2020-12-24 00:53:05.673 12910-13062/com.example.adopt_pet_app W/libEGL: EGLNativeWindowType 0xe16cd808 disconnect failed
2020-12-24 00:53:05.673 12910-13062/com.example.adopt_pet_app D/OpenGLRenderer: eglDestroySurface = 0xe17af620, 0xe16cd800
2020-12-24 00:53:05.690 12910-12910/com.example.adopt_pet_app D/ViewRootImpl@95dfa80[Donor_page]: Relayout returned: old=[0,0][1080,1920] new=[0,0][1080,1920] result=0x5 surface={false 0} changed=true
2020-12-24 00:53:05.949 12910-12910/com.example.adopt_pet_app D/InputTransport: Input channel destroyed: fd=78
2020-12-24 00:53:06.494 12910-12910/com.example.adopt_pet_app D/ViewRootImpl@95dfa80[Donor_page]: Relayout returned: old=[0,0][1080,1920] new=[0,0][1080,1920] result=0x1 surface={false 0} changed=false
If any one can help i will be grateful.
Upvotes: 1
Views: 587
Reputation: 2538
You displayed email on OnClick of donate
button so it's will display when you click on donate
button. So call your email display code outside of OnClickListener
donate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
String email = getIntent().getStringExtra("email");
emaildonor.setText(email);
}
Upvotes: 0
Reputation: 230
You are getting data in wrong way you should do like this
donate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=getIntent();
String email =intent.getStringExtra("email");
emaildonor.setText(email);
}
});
or You shuuld get data in on Create
Intent intent=getIntent();
String email =intent.getStringExtra("email");
emaildonor.setText(email);
Upvotes: 0
Reputation: 390
Try this code below :
Bundle extras = getIntent().getExtras();
if (extras != null) {
String email = extras.getString("email");
emaildonor.setText(email);
}
Upvotes: 1