java - why does it not follow the if statement -
package com.example.firstapplication; import android.content.intent; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.view.viewgroup; import android.widget.textview; import static com.example.firstapplication.mainactivity.extra_message; public class displaymessageactivity extends appcompatactivity { @override protected void oncreate (bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_display_message); intent intent = getintent(); string message = intent.getstringextra(mainactivity.extra_message); if (extra_message.equals ("h")) { textview textview = new textview(this); textview.settextsize(40); textview.settext(message); viewgroup layout = (viewgroup) findviewbyid(r.id.activity_display_message); layout.addview(textview); }else { textview textview = new textview(this); textview.settextsize(4); textview.settext(message); viewgroup layout = (viewgroup) findviewbyid(r.id.activity_display_message); layout.addview(textview); } } }
if type in h on thing output should h in size 40 font , should work h, when type in h or else comes out in size 4, help, do
i think instead of extra_message, want check message string?
else can use debug mode in android studio know variables contains.
Comments
Post a Comment