Don't Be negative
Don't Be negative

Reputation: 1215

How to pass dynamic data in intent from a qr code?

I am done a Qr code which have data like

url=www.google.com;type=T;location=xyz;company=aaa

or

url=www.google.com;
type=T;
location=5Q01;
company=SYS

or url=www.google.com|type=T|location=5Q01|company=SYS

and I have done reading QR with this tutorial in android.

so here I want to pass this data separately via intent

like url=www.google.com in one intent and type=T;location=xyz;company=aaa in other intent

but here this entire content I am getting in one rewtext format... can any one help me how to resolve..

Upvotes: 0

Views: 179

Answers (1)

kevz
kevz

Reputation: 2737

Well the response is in String format, you can simply split the string with ';' char and get a separate array which will serve your purpose.

String s = "url=www.google.com;type=T;location=xyz;company=aaa";
String sArray [] = s.split(";");

then -

sArray[0] = url=www.google.com
sArray[1] = type=T
sArray[2] = location=xyz
sArray[3] = company=aaa

Upvotes: 2

Related Questions