appcelerator-developer-relations / Sample.Todo

Titanium Mobile todo sample app
Other
35 stars 30 forks source link

No add Todo on android #5

Open comptekki opened 11 years ago

comptekki commented 11 years ago

There doesn't seem to be a button created to Add a Todo on Android. The code for this is skipped (or is just for iOS and mobile web) and there is no other code to do it. Does this app just set an Item to Done or Delete only for android apps??

jakubczaplicki commented 11 years ago

It's not actually a button, but a menu option. onCreateOptionsMenu in apps.js is not being called. See also: http://developer.appcelerator.com/question/150406/missing-add-button-in-the-todo-list-titanium-mobile-sample-app#comment-166274

jalakoo commented 10 years ago

A year later I'm still seeing this issue on Android devices. For anyone wanting a quick & dirty fix, add the following code to the /Resources/ui/ListWindow.js file, after line 37 (after the if(platform !== 'android'){} statement):

   else {
            var addBtn = Ti.UI.createButton({
                title:'+ Add Task',
                color:'#808080',
                height:40,
                width:'50%',
                top:'80%',
                right:'25%'
            });
            self.add(addBtn);

            addBtn.addEventListener('click', function() {
                new AddWindow().open();
            });
        }

This will create a simple button at the bottom of the TODO screen, it will activate the add task function.