• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps call string value to url in android

krishnaveni

Well-Known Member
Dec 16, 2011
158
0
chennai
i have develop one android application.

here i have to pass string value to url.please tell me how can i pass the string value to url.give me solution for these.

[HIGH]
String mTitle;

String URL = "http://api1.sfsfsffsf.com/dev/categories/?fields=&categoryid=" + mTitle + "&access_token=bfb787a";
static String KEY_CATEGORY = "category";
// public static final String URL_Address=null;
static final String KEY_TITLE = "categoryName";
static final String KEY_NAME ="categoryId";
static final String KEY_SUBCATE = "categoryId";
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.subcate);
Bundle b = getIntent().getExtras();
mTitle = b.getString(KEY_SUBCATE);
TextView grandtotal = (TextView) findViewById(R.id.subcate);
grandtotal.setText("Welcome ," + mTitle );
[/HIGH]
This is my url:
http://api1.sfsfsffsf.com/dev/categories/?fields=&categoryid=10&access_token=

I have mentioned directly **categoryid=10** means have disaplyed all product.

But I have to change this url like:

http://api1.sfsfsffsf.com/dev/categories/?fields=&categoryid="+mTitle+"&access_token=

Nw i have changed my url like categoryid="+mTitle+" means not displayed all products.

mTitle value is getting from my pervious activity.

whats wrong in my code.



my mTitle value is 10.i have to wrote the code like means
[HIGH]
grandtotal.setText("Welcome ," + mTitle );[/HIGH]its displayed mTitle value successfully.

[HIGH]grandtotal.setText("Welcome ," + URL );[/HIGH]means gave me null value

http://api1.sfsfsffsf.com/dev/categories/?fields=&categoryid=mTitle&access_token=
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones