Calling an activity when an item is pressed in a ListView in an Android app?

You are getting this error because you are passing an instance of OnItemClickListener to your intent. Try to pass the instance of Actiity Intent lp = new Intent(YourActivity. This, myFirst.

Class); startActivity(lp).

1 And make sure you have defined your myFirst as an Activity in Manifest. By convention the class name must start with capital character. (i.

E MyFirst. Class) – Adil Soomro Jul 15 at 5:02 Thank you very much, that was it. I changed the "this" to "MyActivity.

This" and the error went away. – TJ1 Jul 15 at 5:23 Glad that you fixed your problem. Happy Coding!

– Tanmay Mandal Jul 15 at 5:23.

I think I can help you in this. 'this' may not be refering to your current activity. Instead of 'this', use the following.

NameOfTheActivityThatIsCurrentlyOpen. This(i.e. , the filename.

This). This always works.

Thanks for the answer, it was basically the same answer as what @Tanamy suggested. – TJ1 Jul 15 at 5:25.

You can do like this way Intent lp = new Intent(.this,myFirst. Class); or Intent lp = new Intent(getApplicationContext(),myFirst. Class); lp.

SetFlag(Intent. FLAG_ACTIVITY_NEW_TASK); startActivity(lp).

Thanks, this is also the same as above answers. – TJ1 Jul 15 at 5:25.

Called when the activity is first created. Lv1 = (ListView) findViewById(R.id. Public void onItemClick(AdapterView Intent I = new Intent(this, abc.

06-09 12:29:52.181: INFO/ActivityManager(60): Start proc com.example. Listview for activity com.example. 06-09 12:29:54.670: INFO/ActivityManager(60): Displayed activity com.example.

06-09 12:30:50.140: DEBUG/SntpClient(60): request time failed: java.net. 06-09 12:35:50.171: DEBUG/SntpClient(60): request time failed: java.net.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions