1

I'm developing an app with a list that should show the name, phone and e-mail addresses of users previously registered on a sqlite database. In each row will also have two buttons.

Something like this:

ListFragment:
-------------------- 
[Name 1] 
[Phone 1] 
[E-mail 1] 
[Button 1][Button 2] 
-------------------- 
[Name 2] 
[Phone 2] 
[E-mail 2] 
[Button 1][Button 2] 
-------------------- 
... (and so on) ...

where the button 1 will make a call and the button 2 will send an email to person. detail, these buttons are clickables ImageView.

I managed to create the XML correctly.

And I know I will need to implement a Custom ArrayAdapter with data from my SQLite database.

I really need to know what is the BEST WAY to implement a Custom ArrayAdapter with data from SQLite ??? I saw so many different ways that I'm totally confused.

please can someone help me with this? if there is a tutorial that explains in detail how to do this, I thank you very much.

7
  • "And I know I will need to implement a Custom ArrayAdapter with data from my SQLite database." no, you don't need any ArrayAdapter, what you need is a SimpleCursorAdapter Commented Sep 8, 2014 at 23:42
  • I've tried with SimpleCursorAdapter. but does not work because the SimpleCursorAdapter does not allow to implement actions to the buttons. Commented Sep 8, 2014 at 23:54
  • This is the tutorial I used when getting up to speed on Android Lists and SQLite. I agree with @pskink that what you need is probably a SimpleCursorAdapter, rather than an ArrayAdapter. Commented Sep 9, 2014 at 0:04
  • I tried now with SimpleCursorAdapter. but it did not work. displays users' information, but I can not make the buttons work. remembering that my main goal is that when clicking on the first button call the phone number of row in the list and when clicking on the second button send an e-mail to that user. Commented Sep 9, 2014 at 1:10
  • ie multiple clickable parts with different actions to peform in listfragment Commented Sep 9, 2014 at 1:16

1 Answer 1

0

It looks like this question has the answers you're looking for. You might also try the links in the accepted answer in this question.

Basically, it looks like what you want to do is:

  1. Create a custom descendant of SimpleCursorAdapter
  2. Override getView
    1. Handle inflation of your row using your custom view
    2. Set OnClickListeners for each button
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.