I have my app such that when entered in a certain activity, I show a list of contacts in my phone( similar to Chat app where you see a list of contacts when trying to start a new chat). So I just wanted to know about the implementation details of these task for best/ efficient work. Is the contact list is fetched everytime from my device whenever I enter the activity(which is actually redundant, because we maybe doing same work over and over again, But again we cannot rely on saved data in DB/SharedPref as contacts data is dynamic and bound to change, so need your expert suggestion how to actually make this work in best possible way(I have already written method to fetch contacts- so whould I fetch the contacts afresh everytime or any other way around is there, what the popular chat apps implemet to show the contacts everytime?
Should I store my contacts list in DB or Sharedpreference to avoid running the same task
27 views Asked by Achy97 At
1
There are 1 answers
Related Questions in ANDROID
- Creating global Class holder
- Flutter + Dart: Editing name of a tab shows up a black screen
- android-pdf-viewer Received status code 401 from server: Unauthorized
- Sdk 34 WRITE_EXTERNAL_STORAGE not working
- ussd reader in Recket Native module
- Incorrect display of LinearGradientBrush in IOS
- The Binary Version Of its metadata is 1.8.0, expected Version is 1.6.0 build error
- I can't make TextInput to auto expand properly in Android
- Creating multiple instances of a class with different initializing values in Flutter
- How to create a lottie animation
- making android analyze with coverity sast tool
- Flutter plugin development android src not opening after opening example
- I initialize my ViewModel in the Activity with several fragments as tabs, but the fragments(tabs) return null for the updated livedata
- Node.js Server + Socket.IO + Android Mobile Applicatoin XHR Polling Error...?
- How I can use the shared preferences class?
Related Questions in SQLITE
- How to store a date/time in sqlite (or something similar to a date)
- How to copy data from SQLite to postgreSQL?
- When using a Room database on an Android application, is it possible to pre-populate data
- Expo Error - Android sqlite no such table
- how can debugg field id error in the database schema?
- How add array of authors for unique user in database in Goland IDE?
- Calculate SMA_Close10 and SMA_Close20 of minute data
- Transitioning from Static to Dynamic Data in React with Express Backend
- In SQLite, how to group ranges of values and sort the groups
- Issue with making python executable with local db, sqlite3, tkinter
- Calculating EuclideanDistance in SQL for Deepface facial embeddings?
- Problem with a simple query script used in RS Forms on Joomla 4
- Checking multiple user inputs to multiple fields in a sqlite3 database with python
- How to make that each seller has its own different set of products using sqlite and uwp
- peewee: SQLite - peewee Create() is forcing integer in PrimaryKeyField if leading character is numeric (even if there is a non-numeric in the middle)
Related Questions in ANDROID-CONTENTRESOLVER
- How can I get JSON file with webview from local html
- ContentResolver.query() on MediaStore Uri works only for Android API 31+ - MediaStore.getMediaUri() BUG?
- Getting error when try to get Uris for multiple contacts emails via contentResolver query
- Runtime error on working with flutter on Android Studio
- Calendar Provider - Insert Event Not Working on SDK Version 34 (Android 14)
- Content Provider: when try to access data in contentResolver,cursor object is null in Android 13
- ContentResolver.takePersistableUriPermission() has no documented error possible yet evidently can occur
- Are Content Provider Column id's always unique no matter the case?
- Android FileObserver events not working as expected
- Can't update SIM contacts using ContentResolver
- Event added using content provider isn't saved
- ContentResolver - can't open inserted file on Android API 29+
- ContentResolver.insert() creates audio file of "audio/aac" mime type with .aac extension instead of .m4a
- On Android 11, after renaming media files on a removable micro-sd card, MediaStore can‘t be updated through the ContentResolver.update() method
- Android call log query giving no such column: verstat (code 1 SQLITE_ERROR)
Related Questions in ANDROID-CURSOR
- The query() method from RoomDatabase doesn't work as expected. How does the query() work under the hood?
- How change the bottom leaf color of the cursor in flutter
- Cursor Value Error While Working With Cursor
- SearchView suggestionsAdapter.changeCursor() doesn't work outside of onQueryTextChange()
- Android MatrixCursor not adding new row
- how can i get date_taken value of photo in media store?
- How can I get photos from MediaStore in 2 different time periods in Android Studio?
- Is there another any reason a CursorWindowAllocationException might happen other than unclosed cursors?
- Unable to print out generated list with SQL Database statements [Android Studio]
- cursor adapter getview problem at position 0
- Make sure the Cursor is initialized correctly before accessing data from it
- "Cannot figure out how to read this field from a cursor" when trying to get List of entries inside a custom return type
- How to get the only phone number from the device contact, not whats app and duo number, etc
- Text Selector Cursor is Not disapeared After Switching the Fragments
- error: Not sure how to convert a Cursor to this method's return type (com.madstone.tageditor.database.TrackFileAndSong)
Related Questions in CONTACT-LIST
- how to Get user's email friend list by using Google People API and with APIs Explorer
- gram-js/gramjs add contact to contact list by phone number
- How can I make my app read my contact list?
- Phone contact list with Qt
- How can I make a button that removes contacts once someone clicks on them, in Android?
- Should I store my contacts list in DB or Sharedpreference to avoid running the same task
- How do I attach separate PDF's to contact list email addresses using Python?
- how to show list contact phone in android studio with sdk 27
- Send a message to the telegram contact list of the user - Android
- blocked contacts in contact list IOS swift
- Manage contact list using Microsoft Graph
- UWP Contacts, Contact Lists and Contact Timelines
- Could you explain me this block of code? (Contact List)
- Contact List Android, showing only users who have installed the app
- Lazy loading existing contact images in Android
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Popular Tags
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Personally, I would implement the fetching of the contacts on a background thread (using coroutines) that is called periodically (perhaps each time they the activity is created, as you suggested, or maybe once when they open the app).
Because it's on a background thread, it would prevent them using the app (or any dropped frames while the activity is created). They might have thousands of contacts or be using a really slow device.
Presumably, you would want to store some other data associated with each contact: for example, if you opened up a chat with the user, you would want to associate all the messages with the user, so I would use a database such a realm rather than shared preferences.
So the entire process would probably look something like this: