Android : Custom ContentProvider - Access Existing Database
Oct 21, 2009
Is it possible to create a custom ContentProvider to
* access android existing database (e.g. Contacts, SMS)?
* extend an Exciting ContentProvider which has access to android existing database (e.g. ContactsProvider to access Contacts DB)?
View 1 Replies
Dec 9, 2009
Not sure of the absolute utility of this but seems as though it should be possible and useful. Can you extend ContentProvider to provide URIs representing new queries (i.e., joins across multiple tables not specified by existing URIs) for an existing system database? The alternative seems to be that I need to write a series of cursor queries then join them -- seems like a lot of unnecessary code duplication.
I have been trying this for the contacts database as an exercise, but no love so far. The crux seems to be that I cannot open a database in another package during the setup phase. Am I just completely out in left field here? It's possible as I am new to both Java and Android.
View 1 Replies
View Related
Aug 23, 2010
I'm trying to deploy an application with an existing SQLite database.I've been reading though the examples that are posted but they are always missing some part of the class. I feel like I'm trying to bake muffins but no one told me to use baking powder.Can someone post a full database helper class for depoying an SQLite database on Android? Edit : Delete old code because it doesn't work.
View 2 Replies
View Related
Jun 9, 2010
I have an existing SQLite database file from another project.
Where do I include the database file into my Eclipse project to have it deploy with the app.
Do I need to indicate that the database file is writable? (In the iPhone world you need to copy the database file from the app's bundle to a writable folder on the iPhone proper before first use.)
Once I have the database file on the phone, how do I tell SQLiteOpenHelper to use it? (I extend SQLiteOpenHelper in a custom class.
View 1 Replies
View Related
May 13, 2010
I have already having 2 tables in a database now i want to create a new table in that database it self how can i create?
View 3 Replies
View Related
Oct 20, 2010
Please direct me to a description of the techniques that the ContentProvider employs to access data. I am trying to understand how it works as well as what is tunable or even if its meant to be tunable. It the memory management tiered, cached, virtual, flat? Is it file based, shmem based, stream based? Can there be a combination thereof?
Any information, suggestions, or references are welcome. The android fundamentals page says: "The data can be stored in the file system, in an SQLite database, or in any other manner that makes sense;" but the android ContenProvider page barely skins the onion.
View 8 Replies
View Related
Jul 27, 2010
I'm writing a custom ContentProvider that serves up content consisting of a single, constant string which I represent as a one-row table having columns _id = 0 and value = "SomeString". This string is not stored in a database, so I developed a subclass of CrossProcessCursor that has does everything required to behave like what I described above.
The documentation for CrossProcessCursor is very sparse and doesn't really explain what the fillWindow() method should be doing beyond the obvious. Based on the descriptions of CursorWindow's methods, I put the following together, which I thought should cover it:
CODE:...............
As expected, it gets called with pos = 0 when a client application requests the content, but the client application throws an exception when it tries to go after the first (and only) row:
CODE:..................
what this method should be doing to return a correct-looking row to the client?
View 1 Replies
View Related
Mar 16, 2009
Where could I find any examples of rendering XML data in a ListView? i.e, the model is read from a XML file, not in an existing array or database cursors.
View 3 Replies
View Related
Jul 25, 2009
I have some questions about how the ContentProvider works behind the scenes.
1. The ContentProvider class is registered in the kernel when the application is installed and then what? Or how do the other applications exactly manage to access the application data?
2. When is actually onCreate called? The documentation is pretty vague...
3. What happens if two applications register the same provider class? (I have more applications that must communicate between eachother. The content provider must be registered, of course, along with the first application installed on the system. The problem here is that I don't know which one will be, so I want to deliver the ContentProvider with all the applications)
View 2 Replies
View Related
May 7, 2010
I'm writing an RSS reader for Android. I've faced a certain difficulty which the problem I can't resolve since databases aren't my expertise.. So i figured out maybe one of you could help me out! I currently have 3 tables (Categories, links and feeds). My goal is too link a feed to multiple categories. Therefor I'm using a Link table. My databases is an Android ContentProvider (sqlite) and looks like the following:
| Categories | | Links | | Feeds |
|------------| |---------| |-------|
| _ID | | Category| | _ID |
| Title | | Feed | | Title |
| URL |
I currently wrote the following code in my FeedListActivity to retrieve a list of links and their feeds.
CODE:.................
Now my question:
I was wondering how I could optimize this database layout, code or query so I would get my entries in a more efficient way. Because i believe this link table or the query to retrieve links isn't needed! Or am i doing this the correct way?
View 2 Replies
View Related
Dec 7, 2009
I would like to ask you smart people if anyone has seen any documentation regarding web access to a database from within an Android application. I would like to create a (FREE) application where the users can share information (rants/complains) around the globe. Each user will be able to see a little globe in his phone with locations of other users and some specific information about them.
Architecturally, I am thinking "database in my GoDaddy host, exposing a web service", and the web service accessed from the Android application. But I see no documentation about accessing web services. I can also go XML, maybe, but I am not seeing what mechanisms exist in the Android for over-the-web XML access.
I have a feeling I am mis-understanding something big in the picture. Can someone point me to docs, or knows something about this topic? (the iPhone has a Lighter app where you can see people lighting around the globe. Mine is similar, but people would not be lighting, instead they will be "complaining/ranting").
View 1 Replies
View Related
May 26, 2010
I am working on a Android app and I have a dilemma. I have a list of Objects. I have to update each of these objects with a database. I have 2 methods:
Method 1:I can loop through the Objects. For each object I can connect to the server, update it, and then move on to the next Object, and so forth.
Method 2:I can store the Objects in a list, send the whole list to the server, update it on the server side, then return a list of updated objects.
My questions are:
Which method is faster?
Which method is easier on the phone's battery?
View 2 Replies
View Related
Jul 14, 2010
I understand that to access a SQL database from Android I need to create a web service that will run on the SQL server and will process requests from the Android application, what I need to know is how to create this web service and how to access it from Android.
View 1 Replies
View Related
Jul 27, 2010
I'm using an sqlite database in my app.
I have this dbhelper class in a services class like so.
CODE:............
In my activity classes I access and keep this application as a local variable like so:
CODE:..............
And my service call looks like this:
CODE:.............
I've added these overrides in to try to get rid of my memory leaks.
CODE:.............
But I can't get my memory leaks to stop.
How to rid myself of these memory leaks? These leaks are of the type:
CODE:..................
View 2 Replies
View Related
Jun 18, 2010
I am new to android platform. I am testing one android phone application. I want to see the database entries for that.
View 2 Replies
View Related
Feb 1, 2012
I have to make android app that received files from mobiles and save it on database in pc.
How to create database on pc that i can access it by android app?which technique is the best for this Bluetooth or Wifi or...between the mobiles?
which technique is the best for this Bluetooth or Wifi or...between mobile and pc?
View 1 Replies
View Related
Aug 2, 2010
I am creating an android app that is basically a listing of information on Mushrooms. I get this information from an sqlite database. I have a global singleton with a services class inside it in which I use to access my db. Almost every activity accesses the db. Is it better to leave my db open all the time or open and close it as I need the data? If the best practice is to leave it open all the time, where do I need to make sure to close it and what is the worst case scenario if I left it open when the activity was destroyed?
View 3 Replies
View Related
Jul 22, 2010
I have a Windows web server already set up with a website (unlimited application pools) and I want to be able to access a database on that server via the Android app I'm developing. How can I do this? Can someone point me to a tutorial or give code example of how this cross-platform (Android/Java to ASP.NET/C#) communication can be done? (I'm trying to create a leader board or global scoreboard for my Android game on my server.)
View 3 Replies
View Related
Jul 22, 2010
I have four tabs (reports, review reports, map and settings). I have an sqlite database populated with report information. I wish to have the database accessible throughout the application. The reports tab successfully adds data to the database however using the same methodology crashes the application. The Android debugger points to the line where the database is called again.
In the reports tab the following code is used to launch the database...
CODE:.................
In the onCreate() method of the Review Tab - Where I wish to review reports - I try to access to the database through the call calling the return report method
this.reportDatabase = new ReportDatabase(this);
However this fails to work. In the android debugger highlights that the problem belongs with the context being provided to it. I realise that the report database has already been accessed by the report tab and wonder if this is causing the issue. I am new to programming android, the application is designed to report on flamingos in Africa, any help would be greatly appreciated!
Following the suggestion of Seva Alekseyev I have adapted as follows...
I have adapted my ReportDatabase as...
CODE:..............
using...
reportDatabase = ReportDatabase.open(this);
As the call in both the report and review tab. Unfortunately this doesn't seem to work, the debugger stops on the same method. The full ReportDatabase.java file is here...
CODE:...........
This method returns a double array and probably shouldn't be this hacky...
CODE:............
With the error stack being...
CODE:.................
View 1 Replies
View Related
Dec 12, 2009
I have a problem when using database in broadcastReceiver.
I can't open the database created in the activity. e.g: malwareDB = new PackageDB(this);
The eclipse give me the error that "PackageDB(this)" is undefined.
It seems that the BroadcastReceiver doesn't support the database?
Do have have to access the data base in the "service"?
Here is the definition of "PackageDB":
CODE:..................
View 2 Replies
View Related
Jan 16, 2010
I'd like to access an Internet database from my app to edit it and read it. Any link I should read or any advise?
View 1 Replies
View Related
Sep 6, 2010
Is there any way to access the a database server directly in Android? If not, why? Also, are there any external tools for this?
View 1 Replies
View Related
Feb 11, 2010
How to access my web application database in android emulator, i want list out my database values. These are in my web application. database name employees and table: employee_data. i want to get employee_data data on android emulator.
View 1 Replies
View Related
Jan 31, 2010
I'm searching information about how i can access a specific database that to not belong to me, and that is store in /data/data/com.... directory is it possible without root access? it it possible with root access, and how?
View 3 Replies
View Related
Sep 23, 2009
I am experiencing a problem where when the android device wake up from sleep, the Activity would take forever to get redrawn(and have to terminate it most of the time). I am not sure why, but when I comment out the code below where it retrieves an object from the database based on id stored in the bundle, the problem goes away.
Not sure why the db transaction is causing an issue.
secondly, is it better to store the object in bundle instead of storing its id and retrieving it from db in onCreate?
CODE:...............
View 2 Replies
View Related
Aug 13, 2010
Is it possible to get path of database file in android at path : "/data/system/accounts.db"
In my app i want to use this database, but not getting its path. if i do hardcoding and remove the file i'm able to do it. But i want to access it as database so that i can drop the table.
code i tried:
CODE:.................
View 1 Replies
View Related
Aug 30, 2010
I have a general Android design question around data access. I have a number of activities in my application that need to access a SQLite database. In order to wrap up all data access logic in one place I have created a DatbaseHandler class that takes care of all data access logic. This class takes care of building up where clauses, calling the database and interrogating the resulting cursor to retrieve the query results and return them to the caller. The purpose of this class is to wrap all data access code in one place so that it can be easily managed and maintained as opposed to having data access logic scattered across all activities. Each activity that needs access to the database creates an instance of this DatabaseHandler class and passes it a reference of android.content.Context. The DatabaseHandler class then uses this Context object to call an underlying content provider as follows context_i.getContentResolver().query(...).
My data access logic (cursor handling logic to be specific) is not in the activity and so I cannot manage the cursors life cycle, therefore there is likely to be memory leaks.
My questions are as follows -
How can I (if its even possible) manage the cursors life cycle from outside an Activity? Should each activity even be creating an instance of this data handler class and passing an instance of Context to it? Perhaps my design approach is wrong and I should expose these data access functions as static methods that take an instance of the calling activity as a parameter. That way I could perform managed queries and let the activity take care of managing the cursors life cycle?
View 1 Replies
View Related
Oct 18, 2010
I use a sqlite database in my project. The stored data in it must not be available for the user to edit. As I've read here I saw that if you have root access you can alter sqlite database. The only solution would be to encrypt database content, but this would be time consuming for device. Any solution to prevent access to database ?
View 1 Replies
View Related
Oct 30, 2010
I'm running a .net aspx application. I'll need my android app to access and modify/insert information into the ms sql database. is there any api ?
View 2 Replies
View Related
Jul 18, 2010
I am quite familiar with web programming (HTML, PHP, MySQL) and semi-familiar with Android Java programming, and would like to begin a project that combines the two together. Can someone point me into the right direction for how I would access/manipulate a web-based MySQL database from an android app?
View 1 Replies
View Related