1. Are you ready for the Galaxy S20? Here is everything we know so far!

call string value to url in android

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

  1. krishnaveni

    krishnaveni Well-Known Member
    Thread Starter

    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

     



    1. Download the Forums for Android™ app!


      Download

       
  2. krishnaveni

    krishnaveni Well-Known Member
    Thread Starter

    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
     
Loading...
Similar Threads - call string value
  1. becauseWhyNot
    Replies:
    0
    Views:
    232
  2. quocanh59
    Replies:
    2
    Views:
    345
  3. craiger4233
    Replies:
    2
    Views:
    323
  4. Milo Williamson
    Replies:
    3
    Views:
    387
  5. rj sandy
    Replies:
    5
    Views:
    644
  6. Degenhard
    Replies:
    0
    Views:
    333
  7. Dcollins0777
    Replies:
    5
    Views:
    565
  8. Walker61
    Replies:
    0
    Views:
    328
  9. Jodi Holland
    Replies:
    2
    Views:
    657
  10. Scomer88
    Replies:
    7
    Views:
    630

Share This Page

Loading...