android.database.sqlite.SQLiteCursor@435b9ba0
I am getting the text 'android.database.sqlite.SQLiteCursor@435b9ba0' returned from a spinner.getSelectedItem().toString() call. I'm not sure why. The spinner is tied to a SimpleCursorAdapter.
Here is the code
cCategories = (Cursor) myAdapter.getAllCategories();
this.startManagingCursor(cCategories);
SimpleCursorAdapter scaCategories = new SimpleCursorAdapter(this, R.layout.track_category_item,cCategories,new String[] {DBAdapter.KEY_CATEGORIES_NAME},new int[]{R.id.text1});
scaCategories.setDropDownViewResource(R.layout.track_category_dropdown_item);
mCatSpinner = (Spinner) findViewById(R.id.thecategory);
mCatSpinner.setAdapter(scaCategories);
if(mCatSpinner.isSelected() != true) {
mCatSpinner.setSelection(0);
}
and the xml track_category_item.xml
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/text1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@android:id/text1"
style="?android:attr/spinnerItemStyle"
android:ellipsize="marquee"
android:singleLine="true">
</TextView>
track_category_dropdown_item.xml
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/text1"
style="?android:attr/spinnerDropDownItemStyle"
android:singleLine="true"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:ellipsize="marquee" />
The spinner xml looks like this
<Spinner
android:id="@+id/thecategory"
android:prompt="@string/SELECT_CATEGORY"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_x="15px"
android:layout_y="133px" >
</Spinner>
and the cursor being returned is
public Cursor getAllCategories()
{
return db.query(DATABASE_CATEGORIES_TABLE, new String[] {
KEY_CATEGORIES_ROWID,
KEY_CATEGORIES_NAME,
KEY_CATEGORIES_DEFAULT},
null,
null,
null,
null,
null);
}
The spinner appears to work properly. When I try to save this is what is passed as the value of the selected item using spinner.getSelectedItem().toString().
Anyone see anything blatently wrong here. not sure what to do.
thanks patrick
Asked by: Brooke517 | Posted: 24-01-2022
Answer 1
Your code is working as you wrote it. Spinner
is an AdapterView
. The adapter you connected it to is a SimpleCursorAdapter
. This means that the selected item is a Cursor
(positioned at the item in the Cursor's result set corresponding with the user's choice). Cursor
has the default implementation of toString()
, which returns something like android.database.sqlite.SQLiteCursor@435b9ba0
.
Since you didn't tell us what you are trying to do, it is impossible to accurately advise you further. Whatever it is you want to save, however, needs to be pulled out of the Cursor
you get from getSelectedItem()
.
Answer 2
i can be bothered reading your context, but just wanted to briefly help.
i have a column named after DbHelper.KEY_COL
, and i am retrieving a DbHelper.KEY_COL
value at a specific row.
perhaps some of my code would help:
Cursor colCur=(Cursor)spCols.getSelectedItem();
String col=colCur.getString(colCur.getColumnIndex(DbHelper.KEY_COL));
Answered by: Vanessa952 | Posted: 25-02-2022
Similar questions
android.intent.action.SCREEN_OFF
I am trying to detect Screen backlight On / Off.
I've found android.intent.action.SCREEN_OFF related its event.
But I don't know how to use this.
Can you suggest me about how to detect screen backlight on / off ?
I missing some example or sample code.
Thanks in advance.
Android-sharedpreference
This question already has answers here:
android.database.sqlite.SQLiteConstraintException
android.database.sqlite.SQLiteConstraintException:
error code 19: constraint failed
error in my application and not sure why.
It happens when i add a new Inbox item into my database.
here is the Create statement of my inbox table:
CREATE TABLE inbox (uid text, title text, sender text, timeRecieved text, PRIMARY KEY(uid));
implemented u...
"android.intent.extra.durationLimit"
Hi
the above constant have no effect in Htc phone ,i have used that one in my video recording ,except Htc phone it work fine
android:stretchColumns
I guess I just havent found a good explanation here. So can anyone please tell me what android:stretchColumns actually does? I have it in my table and have tried several different values but cannot seem to figure out what it is doing.
Sorry for the dumb question!
images,sdcard,android
I want to write code to display the images only from a particular
folder in sdcard. e.g a folder named (/sdcard/folder/).
I have the following code, but it displays all the images in the
sdcard. What should I add/change in the following code to accompalish
my objective.
Should I change the query.If yes how should I change change it.
Please help me.
Thanks
`
String[] img ...
Android:PopupWindow.showAtLocation()
Can anyone tell me the detail explanation of the param "parent" in the function PopupWindow.showAtLocation(View **parent**,int w,int h);
Thanks in advance!
android.location.Geocoder
Is there any license limits on this api call? (e.g frequency)
Any pointers? (geocoding seems to be the base for this api wrapper and does contain limitations)
?android:attr/selectableItemBackground
when writing my android app i used
android:background="?android:attr/selectableItemBackground"
I tried looking for attr.xml file that would be containing the source but i could not find it. Any ideas please on where i can find it. I found one attr.xml in
C:\Program Files (x86)\Android\android-sdk\platforms\android-13\data\res\values
but it did ...
listview:Android
I have the following issue in listview in android:
In my application I have 2 databases, I have to show this 2 databases in a single listview with a separator between them. Before I tried by using 2 listview that works fine, but now I want it all in a single listview. Please provide some design for this.
android.view.WindowLeaked
inviteBu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
if(ChoiceList.size()>0)
{
LayoutInflater factory = LayoutInflater.from(MobileConnectActivity.this);
final View textEntryView = factory.inflate(R.layout.invite_dialog, null);
...
android.widget.ArrayAdapter.getCount(ArrayAdapter.java:291)
How do I fix this error? I can't find anything to help me! Code snippets would be appreciated!
The reason the adapter for sp2 is set within the onItemSelected for sp1 is because I want the output for sp2 to be dependent on the selection made in sp1.
logcat:
08-05 16:36:24.856: D/dalvikvm(6606): GC_EXTERNAL_ALLOC freed 81K, 43% free 3119K/5379K, external 2770K/2773K, paused 28ms
08-05 16:...
Android-Listview
I'm retrieving data (user information), and dispaying it from a HashMap to ArrayAdpater (in listview). Whenever I click (or even scroll) on listview my application crashes.
Any idea why it's happening? Here's what I'm doing:
//..
Handler handler = new Handler();
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setC...
java.lang.NullPointerException:com.google.android.gms.maps.GoogleMap.moveCamera
I am currently working on the new Google Maps Android API v2.
My MapActivity class is working with my Samsung galaxy s3 ans s2 with the code below:
However, there are some particular devices are not working such as: GT-S5830i
class MapActivity extends FragmentActivity implements OnMapClickListener, OnMapLongClickListener, OnMarkerClickListener
{
@Override
protected void onCreate(Bu...
android.permission.INTERNET?
I'm using three buttons in my app
1) Feedback button: It allows the user to send feedback via any mail application
2) A share button which uses a share intent
3) A "rate app" button which opens my app's page on the play store
All the 3 buttons uses other applications to access the internet.
Do I need to add the android.permission.INTERNET permission in my manifest file?
"android.permission.ACCESS_CHECKIN_PROPERTIES"
I am very new to android can any one give some detail that why we use this permission "android.permission.ACCESS_CHECKIN_PROPERTIES"
android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:3147)
Any idea why would this crash appear? The trace has only native code so very hard to track it down. Happens on Samsung Galaxy s3 platform 4.1.2 when I run animation inside a Fragment and when animation ends I call notifyDataSetChanged for the FragmentStatePagerAdapter. The issue is not 100% reproducible.
Thanks.
Trace:
03-01 11:50:11.836: E/AndroidRunti...
android.support.v4.app.Fragment$InstantiationException
In my app,i get this error :
android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment kostas.menu.rssreader.BaseActivity$SampleListFragment: make sure class name exists, is public, and has an empty constructor that is public
I have an activity called BaseActivity in order to present a Sliding Menu (
android.widget.ImageView.<init>(ImageView.java:104)
I'm new to android, and I want to get images from the server and load them in the layout.
But my code only runs until Log.e("error","115"); the imageView can't initialize.
This is my code:
package com.example.mywaterfallversion2;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import a...
android.intent.action.SCREEN_OFF
I am trying to detect Screen backlight On / Off.
I've found android.intent.action.SCREEN_OFF related its event.
But I don't know how to use this.
Can you suggest me about how to detect screen backlight on / off ?
I missing some example or sample code.
Thanks in advance.
Android-sharedpreference
This question already has answers here:
android.database.sqlite.SQLiteConstraintException
android.database.sqlite.SQLiteConstraintException:
error code 19: constraint failed
error in my application and not sure why.
It happens when i add a new Inbox item into my database.
here is the Create statement of my inbox table:
CREATE TABLE inbox (uid text, title text, sender text, timeRecieved text, PRIMARY KEY(uid));
implemented u...
"android.intent.extra.durationLimit"
Hi
the above constant have no effect in Htc phone ,i have used that one in my video recording ,except Htc phone it work fine
android:stretchColumns
I guess I just havent found a good explanation here. So can anyone please tell me what android:stretchColumns actually does? I have it in my table and have tried several different values but cannot seem to figure out what it is doing.
Sorry for the dumb question!
images,sdcard,android
I want to write code to display the images only from a particular
folder in sdcard. e.g a folder named (/sdcard/folder/).
I have the following code, but it displays all the images in the
sdcard. What should I add/change in the following code to accompalish
my objective.
Should I change the query.If yes how should I change change it.
Please help me.
Thanks
`
String[] img ...
Android:PopupWindow.showAtLocation()
Can anyone tell me the detail explanation of the param "parent" in the function PopupWindow.showAtLocation(View **parent**,int w,int h);
Thanks in advance!
android.location.Geocoder
Is there any license limits on this api call? (e.g frequency)
Any pointers? (geocoding seems to be the base for this api wrapper and does contain limitations)
?android:attr/selectableItemBackground
when writing my android app i used
android:background="?android:attr/selectableItemBackground"
I tried looking for attr.xml file that would be containing the source but i could not find it. Any ideas please on where i can find it. I found one attr.xml in
C:\Program Files (x86)\Android\android-sdk\platforms\android-13\data\res\values
but it did ...
listview:Android
I have the following issue in listview in android:
In my application I have 2 databases, I have to show this 2 databases in a single listview with a separator between them. Before I tried by using 2 listview that works fine, but now I want it all in a single listview. Please provide some design for this.
android.intent.action.SCREEN_OFF
I am trying to detect Screen backlight On / Off.
I've found android.intent.action.SCREEN_OFF related its event.
But I don't know how to use this.
Can you suggest me about how to detect screen backlight on / off ?
I missing some example or sample code.
Thanks in advance.
Android-sharedpreference
This question already has answers here:
android.database.sqlite.SQLiteConstraintException
android.database.sqlite.SQLiteConstraintException:
error code 19: constraint failed
error in my application and not sure why.
It happens when i add a new Inbox item into my database.
here is the Create statement of my inbox table:
CREATE TABLE inbox (uid text, title text, sender text, timeRecieved text, PRIMARY KEY(uid));
implemented u...
"android.intent.extra.durationLimit"
Hi
the above constant have no effect in Htc phone ,i have used that one in my video recording ,except Htc phone it work fine
android:stretchColumns
I guess I just havent found a good explanation here. So can anyone please tell me what android:stretchColumns actually does? I have it in my table and have tried several different values but cannot seem to figure out what it is doing.
Sorry for the dumb question!
images,sdcard,android
I want to write code to display the images only from a particular
folder in sdcard. e.g a folder named (/sdcard/folder/).
I have the following code, but it displays all the images in the
sdcard. What should I add/change in the following code to accompalish
my objective.
Should I change the query.If yes how should I change change it.
Please help me.
Thanks
`
String[] img ...
Android:PopupWindow.showAtLocation()
Can anyone tell me the detail explanation of the param "parent" in the function PopupWindow.showAtLocation(View **parent**,int w,int h);
Thanks in advance!
android.location.Geocoder
Is there any license limits on this api call? (e.g frequency)
Any pointers? (geocoding seems to be the base for this api wrapper and does contain limitations)
?android:attr/selectableItemBackground
when writing my android app i used
android:background="?android:attr/selectableItemBackground"
I tried looking for attr.xml file that would be containing the source but i could not find it. Any ideas please on where i can find it. I found one attr.xml in
C:\Program Files (x86)\Android\android-sdk\platforms\android-13\data\res\values
but it did ...
listview:Android
I have the following issue in listview in android:
In my application I have 2 databases, I have to show this 2 databases in a single listview with a separator between them. Before I tried by using 2 listview that works fine, but now I want it all in a single listview. Please provide some design for this.
Still can't find your answer? Check out these communities...
Android Google Support | Android Community | Android Community (Facebook) | Dev.io Android