I am creating an app and would like to get the information from the edit text to change the api key in the url
This is what I have so far
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("http://free.worldweatheronline.com/feed/weather.ashx?q=C96D62C33C38DA35E0405F0AC86017A0&format=xml&num_of_days=2&key=9e87fcbce7114648121009");
try {
// Add your data
Button button1 = (Button) findViewById(R.id.send_button);
EditText post = (EditText) findViewById(R.id.edit);
button1.setOnClickListener(new OnClickListener()
{
public void onClick(View v){
}
});
HttpResponse response = httpclient.execute(httppost);
Like this? The http will be excuted after the button is pressed with the text from the EditText as “api key”. Hope I didn’t misunderstand you…
}