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. Socket client does not work with emulator

Hi,

I am trying to create a connection between a server socket program
written in C and an android client socket program. Now when I write a
regular java client program such as:

try
{
        Socket socket = new Socket("localhost", 5554);
        PrintWriter out = new PrintWriter(echoSocket.getOutputStream
(), true);
}
catch(Exception e)
{
              //................
}
out.println("Hello World");

This program works perfectly and my server.c file receives the
message.
However, when I try the same program with the Android Emulator, I get
an "Error:java.net.ConnectException: localhost/127.0.0.1:5554 -
Connection refused" I have tried different ports as well (8888, 3490).
This works perfectly with the regular Java project, but the moment I
write the same code in an Android project I get that error. I have
been stuck on this all day and am really getting frustrated :( Would
appreciate any help!
--~--~---------~--~----~------------~-------~--~----~

2. USB On-The-Go

Hey Guys.

I am new to android, but have been developing apps and hardware for
years. I just want to know, is USB OTG supported by the Android
framework? I know its (seems to be) supported in hardware based on the
components found on the HTC PCboards...

Thanks!
Stromlo

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

3. How to use the Network Manager?

4. How does FW upgrade work without erasing user data?

5. Importante sobre XML en Android!

6. Resolving remote hostname .. !

7. What does "Battery Usage" Mean?