[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


[android-developers] Can someone explain putExtra()?

2010-02-27 Thread Hunk of Hulk
i.putExtra(NotesDbAdapter.KEY_BODY, c.getString(
c.getColumnIndexOrThrow(NotesDbAdapter.KEY_BODY)));

Hi,

I don't understand this code line from the notepad tutorial.
What is the second parameter c.getString().
doing here?

Is it getting the column index of the string body?  In the database
table, it's _id, title, body, so is this value 2?
And then it's making the 2 into a String when the putExtra in the java
doc states that it expects a long value?

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] Notepad tutorial questions about calling super

2010-02-26 Thread Hunk of Hulk
 Hi there,

I find the Notepad tutorial to be anything but simple for me.  Could
someone tell me in the code below why you call super immediately in
method 1 and then last in method 2?  I had thought that if you're
going to call super,you had to do it immediately (or is that only with
a constructor but not with a method)?

Also, if you return true in method 2, does that mean that super is
never called b/c you exit the switch statement immediately?  If you do
exit, then you're not chaining up to the superclass' method, which I
thought you always want to do.  I'm not even sure what the superclass'
onOptionsItemSelected() does anyway.  Does everyone understand every
line of code or should I just stop trying to analyze what every
parameter means and just sort of follow a formula?  I guess that I am
finding Android extremely hard to understand from the documentation.


METHOD 1
@Override
public boolean onCreateOptionsMenu(Menu menu) {
boolean result = super.onCreateOptionsMenu(menu);
menu.add(0, INSERT_ID, 0, R.string.menu_insert);
return result;
}

METHOD 2
 @Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case INSERT_ID:
createNote();
return true;
}

return super.onOptionsItemSelected(item);
}

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