I have been learning Android programming from various books and tutorials from roughly 4-5 months now and have a basic idea of most of the things in Android Programming and I recently started with the Notepad Tutorial and now have the final application after Exercise 3.
I want to add the search feature to my app. So that the notes that are stored in the database can be searched i.e. a word given as search query is checked in the body section of all the notes and then only those notes are listed which contain that specific word.
Please can you suggest some modifications in the existing code or suggest what will be needed to implement this search feature?
How can the SQLite query be modified for this?
or should I use indexof() method of Java after storing the body of all the notes in a String Array? and then just displaying those elements of the array using the for loop and if condition with the indexof() method??
You should integrate this with Search Framework of Android
http://developer.android.com/guide/topics/search/index.html
Related
I am working on an Android app where we add post with some tags like in Stack Overflow. I observed that people in my app add tags with different patterns like they use technology as tech, techno, technologies or startup, start up or start-up so when they do something like this then sorting post on searching is a challenge. I mean when they search for startup they cannot see post tagged with start up or start-up.
So I thought to change the edittext where users write tags to an autoCompleteTextView so now they must have to add tags from the list provided in the app. But for the list of words I need a list/array of strings but I can't include them in my app as there are millions of words and they will increase the size of the app up to 5 to 6mb. So I want a free API for my app.
There are many APIs are for this one of them is here.
A text file containing 479k English words for all your
dictionary/word-based projects e.g: auto-completion / autosuggestion
You can get tutorials on this. If you want to use it in android with kotlin by just searching it like "Kotlin with Retrofit 2".
I'm relatively new to Android and I'm working on my first application,A dictionary.Till now, I'm able to display the list of words and provide for a mechanism to add words in a bookmarks list but I'm not able to figure out how to add the search functionality using fts3 in Sqlite.What I require is to provide suggestions when the user searches for a particular word in the application. Can someone tell me how to proceed??
AutoCompleteTextView will help you.
I'm new to android and android development. I'm trying to make an app similar to one that I made for iOS which uses coredata to manage a list of objects in a tableview. Could you give me some reference points for me to look up because I don't even know where to start. What would be the android "translation" for tableview, coredata and entity? Any links to any kind of documentation or tutorials would be a lot of help. Thank you!
TableView is called ListView in Android.
ListView Tutorial.
CoreData is called SQLite Database in Android.
Entity is called Table in Android (which is done using SQL code programmatically, not same as Xcode way as UI to create Entities and Coredata).
SQLite Database Tutorial.
Note: Android Training from Google is a good start if you are new in Android Development.
I am very new to Android development. I'm developing an application (if you want to call it that.) that really just displays static text. It is a guide for people to use at work. All the text is static. I've developed many activities that have static text on them.
I'd like to build search functionality in so people don't have to browse using a table of contents. I know search in android is much more powerful and can search SQLite db & etc, but can it just search various activities in your app? Does anyone know if this is possible and if so, could you point me in the right direction? Obviously if you start googling for "search activities for tet", you get a lot of information on "Search Activities." So as a new Android developer, it is a little frustrating.
I appreciate any help people can give, even if alternatives to what I'm trying to do!
Since the activities simply contain some text, you already have the text available in one form or another (even if they are just strings compiled into the application). I would recommend beginning with a search of these strings, or the data source that you are using to build the activities.
Let's assume, for the sake of a brief description, that your text is stored in an array of strings; then you can search these strings to determine which chapter contains the text the user is searching for. If these chapters were defined in resource files, you might open and search the resource files during the operation. You will have to implement the specific searching, however, yourself.
There is no automatic index that Android can provide which simply searches through the activities you've defined; the content of any application or screen is too dynamic to index.
im working on a simple Android app, it is much like any other simple Database app. I have 4 EditText fields where the user inputs 4 different small pieces of text. I want this text to be inserted in to my Database table in the corrects rows for my columns. I am not really sure how to go about doing this. I know onClickListener needs to be used but not sure how to use it.
What you are looking for is the glue to make it work, as you have a storage ( your database ) and the user interface. But, as you pointed out just right, your onClick actions, or more widely spoken, your whole user-interaction needs to be filled with action.
I won't give you a specific advice here as I think you should read a bit about the Model-View-Controller Pattern here, as well as about how Android handles all that stuff. A good entrypoint for gaining knowledge is, as always, Wikipedia.
Don't get me wrong, I don't mean to offend you by not answering the specific question: I just think it's more valuable for you to first learn the basics required for building great apps instead of reading a step-by-step manual!
On my phone right now, but you are correct about setting up an onClick method for, let's just say, a Submit button.
I would look at the Developers Guide on the SQLiteDatabase on ways to insert values by executing a SQL statement or check into using ContentValues to insert values when the button's pressed, both could help you out.
Also, with a fair share of knowledge on databases the Developer Guide should be all you need, but if you need further help search for related questions.
NOTE
A good practice is getting used to debugging your code using LogCat. It helps when things go astray, especially when working with databases.
Tne Notepad Tutorial in the Android Developer Documentation takes you through creating an application which stores data from fields in an SQLite database.
You could work through this, or if you didn't want to do that it would be a good source of sample code.