将变量添加到字符串 URL


Adding variable to String URL

>我根据我从我发现的堆栈溢出问题中理解的内容修改了我的代码,如下所示

private static final String url = "http://****/get_items.php?keyword=%1$s";
String searchKey = getIntent().getStringExtra("2");
        Final_url = String.format(url, searchKey);

当我像这样打印Final_url时

 Toast.makeText(getApplicationContext(),"url = "+ Final_url, Toast.LENGTH_SHORT).show();

打印值始终为

url = http://*****/get_items.php?keyword=null

我错过了什么吗?

尝试:

"http://****/get_items.php?keyword=%s";