[android-developers] content provider and full text search - best practice?

2012-09-12 Thread dorjeduck
Hi 

i am in the process of writing my first content provider. The content 
provided includes a fulltext search in the database underlying the 
provider. I was wondering how to design my content provider to hide the 
specifics, should sqlite specific terms like MATCH be given in the *
selection* argument of the ContentResolver or be hidden in one way or the 
other ... Any suggestion how to do this in a nice way would be great.

Thanks

martin

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Content Provider URIs Documented?

2012-07-29 Thread Sean O'Neil
Is this still true for the current version of Google Talk?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Content Provider in Adobe not working.

2012-07-26 Thread Justin Anderson
I have run into this before...  Are you using a Samsung device, by chance?

I don't know if your problem is exactly the same as ours, but for us we
were able to get around the problem by temporarily creating a copy of the
PDF in a publicly readable location, and then giving that location instead.

Thanks,
Justin Anderson
MagouyaWare Developer
http://sites.google.com/site/magouyaware


On Mon, Jul 23, 2012 at 6:45 PM, mallik arjun wrote:

>  Hi Everyone.
>
> We have implemented a custom content provider serving pdf documents as
> ParcelFileDescriptor. Files are stored in the local storage marked as
> PRIVATE. Based on an URI the documents are then handed over to the selected
> pdf application.
>
> This works for all PDF Viewer applications except adobe reader. Can
> someone please confirm that adobe reader does not work with content
> providers?
>
> The Following overridden method "openFile"  doesn't execute at all when
> the "adobe reader" app is selected.  It always gives  "Invalid File Path".
>
> And, is it possible to make it work using content://Uri values for ADOBE
> reader.  Please let me know.
>
>
>
> @Override
> public ParcelFileDescriptor openFile(Uri uri, String mode) throws
> FileNotFoundException
> {
> // The filename is the path in the URI without the initial slash.
> String fileName = uri.getPath().substring(1);
> File file = getContext().getFileStreamPath(fileName);
> return ParcelFileDescriptor.open(file, ParcelFileDescriptor.
> MODE_READ_ONLY);
> }
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] content provider and syncronization

2012-06-28 Thread giugio
Hello.
I have an application that works with db (sqllte).
I worked with db for a long time, so i know well the commands sql select, 
insert, update, delete, 
I have to create an application that can communicate with a web service 
using php json to synchronize data.
I have a few tables 5/6.
I saw that Android provides tools for synchronization ,many already made
 classes I wondered if i can evaluate the hypothesis of a content provider, 
even if the application does not need to share data with other applications.

for synchronization can be useful work with content providers ? or can be 
an unnecessary waste of time?

these sync api can benefit from the content provider implementation?
Thank you.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Content Provider JUnit Test and Null Pointer Exception

2012-06-21 Thread Dionysus1983
I am attempting to test the update() method of my custom content
provider. I receive a null pointer exception due to the getContext()
method call within the update() method being null. To alleviate this
issue I have attempted implementing
http://stackoverflow.com/questions/6516441/why-does-androidtestcase-getcontext-getapplicationcontext-return-null
to no avail. My test class looks like the following:

public class AddressContentProviderTest extends
ProviderTestCase2 {
public void testInsert() {
Uri CONTENT_URI = Uri.parse("content://" +
AddressContentProvider.AUTHORITY + "/address");
AddressContentProvider addressContentProvider = new
AddressContentProvider();
ContentValues initialValues = new ContentValues();
boolean isException = false;
Uri returnURI = null;
initialValues.put("country", "USA");
initialValues.put("region", "test");
initialValues.put("city", "Jacksonville");
initialValues.put("state", "FL");
initialValues.put("zip", "32258");
initialValues.put("province", "test");
initialValues.put("geo_location_id", "");

returnURI = addressContentProvider.insert(CONTENT_URI,
initialValues);

assertTrue(returnURI != null);

}

The insert method looks like the following:

@Override
public int update(Uri uri, ContentValues values, String where,
String[] whereArgs) {
SQLiteDatabase db =dbHelper.getWritableDatabase();
int count;

switch (sUriMatcher.match(uri)) {
case ADDRESS:
count = db.update(ADDRESS_TABLE_NAME, values, where, 
whereArgs);
break;
default:
throw new IllegalArgumentException("Unknown URI " + 
uri);
}
getContext().getContentResolver().notifyChange(uri, null);
return count;
}

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Content provider with multiple tables

2012-04-22 Thread Andreea Sandu
I have a question about content providers, or maybe I didn't understand it 
well.
I have an application which uses a content provider. I know the number of 
tables
needed and their names only at run-time (I use Java Reflection), but by 
then the
content provider has already been initialized. 

How can I make a more generic Content Provider, which uses x number of 
tables?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] content provider locking?

2012-03-08 Thread Kostya Vasilyev
Using a database transaction should work too. Or a ping/pong generation
number.
08.03.2012 18:53 пользователь "James Black" 
написал:

> Have the service do a callback to activities during just before starting
> and after to prevent this, and return an empty list if they are not
> well-behaved and request during this time.
> On Mar 8, 2012 9:43 AM, "bob"  wrote:
>
>> So, I have a content provider that maintains a list of movies.
>>
>> Also, there is a service that runs in the background and refreshes the
>> list of movies every five minutes.
>>
>> Is there a good way to ensure no one accesses the content provider's list
>> of movies while they are being refreshed?  I don't want an activity to get
>> a partial list of movies.
>>
>> Thanks.
>>
>>
>>
>>
>>  --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] content provider locking?

2012-03-08 Thread James Black
Have the service do a callback to activities during just before starting
and after to prevent this, and return an empty list if they are not
well-behaved and request during this time.
On Mar 8, 2012 9:43 AM, "bob"  wrote:

> So, I have a content provider that maintains a list of movies.
>
> Also, there is a service that runs in the background and refreshes the
> list of movies every five minutes.
>
> Is there a good way to ensure no one accesses the content provider's list
> of movies while they are being refreshed?  I don't want an activity to get
> a partial list of movies.
>
> Thanks.
>
>
>
>
>  --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] content provider locking?

2012-03-08 Thread bob
 

So, I have a content provider that maintains a list of movies.

Also, there is a service that runs in the background and refreshes the list 
of movies every five minutes.

Is there a good way to ensure no one accesses the content provider's list 
of movies while they are being refreshed?  I don't want an activity to get 
a partial list of movies.  

Thanks.




-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] content provider

2012-01-19 Thread Mark Murphy
A content provider would have nothing much to do with it.

If you wish to upload files, upload them. If you wish to download
files, download them. There is nothing in the Android SDK that is a
"sync this directory of stuff with this online counterpart". I'm not
even aware of a third-party solution for that, though I seem to recall
there was some work going on for a git client library.

On Thu, Jan 19, 2012 at 12:53 PM, Ab Caballero  wrote:
> I have an application that stores files to the SD card of the device.
> If I want to sync that data with the google cloud, do i need to write
> a content provider, or is there some other way to share the data?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en



-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Warescription: Three Android Books, Plus Updates, One Low Price!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] content provider

2012-01-19 Thread Ab Caballero
I have an application that stores files to the SD card of the device.
If I want to sync that data with the google cloud, do i need to write
a content provider, or is there some other way to share the data?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Content Provider using external file storage (text file)

2011-06-09 Thread André Coelho
I'm trying to code a system for running user studies. I have a webpage
and a webservice on top of a user DB.
My Android app is a client to run the studies on. I'm use the Account
Manager to store user credentials authenticated via the webservice.
The point is to then implement a sync adapter that will send a text
file with study data to my server, via the webservice (using the
credentials).

My problem is that I'm having difficulty with the Content Provider,
I've searched a lot throught the web but I can't seem to find an
example of how to code a Content Provider tied to a file on external
storage. All the examples I find use Content Providers tied to
database tables. Can someone please point me in the right direction or
shed some coding light? (BTW, I have read the Android Developer texts
on Content Providers, also, I'm using Android 2.2).

Any help is appreciated.

Cheers,
André Coelho

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Content provider

2011-03-18 Thread TreKing
On Wed, Mar 16, 2011 at 8:57 AM, Sakthivel A M  wrote:

> I need complete content provider flow in android framework


http://lmgtfy.com/?q=complete+content+provider+flow+in+android+framework
http://www.catb.org/~esr/faqs/smart-questions.html

-
TreKing  - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Content provider

2011-03-18 Thread Sakthivel A M
   I need complete content provider flow in android framework

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Content Provider for Private Database?

2011-02-27 Thread Kostya Vasilyev

Jake,

ContentProvider isn't just for exporting data.

One useful thing it provides is data change notifications (based on data 
URIs). In practice, it means that ListViews with content 
provider-supplied data refresh automatically, and it's really easy to 
make other UI elements also update automatically by registering data 
change observers.


Another useful thing is that it forces you to map your data into a 
hierarchical URI-based scheme. This, IMO, results in a cleaner 
conceptual model for your data.


Yet another is that you can easily pass data references between 
activities by using a data URI.


On the other hand, with content providers you can't just run a raw sql 
statement whenever you feel like it - all data access is structured, so 
you've got to do some planning first.


Howerver, for debug info, I probably wouldn't bother with a content 
provider or a database at all. Just a text log file, with timestamps, so 
it can be cross-referenced with the logcat (if you can collect that too).


And speaking of debug reports - have you looked at ready-made solutions 
for this? For example, this one is often recommended on this list:


http://code.google.com/p/acra/

-- Kostya

28.02.2011 0:18, Jake Colman пишет:

What are best practices?  My app will use a private database to store
debug information.  Should I create it as a content provider and do my
own data access that way or, since I do not intend to publish this
database for anyone else to use, there is no point?  Is best practice to
alway wrap database access through a content provider?




--
Kostya Vasilyev -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Content Provider for Private Database?

2011-02-27 Thread Jake Colman

What are best practices?  My app will use a private database to store
debug information.  Should I create it as a content provider and do my
own data access that way or, since I do not intend to publish this
database for anyone else to use, there is no point?  Is best practice to
alway wrap database access through a content provider?

-- 
Jake Colman -- Android Tinkerer

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] content provider update problem

2011-01-06 Thread stanly
dear all,

I have some question about provider update issue, here is my code

public static final String[] BUCKET_PROJECTION_VIDEOS = new String[] {
Video.VideoColumns.BUCKET_ID,
Video.VideoColumns.BUCKET_DISPLAY_NAME };

ContentResolver cr = getContentResolver();
ContentValues values = new ContentValues();

values.put(Video.VideoColumns.BUCKET_DISPLAY_NAME,
"/sdcard/microsd");
cr.update(Video.Media.EXTERNAL_CONTENT_URI, values, "", null);
=

but I always get the *empty values* message by logcat.
E/AndroidRuntime( 1989): Caused by: java.lang.IllegalArgumentException:
Empty values


thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Content provider persistence

2010-12-29 Thread Dianne Hackborn
If I understand what you are saying, the process just remains around in case
it is needed again.  If so, that is intended, and not something you need to
avoid.

On Wed, Dec 29, 2010 at 6:27 PM, Pedro Duque  wrote:

> Hi,
>
> I'm writing an application where the user needs to choose a timezone so I'm
> using the search capability of Android. For having the time zone as a
> recommendation inside the search, I've implemented a Content Provider for
> the time zone. The problem is that the content provider remains "alive"
> after the selection is made... and I want to destroy it.
>
> How can I do that?
>
> Thanks,
> PMD
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en




-- 
Dianne Hackborn
Android framework engineer
hack...@android.com

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Content provider persistence

2010-12-29 Thread Pedro Duque
Hi,

I'm writing an application where the user needs to choose a timezone so I'm
using the search capability of Android. For having the time zone as a
recommendation inside the search, I've implemented a Content Provider for
the time zone. The problem is that the content provider remains "alive"
after the selection is made... and I want to destroy it.

How can I do that?

Thanks,
PMD

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Content Provider and Content Resolver

2010-11-28 Thread Kostya Vasilyev
A ContentProvider is a generic mechanism for an application to provide 
access to data. This is done by subclassing ContentProvider, 
implementing certain methods, and publishing information in the manifest.


To access data provided by ContentProvider(s), you use ContentResolver. 
There is no need to subclass.


http://developer.android.com/guide/topics/providers/content-providers.html

This mechanism is used in certain Google applications.

Some of those, but not all, are considered to be part of the SDK, and 
can be used by other applications as well:


http://developer.android.com/reference/android/provider/package-summary.html

Some others are internal, and should not be used by other applications.

These internal providers can change at any time: with a new Android 
release, a new version of a Google application, or even when Android is 
customized by a device manufacturer.


These include Calendar and GMail, and perhaps more. It's not a good idea 
to use them in your application.


If you do, and make it work somehow, be aware that your code can break 
at any time.


-- Kostya

28.11.2010 11:37, adithya пишет:

Hi all,

I couldn't understand clearly the relation between ContentProvider and
ContentResolver classes provided by android.It says ContentProvider is
an interface for most of the activities to be carried out and it can
be done through ContentResolver ! (like reading/writing
messages,contacts,etc)

I would like to know what exactly is the relation between them ? The
documents also mention that using the provider classes are risky and
the risk comes when one uses it without its knowledge.

Can anyone please elaborate ?

-Adithya




--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Content Provider and Content Resolver

2010-11-28 Thread adithya
Hi all,

I couldn't understand clearly the relation between ContentProvider and
ContentResolver classes provided by android.It says ContentProvider is
an interface for most of the activities to be carried out and it can
be done through ContentResolver ! (like reading/writing
messages,contacts,etc)

I would like to know what exactly is the relation between them ? The
documents also mention that using the provider classes are risky and
the risk comes when one uses it without its knowledge.

Can anyone please elaborate ?

-Adithya

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Content Provider - any file type store..?

2010-10-06 Thread Purushottam Sholapur
Hi ,

In android it is not directly possible to share files and folders
across different application. The only way is Content Providers.

1. Is there any general (any file type) content store? Today there is
Audio, Video and Image Store.

2. Wanted to write new Content Provider to store Big files, like Video
and Audio. Saw some examples, like
  (
http://developer.android.com/guide/topics/providers/content-providers.html
)

   Uri uri =
getContentResolver().insert(Media.EXTERNAL_CONTENT_URI, values);

   OutputStream outStream =
getContentResolver().openOutputStream(uri);

   sourceBitmap.compress(Bitmap.CompressFormat.JPEG, 50,
outStream);
   outStream.close();

But what functions in Content Provider get called when we do
"getContentResolver().openOutputStream(uri)" ?
Which all function need to overload/implement in cont provider  . .?

3. Is there any example for content provider which stores big files
like video, audio ?
  I want through MediaStore.Image / Video etc , but could not makeout
much.

regards
Purush

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Content Provider - any file type store..?

2010-10-06 Thread purush
Hi ,

In android it is not directly possible to share files and folders
across different application. The only way is Content Providers.

1. Is there any general (any file type) content store? Today there is
Audio, Video and Image Store.

2. Wanted to write new Content Provider to store Big files, like Video
and Audio. Saw some examples, like
   ( http://developer.android.com/guide/topics/providers/content-providers.html
)

Uri uri =
getContentResolver().insert(Media.EXTERNAL_CONTENT_URI, values);

OutputStream outStream =
getContentResolver().openOutputStream(uri);

sourceBitmap.compress(Bitmap.CompressFormat.JPEG, 50,
outStream);
outStream.close();

But what functions in Content Provider get called when we do
"getContentResolver().openOutputStream(uri)" ?
Which all function need to overload/implement in cont provider  . .?

3. Is there any example for content provider which stores big files
like video, audio ?
   I want through MediaStore.Image / Video etc , but could not makeout
much.

regards
Purush

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Content Provider Question

2010-10-01 Thread Mark Murphy
On Sat, Sep 25, 2010 at 6:37 PM, Adam Hammer  wrote:
> I think I've got to write a content provider for handling a add-on
> style architecture for my app.

Why?

> If I have 2 seperate providers, different .apks and manifests, and
> lets say one has the authority
>
> content://my.authority.com/addon1
> and the second
> content://my.authority.com/addon2

That's not supposed to work. AFAIK, the second one will fail to be
used (and I would have expected it to fail to install), since it
attempts to use the same authority (my.authority.com).

> They are both installed and registered. If I do a query on
> content://my.authority.com will it come back with both addon1 and
> addon2 in the result set?

I doubt it.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android 2.2 Programming Books: http://commonsware.com/books

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Content Provider Question

2010-09-27 Thread Adam Hammer
I think I've got to write a content provider for handling a add-on
style architecture for my app.

If I have 2 seperate providers, different .apks and manifests, and
lets say one has the authority

content://my.authority.com/addon1
and the second
content://my.authority.com/addon2

They are both installed and registered. If I do a query on
content://my.authority.com will it come back with both addon1 and
addon2 in the result set?

Basically can you query what tables are available, and not just the
table itself? Will the content resolver sort that out even though it's
not in either actual providers authority?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Content Provider URIs Documented?

2010-09-01 Thread Mark Murphy
On Wed, Sep 1, 2010 at 2:54 PM, the2bears  wrote:
> I found http://groups.google.com/group/android-developers/
> browse_thread/thread/eac04c2a99eb681c/4a6c25fe0a956d17?
> lnk=gst&q=broadcastreceiver">this link very helpful regarding how
> to react to the arrival of an email.
>
> The content: schema seems very sparsely documented, though.

The content provider described in that thread is undocumented and
should not be used.

> Is there
> an equivalent "content://gmail-ls" provider URI for Google Talk/Chat?

None that is documented and supported.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android App Developer Books: http://commonsware.com/books

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Content Provider URIs Documented?

2010-09-01 Thread the2bears
Hello,

I found http://groups.google.com/group/android-developers/
browse_thread/thread/eac04c2a99eb681c/4a6c25fe0a956d17?
lnk=gst&q=broadcastreceiver">this link very helpful regarding how
to react to the arrival of an email.

The content: schema seems very sparsely documented, though.  Is there
an equivalent "content://gmail-ls" provider URI for Google Talk/Chat?
Can I have a ContentObserver monitoring chat sessions and then react
based on certain criteria?

Thanks in advance,

Bill

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Content Provider for shared preferences. ?

2010-08-11 Thread Olivier Guilyardi
I think that you want to make a Content Provider:
http://developer.android.com/guide/topics/providers/content-providers.html

With this you can allow other apps to retrieve data from your app. Internally,
you can store this data the way you want, in shared preferences, in a sqlite
database, etc..

Olivier

On 08/11/2010 12:10 PM, Pampapathi wrote:
> 
> I am also want the same , if any one of you know about this, please respond.
>  
> Thanks,
> Pampapathi K
> . On 11 August 2010 15:33, kunal khaire  > wrote:
> 
> Hi All,
> 
> 
> Shared Preferences are as such used to keep the data static and
> available.Is there a chance that i can use this ahred preference
> values over a content uri and make accessible to all ?
> 
> 
> Thanks
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to
> android-developers@googlegroups.com
> 
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> 
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
> 
> 
> 
> 
> -- 
>  
> 
> 
> Pampapathi.K,
> 9538974554
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Content Provider for shared preferences. ?

2010-08-11 Thread Pampapathi
I am also want the same , if any one of you know about this, please respond.

Thanks,
Pampapathi K
. On 11 August 2010 15:33, kunal khaire  wrote:

> Hi All,
>
>
> Shared Preferences are as such used to keep the data static and
> available.Is there a chance that i can use this ahred preference values over
> a content uri and make accessible to all ?
>
>
> Thanks
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en




-- 



Pampapathi.K,
9538974554

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Content Provider for shared preferences. ?

