i have in android string, , in string there url. iput string put.extra, because want give string 2. activity.
now in 2. activity want recive string , use url , in string, new/other string.
how can done this??
for myself did example can see under , when run app blank page in second activity! whats wrong in code??
code example:
activity string definition:
private static final string tag_purl = "url";
extra , new intent:
bundle bundle = new bundle (); bundle.putserializable(tag_purl, purl); // starting new intent intent postin = new intent(getapplicationcontext(), post.class); postin.putextras(bundle); startactivity(postin); } });
reciving extra:
intent postin = getintent(); bundle bundle = this.getintent().getextras(); string purl = (string) bundle.getserializable (tag_purl);
use of purl string in new string:
private static final string url = tag_purl ;
you can try if want:
private static final string tag_purl = "url"; intent = new intent(a.this, b.class); i.putextra("url", tag_purl); startactivity(i);
you can activity b like:
bundle extras = getintent().getextras(); string url= extras.getint("url");
Comments
Post a Comment