Problem in baseadapter...please help

by scorpio » Thu, 22 May 2008 06:37:44 GMT


Sponsored Links
 i,

I tried to select an item from the list, but not getting somebody
please help. I struck here for a long time. Actually in this, i am
using Baseadapter. So How can i select. I tried with onItemClick, but
null pointer exception coming..


public class ListQuery extends ListActivity implements
OnItemClickListener {

SQLiteDatabase myDatabase = null;
int size = 20;
String[] iStuffarea = new String[size];
String[] iStuffage = new String[size];
String[] iStuffsex = new String[size];
String[] iStuffheight = new String[size];
String[] iStuffweight = new String[size];
String[] iStuffcity = new String[size];
String[] iStuffcountry = new String[size];
String[] uStuffarea = new String[size];
String[] uStuffage = new String[size];
String[] uStuffsex = new String[size];
String[] uStuffheight = new String[size];
String[] uStuffweight = new String[size];
String[] uStuffcity = new String[size];
String[] uStuffcountry = new String[size];
int count = 0;
ArrayList<String> results = new ArrayList<String>();

@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setListAdapter(new SpeechListAdapter(this));
getListView().setOnItemClickListener(this);
}

private class SpeechListAdapter extends BaseAdapter {

public SpeechListAdapter(Context context) {
mContext = context;

try {
myDatabase = mContext.openDatabase("Mobeegal", null);
String myCols[] = {"iStuffAge", "iStuffSex",
"iStuffHeight", "iStuffWeight", "iStuffArea", "iStuffCity",
"iStuffCountry"};
Cursor c = myDatabase.query(false, "IStuff", myCols,
null, null, null, null, null);

String myCols1[] = {"uStuffAgeRange", "uStuffSex",
"uStuffHeightRange", "uStuffWeightRange", "uStuffArea", "uStuffCity",
"uStuffCountry"};
Cursor c1 = myDatabase.query(false, "UStuff", myCols1,
null, null, null, null, null);

int uagecolumn = c1.getColumnIndex("uStuffAgeRange");
int usexcolumn = c1.getColumnIndex("uStuffSex");
int uheightcolumn =
c1.getColumnIndex("uStuffHeightRange");
int uweightcolumn =
c1.getColumnIndex("uStuffWeightRange");
int uareacolumn = c1.getColumnIndex("uStuffArea");
int ucitycolumn = c1.getColumnIndex("uStuffCity");
int ucountrycolumn =
c1.getColumnIndex("uStuffCountry");

int ageColumn = c.getColumnIndex("iStuffAge");
int sexColumn = c.getColumnIndex("iStuffSex");
int heightColumn = c.getColumnIndex("iStuffHeight");
int weightColumn = c.getColumnIndex("iStuffWeight");
int areaColumn = c.getColumnIndex("iStuffArea");
int cityColumn = c.getColumnIndex("iStuffCity");
int countryColumn = c.getColumnIndex("iStuffCountry");
if (c != null) {
count = 0;
if (c.first()) {
do {



Other Threads

1. Looking for contribution topi

Hi all,

I am looking to contribute to Android security and at the same time
write my thesis.
I have experience in C++ programming as well as other languages; and
also in coporate security management.

Any ideas of topics where I could help?

Luis

2. Keypad helpers

Hi all.

I have an EditText widget which is described as follows:

<EditText
                android:id="@+id/xcord"
                android:numeric="decimal"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                />

When my EditText receives focus, the keypad helper pops up (in my
emulator). Then when a button is clicked, I do stuff with the value
(in this case, I just display the value in a Toast). However the
keypad helper remains there and doesn't disappear, obscuring the main
part of the screen. How do I make the helper go away once I know the
user has finished typing?

Many thanks.
--~--~---------~--~----~------------~-------~--~----~

3. Emulator gsm call

4. Android + Security + maybe Trustzone

5. cancelling pending Toasts

6. list with multiple selection

7. id specify