Problem in baseadapter..please help

by scorpio » Thu, 22 May 2008 06:37:15 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. How to find the VERSION of the Android source code?

Hi All,

Is there any command/README FILE to find the version of paticular
Android Source Code?

How do I find out the version of source code?


Thanks & Regards,
Rajesh.M

--~--~---------~--~----~------------~-------~--~----~

2. Locked Phones for development.

Hi All,

According to rumors there are 18 Android phones in the work for 2009.
These are probably locked to a certain carrier.  If I have one of
these LOCKED phones can I debug apps on it?

John

--~--~---------~--~----~------------~-------~--~----~

3. Getting a reference to the View corresponding to the id passed to setContentView()

4. Early media over GSM (similar to SIP 183, or ISDN alerting phase)

5. AutoCompleteTextView and AdapterView.onItemClickListener with onscreen keyboard not working

6. Maximum SD Card size?

7. Android 1.5 (Cupcake) permissions on Location/GPS settings