Tuesday, November 8, 2011

DataGrid Control for Android

I'll post a series of How-To of creating DataGrid Control in Android platform. The idea is learnt from .Net CF where data is populated in tabular form. It is similar to DataGrid .Net Framework which we are familiar with.

Feature of DataGrid includes:
  • Column sorting
  • Column resizing
  • Vertical scrolling
  • Horizontal scrolling
  • Single click event on row
  • Data Binding
This How-To will be split into couple of smaller sections, each sections will focus on one item at a time and upon complete the entire How-To, we have the functional DataGrid.


The complete DataGrid looks as below:



This is the my first time to post something about programming, sorry for some parts that are poorly presented. I will improve my writing skills over the time. Anyway, I hope this DataGrid helps you in your Andriod app development :)

NOTE: this control is built on Android 2.2.

15 comments:

  1. Hi HJ, how can you make your datagrid editable? do you have the sample code?

    ReplyDelete
  2. Hi Joe more, datagrid isn't editable. However, I created something called EditView, which is editable editview. http://codegineer.blogspot.com/2012/10/android-editview-combination-of.html. You could replce the table's cell which is TextView to EditView then the cell become editable.

    you could download datagrid sample code from https://docs.google.com/open?id=0B8shbq9Sw2lgYmM4Mzg5OWQtNzM0Yy00MWQ5LTkzZTEtNDY5NGViNTNmY2E3

    Hope that helps.

    ReplyDelete
    Replies
    1. Hello, I'm user of your DataGrid Control.
      I want to ask if I can use your control to my android application -for future, paid apps-.

      Delete
    2. Hi there, it is fine. you could use it in your app.

      Delete
    3. Hello, thanks for grants but I have strange issue.
      I have used this Control with AsyncTask.
      When I once load database and deploy to control, datagrid control doesn't fit.
      For example, specific TextView deviates from its line.

      Delete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Hi HJ,

    Are you using some library for DataGrid Control? Because there is no such method like "setNoDataText" in Android by default(as seen in part one of DataGrid Control). If yes, please let me know the download link of that jar file.
    And if no, how do i use these type of methods as it is giving me error..

    Thanks in advance!!

    ReplyDelete
    Replies
    1. HI Shruti, there is no external jar files, everything is in the project. You could download it from the link above. https://docs.google.com/open?id=0B8shbq9Sw2lgYmM4Mzg5OWQtNzM0Yy00MWQ5LTkzZTEtNDY5NGViNTNmY2E3

      Delete
    2. Hi, thanks a lot for this amazing work, i start to use your component, i 'll find a first problem with the column width which have a fixed value not hard, i just replace the fixed value in your activity by display.getWidth/nbcolumn to fillwidth of screen. Then i find an other problem that i didn't solved,this is the sort. When i click to sort column, i have a sort of only rows displayed on the screen not all in the list. Example i have a list of 20 rows only 10 appears to the screen without scroll, i click sort only 10 sorted DESC other sorted ASC. Any Idea ?

      Delete
  5. Thanks you so much for this kind of Grid. :)

    ReplyDelete
  6. This comment has been removed by a blog administrator.

    ReplyDelete
  7. I am trying to make DataGrid cells editable using EditView code you have provided(it is there in the reply you givent to @Joe more)

    But, unable to get it. Please tell a method to make the datagrid editable with your EditView Class(or provide source code of editable grid)

    thanks & regards
    -Prashu

    ReplyDelete
  8. what is the sample made in as i can't import all the stuff in to android studio

    ReplyDelete
  9. is it still possible to get the sourcecode to download (as in the blog some classes are missing) - thanks a lot.

    ReplyDelete