1. Check out our companion app, Forums for Android! Download from Google Play

call string value to url in android

Discussion in 'Application Development' started by krishnaveni, Dec 28, 2012.

  1. krishnaveni

    krishnaveni Well-Known Member
    Thread Starter
    55

    Dec 16, 2011
    158
    0
    55
    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

     

    Advertisement

  2. krishnaveni

    krishnaveni Well-Known Member
    Thread Starter
    55

    Dec 16, 2011
    158
    0
    55
    chennai
    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

Loading...