Retrieving query parameters
suggest changepublic class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Intent intent = getIntent();
Uri data = intent.getData();
if (data != null) {
String param1 = data.getQueryParameter("param1");
String param2 = data.getQueryParameter("param2");
}
}
}
If the user clicks on a linkto http://www.example.com/map?param1=FOO¶m2=BAR
, then param1
here will have a value of "FOO"
and param2
will have a value of "BAR"
.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents