Android :: Passing A Bundle Via An Intent Or Using A Content Provider?
Oct 5, 2010
I would like to pass a considerable sized amount of data (~1500 bytes) between two applications in Android where performance and resource allocation is a priority. The data is basically key-value pairs. The rate at which it needs to be passed from one application to another can vary from a trickle to ~50 packets within a second. I figure I can either:
Wrap all the data inside a bundle, and pass the bundle via an Intent from one application to another. I worry about the performance implications of allocating and de-allocating all that memory to store the bundles.
Write all the data to a SQLite database and provide it to the other application via a content provider. Here I worry about the performance implications of writing all that data to disk, and then having to read it back from disk when it is requested. So, which is the lesser of two evils?
View 1 Replies
Jun 14, 2010
I have a content provider that is custom to my set of Android applications, and one of the things it needs to expose is a small (20-30k) byte array. The uri for these blobs looks like content://my.authority/blob/# where # is the row number; the resulting cursor has the standard _id column and a data column.
View 1 Replies
View Related
Mar 1, 2010
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.
View 2 Replies
View Related
Mar 11, 2010
how can i create a custom content provider like contact content provider? i know how to create custom content providers but i want to integarte to device such a way that it canbe accessed by all application installed in that device.
View 3 Replies
View Related
Jan 2, 2010
I am trying to use Android's LocationManager requestLocationUpdates. Everything is working until I try to extract the actual location object that in my broadcast receiver. Do I need to specifically define the "extras" to my custom intent so that the Android LocationManager before I pass it to requestLocationUpdates so it knows how to add it into the intent, or will it create the extras-bundle regardless when it passes the fired intent to the broadcast receiver?
View 1 Replies
View Related
Oct 14, 2010
I have four groups in a listview each with four url's I want to load in a webView. When the user select a url to goto I set a value like so;
if (position == 0) webb = webb +2;
{
Intent intent = new Intent(this, official.class);
startActivity(intent);
}
I then carryout the intent to move to the webView class where I have given each URL a value like so;
if (webb == 2) mWebView.loadUrl("http://yahoo.com");
if (webb == 3) mWebView.loadUrl("http://www.bbc.co.uk");
But the screen stays blank, if I state the value inside the official.class it works. How can I get this value to pass to another class based on the selection the user makes from the listview.
View 3 Replies
View Related
Oct 16, 2010
I have been trying to get "getExtra" to work but without success, I have a listview with 4 choices which launch a webpage within a webView class, when the user selects the option lets say option 3 I want to pass the value of 3 to the webView class so that it will load the correct webpage, at the moment I get no errors, but the app force closes when I select the option, could this be due to having to announce this in the manifest? can somebody help with where I am going wrong. This is my intent
public void onListItemClick(ListView l, View v, int position, long id) {
if (position == 0) {
Intent intent = new Intent(this, official.class);
intent.putExtra("weburl", 3);
startActivity(intent);}
This is the official class:
public class official extends Activity {
int number = getIntent().getIntExtra("weburl", 0);
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_BACK) && mWebView.canGoBack()) {
mWebView.goBack();
return true;
} return super.onKeyDown(keyCode, event);
} WebView mWebView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.browser1);
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
if (number == 2) mWebView.loadUrl("http://bcafc.livewwware.co.uk");
if (number == 3) mWebView.loadUrl("http://www.bbc.co.uk");
mWebView.setWebViewClient(new HelloWebViewClient());
View 1 Replies
View Related
Sep 22, 2009
I am creating a database driven app for managing people. I am showing a list of people with each name in a TextView. When a TextView is clicked, I launch a new intent to show the detail for the person. My question: What's the best practices for passing the id of the person to the new intent? The TextView is displaying the name of the person, so how do I know the id of the person? Once I know the id, I know how to pass it to the new intent, but I don't know what the best way to associate the id of the person to the TextView. Is there a best practice for this?
View 2 Replies
View Related
Jun 28, 2010
I would like to create some home screen app widgets that are entry points into an application. I can put a button in the app widget that uses setOnClickPendingIntent to start the activity. The problem occurs when I want to have two of these app widgets that are entry points to different parts of the activity. I need to be able to pass data into the activity that will distinguish these. Since both app widgets use a Pending Intent that starts the same activity, the two Pending Intents are shared and I can't reliably set extras for the corresponding intents.
View 2 Replies
View Related
Jan 14, 2010
I have an application, which sets an alarm using AlarmManager, which starts another Activity when it goes off. The AlarmManager takes a PendingIntent and spawns a BroadcastReceiver class when the specified time comes. I'm wondering whether there is any way that I can pass arguments to this BroadcastReceiver through the Intent object which goes into PendingIntent?I'd like to be able to retrieve arg1 in the BroadcastReceiver's onReceive(Context, Intent) method. I figured that the local variable my_intent would be the second parameter passed on to onReceive by the PendingIntent, but apparently that's not quite right. Is it possible to pass parameters between an Activity and a BroadcastReceiver in this fashion (using Intent.putExtra()) or should I use a ContentProvider instead?
View 3 Replies
View Related
Dec 29, 2009
I'd like to be able to read the system's SMS content provider. Basically I wanted to make an SMS messaging app, but it would only be useful if I could see past threads etc.It seems like there's a content provider for this, but I can't find documentation for it - anyone know where that is?
View 6 Replies
View Related
Jun 4, 2010
my android application is handling a large database of bus passage time and we would like to allow others application to be able to display certains bus passage time. We would like to use a content provider to do that. Most example seems to be about using an SQL database, but we use some custom text file. I was wondering what would be the best way to do that. I was thinking I could use a Content Provider and implement the Cursor interface on a custom object that I would manually fill with my text data. Would this be possible ? Anyone have a better idea (excluding changing to SQL lite of course)?
View 1 Replies
View Related
May 26, 2009
Can i pro-grammatically get a list of content providers extant on the system?
View 7 Replies
View Related
Sep 2, 2009
What content providers in the cupcake android build do apps have access to?
View 2 Replies
View Related
Jan 21, 2009
1. How do i use the content provider defined to interact with an application. I mean the database defined is for use in the program only, then how can i use this content provider from another program.
2. Is there an example depicting using of content providers. How are the content providers accessed else where so tht he databases defined in it be created at run time.
View 3 Replies
View Related
Jul 1, 2010
Im having problems with the content provider. Im trying to create a content provider.Is my URI parse been parse correctly?this leads to my database as I want to extract data from it and show it in the list view.after which, i have to edit the manifest inserting the provider if I extend my class to ContentProvider, my database file will be kinda screwed up, is there an easier way?however, it shows the error of not having the one.two.databases to exist.
View 1 Replies
View Related
Sep 10, 2009
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?
View 7 Replies
View Related
Feb 2, 2009
I am performing hundreds of calls to a single content provider to perform various insertions, updates and deletions. After profiling my application, I have noticed that the ContentResolver class takes approx. 30ms to retrieve the corresponding content provider object for each call. Is there anyway to retrieve a reference to the content provider rather then going through the ContentResolver every time?
View 4 Replies
View Related
Dec 21, 2009
I have written the following content provider, but when I try to pull information from it into an array,I presume its something to do with my naming of the CONTENT_URI or something? I'm not quite sure how it works so could anyone explain a bit and spot what I have done wrong?
View 3 Replies
View Related
Jul 14, 2009
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.
View 2 Replies
View Related
Mar 31, 2010
I'm making a media player, but my code doesn't show all my playlists and for many others it does not show any.Why doesn't the code below work completely?
View 2 Replies
View Related
Oct 21, 2009
The Content Provider starts when the first applicable URI is resolved. This will make the ContentProvider run forever and there doesn't seem to be a way to stop it (such as due to inactivity etc).It would be nice if Content Provider would stop after some time so that the memory usage is reduced (An enclosing process, doesn't need to be alive if the Content Provider is not needed anymore).
View 4 Replies
View Related
Mar 21, 2010
Does anyone know if there is documentation explaining the SMS content provider?
View 3 Replies
View Related
Jan 21, 2010
I was wondering if anyone has any information on accessing the Gmail content provider. It doesn't seem to be officially supported in the API but it looks like people are able to do this regardless. See the SlideScreen app which notifies you of new e-mail and even shows you info (sender, title).It would be great to know how this is accomplished, for example we could create a home screen widget that shows you your last few e- mails, etc.
View 2 Replies
View Related
Aug 9, 2010
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?
View 6 Replies
View Related
Jun 8, 2010
How can I make a custom content provider in android?
View 1 Replies
View Related
Aug 13, 2010
I created SQLite base with 3 tables and custom ContentProvider. I had a crash on first call method query. I tried to get cursor from base via db.query(table, columns,...) it worked correctly.
The exception is android.database.sqlite.SQLiteException: no such column: modified: , while compiling: SELECT items._id, items.name FROM items ORDER BY modified ASC
The method is below:
CODE:..............
The Log is 08-13 11:49:59.471: ERROR/AndroidRuntime(5237): Caused by: android.database.sqlite.SQLiteException: no such column: modified: , while compiling: SELECT items._id, items.name FROM items ORDER BY modified ASC
View 2 Replies
View Related
Jul 22, 2010
When I send an SMS on my Android emulator, it goes to the content provider:
content://sms/sent
right?
So I wanted to get the last sent SMS from the content provider. So I used this Uri as you can see above, and, I used the method query, with the Content Resolver Object. And I got the cursor, and used the movetofirst() method, so I would have the last sent SMS. Check the code below. I hope it helps.
package com.sys;
CODE:...................
View 1 Replies
View Related
Sep 28, 2010
I am developing an application that involves some sensitive user information. I retrieve this information via a private web API. I am trying to determine the best way to get this data into my app. Right now I'm exploring creating a content provider that can do so; my hesitation is in making it secure. I want this data to be usable only by my application. Ideally, no other apps would even know it exists.
Do you have any pointers or advice on how to do this effectively and securely? Any info on content providers who's data source is a remote OAuth'd API?
I say content provider, but if that isn't the best way to do what I need, by all means let me know what else to look into.
View 2 Replies
View Related
Nov 2, 2010
What are advantages of using custom content provider? Why such content provider is superior of plain class that wraps SQL queries?
View 2 Replies
View Related