Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6533393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:07:11+00:00 2026-05-25T10:07:11+00:00

I am working on phonegap with android. i want to create multiple buttons at

  • 0

I am working on phonegap with android. i want to create multiple buttons at run time.

This is the function which get a list of url. So want to create a list of buttons one for each url. so whenever i press that button then i can reach to that url.’

Number of buttons depends on the number of url get by this function. Please suggest me what should i do for this to create button at run time.

this the code which are getting URLs:-

function getData(){
   var output = $('#rt');
     $.ajax({
         url: 'http://192.168.1.214/MusicApplication/searchlatest.php',
         dataType: 'jsonp',
         jsonp: 'jsoncallback',
         timeout: 5000,
         success: function(data, status){
             if(jQuery.isEmptyObject(data)){
                 alert("invalid user");
             }else{

                 $.each(data, function(i,item){
                 alert(item.url);
                 //what should i do to create number of buttons according to each URL which 
                 //are received from php page(a server page)
                 output.append(logi);
             });
             }
         },
         error: function(){

            output.text('There was an error loading the data.');
         }
     });
 }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:07:12+00:00Added an answer on May 25, 2026 at 10:07 am

    Let’s say your Parent layout’s id is linearLayout.

    Use an ArrayList and you could add each button dynamically and have each button with it’s own onclicklistener.

    ArrayList<Button> buttonList = new ArrayList<Button>();
    for (int i = 0; i <= numOfURLS; i++){
         buttonList.ensureCapacity(buttonList.size()+1);
         buttonList.add(new Button(this));
         buttonList.get(i).setText("Text Here");
         buttonList.get(i).setOnClickListener(new View.OnClickListener() {
    
                        @Override
                        public void onClick(View arg0) {
                             openURL(URL); //Here, I'm assuming you made your own method with an intent or whatever to open the desired url.    
                        }
                    });
    }
    

    Comment if you need more clarification or information. I’d be glad to help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

currently i am working with phonegap in android.i want to disply twits of one
I have Phonegap's Facebook plugin working perfectly within my Android app. This plugin uses
I am working on phonegap with android. i want to download a file from
I've been working with PhoneGap and it's been great, but I've run into a
I am working on a web application for android phones, which is basically few
My problem is really weird. I'm working in phonegap. I got a function called
I am working on a Phonegap app, in which I access device's contacts. I
I'm working on making a Phonegap plugin for Android. When I add the findViewById
Working with phoneGap implementing drawing with Canvas. The catch we've run into is that
I am developing an Android app using Phonegap and jQueryMobile, working in Eclipse. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.