Cannot resolve Symbol variables - Tearing my hair out -
i trying follow tutorial , have got stuck figure last error before completion.
can tell me doing wrong these variables? including both activities below, if other code applicable, happy provide it.
error codes read: error:(21, 56) error: cannot find symbol variable pickupline error:(24, 9) error: cannot find symbol variable retrybutton error:execution failed task ':app:compiledebugjavawithjavac'.
compilation failed; see compiler error output details.
mainactivity.java:
package io.wavey.pickuplesson1; import android.content.intent; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.view.view; import android.widget.button; public class mainactivity extends appcompatactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); // grab clean button can stuff it! button cleanbutton = (button) findviewbyid(r.id.cleanbutton); final button dirtybutton = (button) findviewbyid(r.id.dirtybutton); final string pickupline = "you had me @ hello world"; //this callback. cleanbutton.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { sendline(pickupline); } }); } //send activity private void sendline(string pickupline) { intent intent = new intent(this, lineactivity.class); intent.putextra("pickup line", pickupline); startactivity(intent); } }
lineactivity.java:
@override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_line); bundle pickupdata = getintent().getextras(); if (pickupdata == null) { return; } string receivedpickupline = pickupdata.getstring("pickup line"); textview newline = (textview) findviewbyid(r.id.pickupline); newline.settext(receivedpickupline); retrybutton.setonclicklistener (new view.onclicklistener() { @override public void onclick(view v) { finish(); } }); } }
lineactivity.java:
Comments
Post a Comment