Nov 28 | 8:55 AM |
Mark M. | has entered the room |
Mark M. | turned on guest access |
Nov 28 | 9:00 AM |
HighwayRob | has entered the room |
HighwayRob |
HI Mark, I got some simpler questions. We need to discuss some conslting hours later.
|
Mark M. |
hello!
|
Mark M. |
go right ahead with the simpler questions!
|
Nov 28 | 9:05 AM |
HighwayRob | |
HighwayRob |
I should of been better prepared. OK...most layouts show the Service call: 9999 on top, my new layout shows the title that is displayed when app opens. GOt a feeling I am not extending or implementing something. Want it to display the Service Call #
|
Mark M. |
call setTitle() on the activity to set the title that appears in the action bar
|
HighwayRob |
Which brings me to the next issue,
|
HighwayRob | |
HighwayRob |
cannot resolove symbol on parmas
|
Nov 28 | 9:10 AM |
Mark M. |
then there is nothing by that name, apparently
|
Mark M. |
you copied and pasted this from somewhere
|
Mark M. |
see where that "somewhere" is getting params
|
Mark M. |
and try reproducing that in your new location as well
|
HighwayRob |
hold on...here is that stuff. Give me a minute.
|
HighwayRob |
THe FieldActivityENtryList cannot resolve method putextras
|
HighwayRob |
View paste
|
HighwayRob |
Problems passing the paramters \ bundles betweenthese activities
|
Mark M. |
well, params is commented out
|
Mark M. |
//Bundle params = this.getIntent().getExtras();
|
Mark M. |
you cannot reference something that is commented out
|
HighwayRob |
WHenI uncommenthat, it cannot resolve getintent
|
Nov 28 | 9:15 AM |
Mark M. |
getIntent() is a method on Activity
|
Mark M. |
this is not an Activity -- this is an AdapterView.OnItemClickListener
|
HighwayRob |
View paste
|
Mark M. |
Bundle params = FieldActivityEntryOptionsList.this.getIntent().getExtras();
|
HighwayRob |
ok...that partsa appears to have no errorsnow.
|
HighwayRob |
View paste
|
HighwayRob | |
Nov 28 | 9:20 AM |
HighwayRob |
Nice. Cant wait until I am smart. It's taking time.
|
Mark M. |
just a reminder: chat transcripts get publicly archived, so be judicious about what is in any screenshots, etc.
|
HighwayRob |
OK..now that we have come this far. Once I add more data entry fields and add an UPDATE button and the user clicks update, I need to get the GUID (or whatever its is called in android world) how do I translate that the spinner is on entry '2' and entry 2 is associated to Steve Coomes and {4545-ed99-.....} The spinner is tied to some array adapter.
|
Mark M. |
call getSelectedItem() to get whatever model object is in your adapter at the selected position
|
Mark M. |
in other words, if you have an ArrayAdapter<Person>, getSelectedItem() returns the Person that is selected in the Spinner
|
Nov 28 | 9:25 AM |
Mark M. |
or, if you prefer, call getSelectedItemPosition() to get the zero-based index of the current selection
|
HighwayRob |
Need the EmployeeID
|
HighwayRob |
View paste
(8 more lines)
|
Mark M. |
does EmployeeMaster have the EmployeeID?
|
Mark M. |
it looks like it should
|
HighwayRob |
View paste
|
Mark M. |
does your Spinner use an ArrayAdapter<EmployeeMaster> ?
|
HighwayRob |
View paste
|
Mark M. |
spin.getSelectedItem() will return you the selected EmployeeMaster
|
Mark M. |
call whatever method there is on EmployeeMaster to get the EmployeeID
|
HighwayRob |
ok..I will give this a whirl right now....but not thinking I got syntax correct.
|
Nov 28 | 9:35 AM |
HighwayRob |
View paste
|
HighwayRob | |
Mark M. |
parent is your Spinner
|
Mark M. |
change the type to AdapterView<EmployeeMaster>
|
Mark M. |
then call parent.getSelectedItem() to get the selected EmployeeMaster
|
Nov 28 | 9:40 AM |
HighwayRob | |
Mark M. |
post here the entire OnItemSelectedListener that this onItemSelected() method is a part of
|
Nov 28 | 9:45 AM |
Leora | has entered the room |
Mark M. |
Rob, let me take a question from Leora, and I'll be back with you shortly
|
Mark M. |
Leora: hi! how can I help you today?
|
Leora |
Hi Mark.
|
Leora |
I was wondering how I can debug Room orm - it doesn't seem to be inserting my entry
|
Leora |
Yet no indication of failing...
|
Mark M. |
how are you determining that it is not inserting your entry?
|
Leora |
All I know is when I query, I get nothin back
|
Mark M. |
are you sure that your query matches the data that you inserted?
|
Leora |
Well, I query @Query("SELECT * FROM downloads")
|
Leora |
so it should be returning something
|
Mark M. |
have you examined the database directly (Device File Explorer, Stetho, etc.) to see if the problem is with the insert or the query?
|
Nov 28 | 9:50 AM |
Leora |
No, I was wondering if it was hard-copied somewhere
|
Leora |
thanks! will do
|
Mark M. |
let me take a question from Rob, and I'll return to you in a bit if there's time
|
Mark M. |
Rob: your turn! do you have another question?
|
HighwayRob |
View paste
|
HighwayRob |
oops delete that, wroing paste
|
HighwayRob |
wronge paste
|
HighwayRob |
View paste
(23 more lines)
|
Mark M. |
the simplest solution is to make spin be a field in the activity, not a local variable
|
Mark M. |
then your onItemSelected() method can refer to spin directly
|
Mark M. |
and that means you can roll back to AdapterView<?> for the first parameter to onItemSelected()
|
Mark M. |
alternatively, IIRC, you could change "implements AdapterView.OnItemSelectedListener" to "implements AdapterView<EmployeeMaster>.OnItemSelectedListener"
|
Mark M. |
at which point AdapterView<EmployeeMaster> should be OK in your onItemSelected() first parameter
|
Nov 28 | 9:55 AM |
Mark M. |
Leora: do you have another question?
|
Leora |
umm, just trying to find the db file
|
HighwayRob |
I am getting your point. Your time running out. Since I may have many spinners on a screen, option 1 may be good. Let me take a shot and send you an email. Thank you.
|
Mark M. |
Rob: OK
|
Leora |
i put in gradle arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
|
Mark M. |
Leora: if you are using Device File Explorer, it should be at /data/data/.../databases, where ... is your application ID
|
Mark M. |
your Gradle snippet is the schema, not the database
|
Leora |
oh :/
|
Mark M. |
the database will be on the device or emulator
|
Leora |
yes, it's not under the package
|
Mark M. |
so you either need to copy it off of there (e.g., with Device File Explorer in Android Studio 3.0) or embed something in your app to allow you to examine it (e.g., Stetho)
|
Leora |
what would the extension be? .db
|
Mark M. |
it would be whatever you named it
|
Leora |
ahhh
|
Mark M. |
IIRC, extensions are not added automatically
|
Leora |
(re instructions)
|
Leora |
IIRC?
|
Mark M. |
"if I recall correctly"
|
Nov 28 | 10:00 AM |
Leora |
ok great advice! thanks! here i go...
|
Mark M. |
that's a wrap for today's chat
|
Leora |
:)
|
Mark M. |
the transcript will be archived at https://commonsware.com/office-hours/ shortly
|
Mark M. |
the next chat is tomorrow at 7:30pm US Eastern
|
Mark M. |
have a pleasant day!
|
HighwayRob | has left the room |
Leora | has left the room |
Mark M. | turned off guest access |