Implement Lucene Search in Android App – How to make it work

I created an Android app for World Health Organization long ago. I made different kinds of search engines before with full-text indexing. This time I wanted to do something different. I had only 4 days to make the app. They had different kinds of contents like

  1. html
  2. Plain text files
  3. PDF files

And they needed a search engine to search all the contents and show a unified result set ( Showing results in a same page with relevancy ). Now I could implement it in SQLite, but that would mean a lot of task and the gain would be much lesser than a document-based search engine like Apache Lucene.

Read More »

Interfaces for Class Structure: Structure Interfaces?

Interfaces were built to create public API and minimize client code to access fungible objects. I do use interfaces heavily for all the purposes you probably are familiar with. Today I would like to introduce a new and opinionated way I am using interfaces which helps me to create consistent structures of similar classes.

Read More »

Problem with fragment findViewById

I was learning android fragments. I made a separate layout for large screens.

Now I am calling updateArticleView() from MainActivity which is actually updating the Text View inflated by the ArticleFragment. I am getting NULL by this line

 getActivity().findViewById(R.id.article);

But getView() works fine and I can update the text. I printed the view hierarchy and it has the element, but somehow findViewById of the activity cannot return the object. Application is working. I posted the problem to stackoverflow. Let’s see someone can solve the catch.

Read More »