2010-08-11 Thread kunal khaire
Hi All,


Shared Preferences are as such used to keep the data static and available.Is
there a chance that i can use this ahred preference values over a content
uri and make accessible to all ?


Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Content Provider filtering query, filtering Cursor

2010-08-09 Thread Laxs
Hi,

I got following problem, I need to use a Content Provider to read a
Database of an other App.
first I want all rows, and after analyzing the data only e.g. the rows
from _id = 1, 3 and 5.

how can I call a Content provider and select only these rows?

or is it possible to create a subset Cursor form an given Cursor?

Thanks in advance.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Content provider doubt

2010-08-09 Thread Sohan badaya
Hi All,

I have a doubt about content provider. Why we use content provider?
can't we use database of a application?
If we talk about other application also. can't we use database of that
application directly wihout
content provider?

Thanks,
Sohan

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] content provider failes on insert row

2010-07-29 Thread martinmike2
Hello, what i cam trying to do is this:

1. Check for db on startup (no problem)
2. If no db, create one (no problem)
3. input some data into the db (problem)
4. save the db (not there yet)


The exception is being thrown when i call cp.insert


I have stepped through the code line by line and the line that throws
the exception, every time, is:


SQLiteDatabase db = mOpenHelper.getWritableDatabase();


in the insert override.


I'm not sure why this is throwing an exception, seems like a pretty
normal call to me.


Here is my Code:



MainWindow.java

package com.vortex.rules;


import com.vortex.rules.Rule.Rules;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.content.ContentProvider;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.database.Cursor;


public class MainWindow extends Activity {


/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);


/**
 * Check for DB, if none, d/l from web server (playing with
idea)
 */
Uri first_use = Rules.CONTENT_URI;
ContentResolver cr = getContentResolver();
Cursor c = cr.query(first_use, null, null, null, null);
if(c == null){
ContentProvider cp = new CoreRulesProvider();
if (cp.onCreate()) {
ContentValues values = new ContentValues();
values.put(Rules._ID, 1);
values.put(Rules.TERM, "Player");
values.put(Rules.TEXT, "You, the person
reading these rules,
are a Player.");
cp.insert(Rules.CONTENT_URI, values);
}
}



RulesContentProvided.java

package com.vortex.rules;


import android.content.ContentProvider;
import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.content.UriMatcher;
import android.content.res.Resources;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteQueryBuilder;
import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;


import java.util.HashMap;


import com.vortex.rules.Rule.Rules;


/**
 * Provides access to a database of rules.  Each rule has a TERM, the
RULE itself, and a creation date and modified data.
 * @author Michael Martin
 *
 */


public class CoreRulesProvider extends ContentProvider {


private static final String TAG = "CoreRulesProvider";


private static final String DATABASE_NAME = "core_rules.db";
private static final int DATABASE_VERSION = 2;
private static final String RULES_TABLE_NAME = "rules";


private static HashMap sRulesProjectionMap;
private static HashMap
sLiveFolderProjectionMap;


private static final int RULES = 1;
private static final int RULE_ID = 2;
private static final int LIVE_FOLDER_RULES = 3;


private static final UriMatcher sUriMatcher;


/**
 * This class helps open, create, and upgrade the database
file.
 */
private static class DatabaseHelper extends SQLiteOpenHelper
{


DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null,
DATABASE_VERSION);
}


@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE " + RULES_TABLE_NAME
+ " ("
+ Rules._ID + " INTEGER
PRIMARY KEY,"
+ Rules.TERM + " TEXT,"
+ Rules.TEXT + " LONGTEXT"
+ ");");
}


@Override
public void onUpgrade(SQLiteDatabase db, int
oldVersion, int
newVersion) {
Log.w(TAG, "Upgrading database from version "
+ oldVersion + " to "
+newVersion + ", which will
destroy all old data");
db.execSQL("DROP TABLE IF EXISTS rules");
onCreate(db);
}
}
/**
 * END OF DatabaseHelper CLASS!
 */


private DatabaseHelper mOpenHelper;


@O

[android-developers] Content provider / ListView - Close the database but leave the cursor open?

2010-06-21 Thread Jawon
I have a ContentProvider that stores data in a SQLite database. I also
have an app with a ListView that displays data queried from the
ContentProvider. I run a query() on the ContentProvider, then I take
the returned Cursor, make an adaptor, and set it to the ListView, like
so:

dbAdapter = getContentResolver();
deviceList = (ListView)this.findViewById(R.id.deviceList);

Cursor allDevices =
dbAdapter.query(BluetoothContentProvider.CONTENT_URI,

BluetoothContentProvider.ALL_COLUMNS,
null,
null,

BluetoothContentProvider.KEY_ROWID + " ASC");
startManagingCursor(allDevices);
SimpleCursorAdapter cursorAdaptor =
new SimpleCursorAdapter(this, R.layout.device, 
allDevices,
COLUMN_HEADINGS, DISPLAY_FIELDS);
deviceList.setAdapter(cursorAdaptor);


If I close the database inside the query() of the Provider, I get an
"Invalid statement in fillWindow()" error from the returned Cursor,
but I don't want to leave the database permanently open either. What
should I do?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Content provider implementation questions

2010-06-13 Thread Alex Xin
Hi, All

I'm now trying to implement my own content provider. My original data was
stored on network or local/remote file systems, so I want to provide data
via input stream. I know that client may call ContentResolver.getnputStream
to retrieve the input stream to access data. But I don't know how to
implement content provider in this situation, I searched the Internet but
all the tutorials for content provider are talks about how to expose data
that stored on local database.

Could anyone please help me on this or give me some code snippets to show
how to expose data that stored on file systems using a content provider?

Also could anyone please tell me what happened when client
call ContentResolver.getnputStream? I want to know how to return an input
stream to my client.

Thank you

Alex

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Content Provider not updating strings from locale

2010-06-01 Thread swgillan
Hello.

I have an app that has 3 string arrays. These arrays are coded in both
default english and spanish.

When I update my lists with 2 of the string arrays, they use the
correct language if I change my locale on the phone.

The 3rd array is used as a suggestion list for a search function
(using the startSearch() method). I have a content provider that
updates the list based on the R.array.name, it seems that never seems
to be updated (ie, always shows up in english).

Is there another setting I have to use for it?

I am using it like this inside my class:

public class LocationProvider extends ContentProvider {

@Override
public boolean onCreate(){
Resources resources = getContext().getResources();
LocationList.fill(resources);
return true;

}

The fill method does some other stuff, but I have just echoed out to
logCat to see what is happening:

public void fill(Resources res){
String[] locations = res.getStringArray(R.array.name);
//TEST to see what is in R.array.name
for(int i =0;i<10;i++){
System.out.println(locations[i]);
}
}

In each print statement, it is just the english value that is being
display. Even when I change locale to spanish, run the application,
all my strings are correctly showing spanish except for this list.

Any help or suggestions would be appreciated.

Regards,

Steven Gillan

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] content provider, activity.startManagingCursor and simple dao

2010-06-01 Thread Mark Murphy
kamiseq wrote:
> I am writing simple app that will read callLog content provider
> transform data and write it to my own table. my app will not show data
> directly from calllog content provider.

Why?

> 1. now one problem that I have is I cannot limit how much rows query
> will return (by calling activity.managedQuery) but I assume that
> Cursor delays access to the db and I can use moveToNext as many times
> as desired to get few rows from table and the call will be efficient.
> is that good thinking?? OR am I wrong here? 

You are wrong here. If your query is for all rows, it will do the work
to load all rows out of the database and into memory when you access the
first one.

> 2. I dont want to implement my own content provider for my app. I will
> use rawQuery many times and group data so contentprovider's callbacks
> are not enough for me.
> more I want my dao to be private to my application so I think there is
> no need to bother with conentprovider.

Then don't implement a content provider.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_Android Programming Tutorials_ Version 2.0 Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] content provider, activity.startManagingCursor and simple dao

2010-06-01 Thread kamiseq
hi all,
I am writing simple app that will read callLog content provider
transform data and write it to my own table. my app will not show data
directly from calllog content provider.

1. now one problem that I have is I cannot limit how much rows query
will return (by calling activity.managedQuery) but I assume that
Cursor delays access to the db and I can use moveToNext as many times
as desired to get few rows from table and the call will be efficient.
is that good thinking?? OR am I wrong here? I really dont want to
query all rows from table. is there any other way to access calllog??

2. I dont want to implement my own content provider for my app. I will
use rawQuery many times and group data so contentprovider's callbacks
are not enough for me.
more I want my dao to be private to my application so I think there is
no need to bother with conentprovider. and If I got this right I also
dont need to bother with activity.startManagingCursor as long I query
data inside same method call (because I need to deactivate all
intermediate Cursor objects anyway)

thanks for any help

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Content Provider works in emulator not on device

2010-04-02 Thread Mark Murphy
lordjoe wrote:
> I developed a custom content provider for extracting data from zip
> files. The provider works properly in the emulator but when I run the
> apk on the device I get no content provider followed by the url
> The manifest says (outside the application tag
> 
> 
>  android:name=".contentprovider.ExtendedFileContentProvider"
>  
> android:authorities="com.lordjoe.android.contentprovider.extendedfilecontentprovider"
>  /

The  element needs to be inside the  tag. See
this project for an example:

http://github.com/commonsguy/cw-android/tree/master/ContentProvider/ConstantsPlus/

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android 2.x Programming Books: http://commonsware.com/books

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe, reply using "remove me" as the subject.


[android-developers] Content Provider works in emulator not on device

2010-04-02 Thread lordjoe
I developed a custom content provider for extracting data from zip
files. The provider works properly in the emulator but when I run the
apk on the device I get no content provider followed by the url
The manifest says (outside the application tag





Any bright ideas

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe, reply using "remove me" as the subject.


Re: [android-developers] Content Provider General Questions For a Newbie

2010-03-01 Thread Mark Murphy
Hunk of Hulk wrote:
> In the notepad example and others, the content provider never even
> declares its CONTENT_URI anywhere inside itself, yet the docs say to
> publicly declare this. 

That's really only helpful if the ContentProvider will be used by
something else in the same process, and it is never strictly necessary.

 It's declared in a different class.  So when
> an activity queries a content provider with a CONTENT_URI, how does
> Android know which one I want.  I see no link between a content
> provider and its CONTENT_URI declared in another class.

Look at the  element in the manifest.

> I also don't how to think about intents and content providers.  I know
> that you don't call an intent on a content provider.  But an activity
> queries a content provider without an intent, and an activity has a
> mimetype attribute in the manifest that would seem to tie it to a
> content provider.

Each ContentProvider declares, for a given Uri, what the MIME type is.
This allows an activity, with only a Uri, to ask Android "hey, please
start an activity that can view one of these...u...things". The
activity creates an Intent with that Uri. Android uses the
ContentProvider to figure out the MIME type for that Uri. Android then
finds an activity that supports the desired action (e.g., ACTION_VIEW)
on that MIME type.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 3.0
Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Content Provider General Questions For a Newbie

2010-03-01 Thread Hunk of Hulk
Hi there,

I am having a hard time understanding content providers.

In the notepad example and others, the content provider never even
declares its CONTENT_URI anywhere inside itself, yet the docs say to
publicly declare this.  It's declared in a different class.  So when
an activity queries a content provider with a CONTENT_URI, how does
Android know which one I want.  I see no link between a content
provider and its CONTENT_URI declared in another class.

I also don't how to think about intents and content providers.  I know
that you don't call an intent on a content provider.  But an activity
queries a content provider without an intent, and an activity has a
mimetype attribute in the manifest that would seem to tie it to a
content provider.

Can someone please help?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Content Provider in separated project

2009-12-02 Thread Ederson Marcos Ferreira
Project references do not work at runtime. Not sure why.
Try to use a jar reference to the dependent project instead...

Éderson

On Wed, Dec 2, 2009 at 10:42 AM, Daber  wrote:

> Hi,
>
> I've following problem. I've created 2 projects. One with content
> provider. Second with client activity using this provider.
>
> I've set project references in eclipse. Compliation completes
> succesfuly. Problem is at runtime.
>
> Provider.CONTENT_URI as well as other static public fields are not
> resolved at runtime.
>
> How to solve this problem?
>
>
> Thanks, in advance
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] Content Provider in separated project

2009-12-02 Thread Daber
Hi,

I've following problem. I've created 2 projects. One with content
provider. Second with client activity using this provider.

I've set project references in eclipse. Compliation completes
succesfuly. Problem is at runtime.

Provider.CONTENT_URI as well as other static public fields are not
resolved at runtime.

How to solve this problem?


Thanks, in advance

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Content Provider VS SQLiteDatabase

2009-09-09 Thread Chris

I would like to know the exact difference between Content provider and
SQLiteDatabase. If we have to share our data among applications then
we use Content provider, otherwise SQLiteDatabase. Is this is the ONLY
difference, OR using Content Provider has something to do with
performence???
Any input will be highly appreciated.

Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] content provider implementation

2009-08-23 Thread vishal bhoj
Hello Everyone,

Can anyone explain the usage of selection and slectionargs  in content
provider implementation? It states that it filters the rows.


Is it possible to filter based on substrings in the rows?

example db entry has
 _DATA
fun/abc/1
fun/abc/2
fun/abc/3
fun/xyz/1
fun/xyz/2
fun/xyz/3

Can I qwery my content provider to return data column with "abc" entries?


-- 
with regards vishal

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Content Provider Permission

2009-07-14 Thread Isis

Hi All,
 I want to delete Downloads provider data. And I have added
permission in AndroidManifest.xml,  But it doesn't work, the log gave
me a pid and an uid, I guess the problem is caused by these two ids.If
it's true, what can I do  to solve this problem.

AndroidManifest.xml as follows:
...


...

Java code as follows:
...
ContentResolver resolver = context.getContentResolver();
resolver.delete(DownLoads.URI, null, null);
...

Log as follows:
...
07-07 13:59:10.038: ERROR/ContentProvider(726):
java.lang.SecurityException: Permission Denial: writing
com.android.providers.downloads.DownloadProvider uri 
content://downloads/download
from pid=1714, uid=10085 requires
android.permission.ACCESS_DOWNLOAD_MANAGER
...


Any suggestion or best an example is greatly appreciated.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Content Provider notifications?

2009-06-15 Thread MannyNS

Anyone?

On Jun 10, 5:38 pm, MannyNS  wrote:
> Using ContentResolver and ContentObserver, it is possible to receive
> notifications in the function onChange() when some data is changed
> within the content provider. However, I fail to see if there is a way
> to see the URI which triggered the notification.
>
> For instance, if I want to play a sound when someone deletes "Kara
> Trace" from my address book or whatever - how do I do that, if not by
> having another copy of the whole content provider dataset, and then
> comparing the old dataset copy with a new one?
> Can someone confirm me that the hard way is the only way?
>
> Thanks.
>
> P.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] content provider supports transactions

