Click here to Skip to main content
11,568,522 members (49,311 online)
   

Mobile

 
QuestionSD card CID Pin
Shrikant Bhongade28-Oct-12 20:44
memberShrikant Bhongade28-Oct-12 20:44 
AnswerRe: SD card CID Pin
Richard MacCutchan28-Oct-12 22:55
mvpRichard MacCutchan28-Oct-12 22:55 
QuestionAuthentication Protocol in mobile web services Pin
Eng.Fatima M28-Oct-12 6:32
memberEng.Fatima M28-Oct-12 6:32 
QuestionPayPal Integration with IPhone Native Application Pin
keyur satyadev25-Oct-12 0:25
memberkeyur satyadev25-Oct-12 0:25 
AnswerRe: PayPal Integration with IPhone Native Application Pin
Richard MacCutchan25-Oct-12 1:27
mvpRichard MacCutchan25-Oct-12 1:27 
Questionhow retrative data from Swlite3 and display as text Pin
ahrahr23-Oct-12 6:52
memberahrahr23-Oct-12 6:52 
QuestionWant to get location from latitude and longitude in Blackberry? Pin
amanarora BB22-Oct-12 22:32
memberamanarora BB22-Oct-12 22:32 
QuestionAdd new listitem in Listview dynamically Pin
klaydze18-Oct-12 21:29
memberklaydze18-Oct-12 21:29 
Hi Guys,

I populated my listview in android using ArrayAdapter. Populating my listview is easy BUT I'm having trouble adding new item on it dynamically.

Kindly check my code.

[Activity(Label = "Country List", MainLauncher = true)]
    public class MyListViewActivity : Activity
    {
        List<string> countries = new List<string>();
        ArrayAdapter<string> adapter;
        ListView lvw;
        
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            
            SetContentView(Resource.Layout.ListviewLayout);
            InitCounties();
                                                
            lvw = FindViewById<ListView>(Resource.Id.lvwCountry);
            EditText txtMsg = FindViewById<EditText>(Resource.Id.edit_text_out);
            Button btnSend = FindViewById<Button>(Resource.Id.button_send);
 
            adapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleListItem1, countries);
            lvw.Adapter = adapter;
            lvw.TextFilterEnabled = true;
            lvw.FastScrollEnabled = true;
 
            btnSend.Click += delegate(object sender, EventArgs e)
            {
                addItems(txtMsg.Text);
            };
        }
     }
 
void InitCounties()
{
        countries.Add("Philippines");
        countries.Add("USA");
        countries.Add("Hong Kong");
        countries.Add("Singapore");
        countries.Add("Russia");
        countries.Add("Afghanistan");
        countries.Add("Albania");
        countries.Add("Algeria");
        countries.Add("American Samoa");
	countries.Add("Andorra");
}
 
public void addItems(string newItem)
{
     counties.Add(newItem);
     adapter.NotifyDataSetChanged();
}

Actually the newitem will add in the collection but when I break and check the adapter, the property Count does not changed and my listview is still the same.

I know I'm missing somewhere in my code but I don't know where exactly it is.

BTW, I'm using Visual Studio 2010 (Mono for Android) in my code.

Thanks
if(you type your code here) {
Messagebox.Show("You help me a lot!");
}
else {
You help me = null;
}


modified 19-Oct-12 3:39am.

QuestionHTML 5 the future? Pin
kakah100014-Oct-12 8:47
memberkakah100014-Oct-12 8:47 
AnswerRe: HTML 5 the future? Pin
Richard MacCutchan14-Oct-12 21:03
mvpRichard MacCutchan14-Oct-12 21:03 
GeneralRe: HTML 5 the future? Pin
kakah100014-Oct-12 21:41
memberkakah100014-Oct-12 21:41 
GeneralRe: HTML 5 the future? Pin
Richard MacCutchan15-Oct-12 4:37
mvpRichard MacCutchan15-Oct-12 4:37 
GeneralRe: HTML 5 the future? Pin
kakah100015-Oct-12 4:45
memberkakah100015-Oct-12 4:45 
QuestionMobile Application Development (Windows Platform) Pin
Abdul Rahman Hamidy9-Oct-12 0:10
memberAbdul Rahman Hamidy9-Oct-12 0:10 
AnswerRe: Mobile Application Development (Windows Platform) Pin
Pete O'Hanlon9-Oct-12 1:23
protectorPete O'Hanlon9-Oct-12 1:23 
GeneralRe: Mobile Application Development (Windows Platform) Pin
Abdul Rahman Hamidy9-Oct-12 17:58
memberAbdul Rahman Hamidy9-Oct-12 17:58 
AnswerRe: Mobile Application Development (Windows Platform) Pin
biop.codeproject31-Oct-12 16:36
memberbiop.codeproject31-Oct-12 16:36 
QuestionAndroid Dev for ICS 4.0.4 Pin
Dana Gibson8-Oct-12 6:55
memberDana Gibson8-Oct-12 6:55 
AnswerRe: Android Dev for ICS 4.0.4 Pin
Mike DiGiovanni9-Oct-12 1:44
memberMike DiGiovanni9-Oct-12 1:44 
Questionandroid action bar Pin
msh667-Oct-12 1:15
membermsh667-Oct-12 1:15 
AnswerRe: android action bar Pin
Richard MacCutchan7-Oct-12 1:30
mvpRichard MacCutchan7-Oct-12 1:30 
GeneralRe: android action bar Pin
msh667-Oct-12 1:44
membermsh667-Oct-12 1:44 
GeneralRe: android action bar Pin
Richard MacCutchan7-Oct-12 2:00
mvpRichard MacCutchan7-Oct-12 2:00 
AnswerRe: android action bar Pin
msh667-Oct-12 2:26
membermsh667-Oct-12 2:26 
Suggestioncan i move objects in blackberry os 5.0? Pin
amanarora BB6-Oct-12 7:18
memberamanarora BB6-Oct-12 7:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web03 | 2.8.150624.2 | Last Updated 5 Jun 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid