0

I modified my code like follows according to what i understood from a stack overflow question i found

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

when i print the Final_url like this

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

the printed value is always

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

Is There Something I'm Missing ?

1 Answer 1

1

try with:

"http://****/get_items.php?keyword=%s";
Sign up to request clarification or add additional context in comments.

6 Comments

ah thanks , i modified as you suggested and removed this line of code String searchKey = getIntent().getStringExtra("2"); and inserted my Value Directly into this line Final_url = String.format(url, "myValue");
And are you sure that the value is not null?
Try putting this String searchKey = "SampleValue";, just to discard the value from the intent is null
somehow using the intent, the value becomes null
Great!. perhaps you can select my answer as the right answer :)
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.