2009-06-10 Thread ozzoozzo

Question about ContentProviders being atomic.The spec says  " If the
content provider supports transactions the update will be atomic".

What does this mean ? Who implements the transaction code  ? Is it in
reference to the JDBC drivers?

Thank u
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Content Provider and Files

2009-06-07 Thread jphdsn

Hi,

I want create a Content Provider for JSON files. In that case, where
could I store the files?

First, I thought that I could store the files in an SDCARD, but not
all the devices have or will have an SDCARD.

Second, if I create this files in the app, can I use Content Provider?
And what's the maximum of  kilobits the files could have?

Third, Is there another solution?

Thanks and regard


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Content Provider for Drafts

2009-01-15 Thread Miguel Paraz

Hi,
On the G1, do the SMS and email inbox make draft messages accessible
through a content provider?

I would like to write an app to review the drafts for resending.

Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Content Provider: create/open a file in the overrided "openFile" function

2008-11-24 Thread polo777

Hello Everyone,

I am trying to override the openFile function of a contentProvider so
that I can use the URI in the loadURL function. The following code is
really spread on the forum but nobody seems to meet any problems on
this line File file = new File(...).
As far as I am concerned, I got a FileNotFoundException and I really
dont understand why!

If anyone has an idea that would be great.
Thanks in advance
Polo


private static final String file_path = "file:///data/data/
com.android.orange.myApp/files";
private static final String file_name = "HtmlView";

@Override
public ParcelFileDescriptor openFile(Uri uri, String mode)
{
try
{
mDbH.open();
// content that I want to add in my file
Cursor c = mDbH.fetchContent();
String content = c.getString(c.getColumnIndex
(DbAdapter.KEY_WEBVIEW_CONTENT));
c.close();
mDbH.close();
//
File file = new File(file_path,file_name);
FileWriter out;

out = new FileWriter(file);
out.write("  ");
out.close();
}

   catch (FileNotFoundException ex)
{
// Checked for file existance already, so this should
not happen
return null;
}
catch (IOException ex)
{
// read or close failed
return null;
}

int m = ParcelFileDescriptor.MODE_READ_ONLY;

if (mode.equalsIgnoreCase("rw"))
m = ParcelFileDescriptor.MODE_READ_WRITE;

if (file.canRead())
{
ParcelFileDescriptor pfd = 
ParcelFileDescriptor.open(file, m);
}

ParcelFileDescriptor pfd = ParcelFileDescriptor.open(file, m);
return pfd;

}
catch (FileNotFoundException e)
{

}
return null;
}
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Content Provider MIN query

2008-10-17 Thread Gil

I would like to execute the following SQL query for a content provider
I wrote:

select MIN(time) filename from CACHE_OBJECTS;

How can I execute such a statement using the content resolver?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Content Provider

2008-06-19 Thread Pietro

I want to serialize an object in a file and share it between 2
application. I have made a contentProvider to do it with a SqlLiteDb.
Now I want to hendle the file to the uri... How I can do it... My db
has the _id, name, _data columns...
When I try do..

Uri uri=Uri.parse("content://P2P/condivisioni/MappaCondivisioni");
try{
uri = myContext.getContentResolver().insert(uri, null);


try {
myLogger.log(Logger.INFO,"Sto per creare un 
output stream");
OutputStream outStream =
myContext.getContentResolver().openOutputStream(uri);
myLogger.log(Logger.INFO,"Creato outputstream");
ObjectOutputStream output=new 
ObjectOutputStream(outStream);
myLogger.log(Logger.INFO,"Creato un 
Objectoutputstream");
output.writeObject(Mappa);
myLogger.log(Logger.INFO,"Scrivo l'oggetto");
output.close();
} catch (IOException e) {
// TODO Auto-generated catch block
myLogger.log(Logger.SEVERE,e.toString());
}
}catch (IllegalArgumentException e) {
myLogger.log(Logger.SEVERE,e.toString());
}catch (SQLException e) { ..



I catch :
java.io.FileNotFoundException: No files supported by provider at
content://P2P/condivisioni/MappaCondivisioni

well where is the problem?
what I must put in the data field...

I have tryied with the real path of a file and with the
content://P2P/condivisioni/MappaCondivisioni uri

always the same exception

help me please
If you have an example with file hendled
a content provider that hendle file
.
Sorry for my english
bye

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---



[android-developers] Content Provider and notifying changes

2008-04-07 Thread wonderoid

Let's say i update a certain note in a database and it has a uri like
the following: ".../notes/2". Now when i notify a change in this uri
using ContentResolver.notifyChange(uri);  is it only cursors
having a single item
" ../notes/2" that will be notified? If i have another cursor that
holds a query for all the notes in the provider ".../notes", (hence it
includes note 2 too), is this going to receive the notification?
Actually i have tried this and it does not seem to get any
notification, so am i doing something wrong or do i have to explicitly
notify that base uri too? (Using cursor adapters so content observers
exist)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~--~~~~--~~--~--~---