Ok guys, so as an Android newbie Im working my way through various things. My issue here is Im trying to start a new intent activity in a 'onListItemClick'. I have the method set up for this but when i run the AVD upon clicking the item in the list, nothing happens, the intent doesn't start.
If I change the the super class to 'ListActivity' I get a crash message of 'your content must have a listview whose id attribute is 'android.r.id.list''
Can anyone tell me why the intent wont start from clicking the item in the listview? Here's my listview class:
package com.example.sqliteexample;
import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.support.v4.widget.SimpleCursorAdapter;
import android.view.View;
import android.widget.ListView;
import android.widget.Toast;
public class SQLView extends ListActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
HotOrNot H = new HotOrNot(this, null, null);
setContentView(R.layout.layout);
ListView listContent = (ListView)findViewById(R.id.contentList);
HotOrNot Content = new HotOrNot(this, null, null);
Content.open();
Cursor cursor = Content.getData();
startManagingCursor(cursor);
@SuppressWarnings("static-access")
String [] from = new String [] {H.KEY_NAME, H.KEY_HOTNESS};
int [] to = new int [] {R.id.txtName, R.id.txtAge};
@SuppressWarnings("deprecation")
SimpleCursorAdapter cursorAdapter = new SimpleCursorAdapter(this, R.layout.entries, cursor, from, to);
listContent.setAdapter(cursorAdapter);
}
public void onListItemClick(ListView l, View v, int posistion, long id)
{
Intent i = new Intent("com.example.sqliteexample.SQLiteExample");
startActivity(i);
}
}