Senior & Expert .Net Developers Discussion Forum by Nyros Technologies

HIRE .Net Expert Developers Programmers Coders From India
Ruby on Rails PHP .Net Developers Community, Nyros Technologies, Kakinada
 
Log in  or IF not a member please REGISTER
Username:
Password:   


Keyword
Log in | Profile 

DropDownList or ComboBox or Spinner in Android

 
Post new topic   Reply to topic    Senior & Expert .Net Developers Discussion Forum by Nyros Technologies Index -> Mobile Application Development
View previous topic :: View next topic  
Author Message
Raghavendra



Joined: 21 Aug 2007
Posts: 222

PostPosted: Fri Dec 04, 2009 4:10 am    Post subject: DropDownList or ComboBox or Spinner in Android Reply with quote

Following is the sample code to Bind Values to Spinner using Adapters in Android.

package dotnetexperts.mobile.HelloWorld;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.Spinner;

public class HelloWorld extends Activity {
/** Called when the activity is first created. */
private Spinner SpinnerCountries;
private ArrayAdapter<CharSequence> AdapterCountries;

@Override
public void onCreate(Bundle *) {
super.onCreate(*);
setContentView(R.layout.main);

String[] Countries = { "India", "France", "Japan", "China", "U.S" };

// //////////////////Countries Spinner/////////////////////////////////
SpinnerCountries = (Spinner) findViewById(R.id.Spinner01);

// //////////////////////////////////////////////////////////////
// create an arrayAdapter an assign it to the spinner
AdapterCountries = new ArrayAdapter<CharSequence>(this,
android.R.layout.simple_spinner_item);
AdapterCountries
.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
SpinnerCountries.setAdapter(AdapterCountries);

int lenCountries = Countries.length;

for (int i = 0; i < lenCountries; i++) {
// test += Areas[i] + "\n";
AdapterCountries.add(Countries[i]);
}

}

@Override
protected void onStop() {
super.onStop();

}

}

Thanks & Regards,
Raghavendra K.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Senior & Expert .Net Developers Discussion Forum by Nyros Technologies Index -> Mobile Application Development
Page 1 of 1


 latest topics 
 Topics   Replies   Author   Views   Last Post 
No new posts Open-source libraries for iPhone application development:-
1 Teena 681 Wed May 16, 2012 4:31 pm
zhzubir4 View latest post
No new posts Silverlight VoIP client
0 Behnam88 119 Tue May 15, 2012 8:27 am
Behnam88 View latest post
No new posts jQUERY OVERLAPPING ANOTHER jQUERY WHAT SHOULD I DO......??
0 Ankit Gupta 116 Mon May 14, 2012 6:02 am
Ankit Gupta View latest post
No new posts C# window Form
0 sarathy 211 Sat May 12, 2012 6:27 am
sarathy View latest post
No new posts How to develop a softphone with call hold function?
0 Doug_4x23 148 Fri May 11, 2012 12:52 pm
Doug_4x23 View latest post
No new posts How to fill in html textbox from (c# ) windows application
0 mrlingam 155 Fri May 11, 2012 6:50 am
mrlingam View latest post
No new posts DARK SHADOWS: FAN FAVORITES
0 zhy197456 230 Wed May 09, 2012 3:53 am
zhy197456 View latest post
No new posts DARK SHADOWS: BEST OF BARNABAS
0 zhy197456 162 Wed May 09, 2012 3:51 am
zhy197456 View latest post
No new posts THE SPIRAL STAIRCASE
0 zhy197456 146 Wed May 09, 2012 3:50 am
zhy197456 View latest post
No new posts FOR SALE NEW UNLOCKED BlackBerry Bold Touch 9900----$350
0 newwwphone 179 Tue May 08, 2012 10:35 am
newwwphone View latest post




Hire an expert .Net developer / coder / programmer or development team from India now!!

Other Forums : Ruby on Rails   ::   PHP   |   Free unlimited HTML CSS templates download

Nyros Technologies   |   Kakinada City Portal   |   Developers Blog   |   About .Net Experts   |   More