tags:

views:

32

answers:

3

I have a listview. Whenever I strike an item of listview the debugger gets opened instead of starting a new activity (i.e. what I want).

here is the listview code..

setListAdapter(new ArrayAdapter<String>(this, R.layout.list_item, s));
        ListView lv = getListView();
        lv.setTextFilterEnabled(true);
        lv.setOnItemClickListener(new OnItemClickListener() {
            public void onItemClick(AdapterView<?> parent, View view,int position, long id) {
                startAc();
    }
  });

the startAc() function is defined on top as:

public void startAc()
    {
        startActivity( new Intent(this, contents.class) );
    }

the contents class file is defined as:

package com.webkul.feedGrabber;

import android.app.ListActivity;
import android.os.Bundle;

public class contents extends ListActivity{
     @Override
     protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.m);
     }
}

P.S. all the xml files are correct.

A: 

you must have a breakpoint in your code

try

run > remove all breakpoints

Jorgesys
i haven't placed any breakpoints in the project. There exist certain warnings.. thats it.
vaibhav
A: 

Have you tried to start the activity by result?

Intent i = new Intent(this, contents.class);
startActivityForResult(i, SOME_INT);

Actually I am a bit "poked" by the listview code. I would suggest to search there.

Keenora Fluffball
A: 

I think with just startActivity()

public void startAc() {     
    Intent myIntent = new Intent(getApplicationContext(), contents.class);
    startActivity(myIntent);
}
Jorgesys