1. Download the #1 Android News App:   EarlyBird - News for Android
    Dismiss Notice

call string value to url in android

Last Updated:

  1. krishnaveni

    krishnaveni Well-Known Member

    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.

    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) {
    Bundle b = getIntent().getExtras();
    mTitle = b.getString(KEY_SUBCATE);
    TextView grandtotal = (TextView) findViewById(R.id.subcate);
    grandtotal.setText("Welcome ," + mTitle );
    This is my url:

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

    But I have to change this url like:


    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
    grandtotal.setText("Welcome ," + mTitle );[/HIGH]its displayed mTitle value successfully.

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


  2. krishnaveni

    krishnaveni Well-Known Member

    i got the o/p.

    After changed my code like:
    String URL;
    mTitle = b.getString(KEY_SUBCATE);
    URL = "http://api1.afafafa.com/dev/categories/?fields=&categoryid="+mTitle+"&access_token=";

    I have declared mtitle first after that only have to declared URL.now i got the solution

Share This Page