This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Android and the fly likes Why the program not run? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Mobile » Android
Bookmark "Why the program not run?" Watch "Why the program not run?" New topic
Author

Why the program not run?

fahimeh hashemian
Ranch Hand

Joined: Aug 07, 2012
Posts: 84
Hi
I write this code in Mian.java class but the program not run. Why? the program has error of Intent i=new Intent(this,Location.class); what is the problem??

The problem is : The constructor Intent(new View.OnClickListener(){}, Class<Location>) is undefined

Please help me fast ;)

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41060
    
  43
An OnClickListener is not a Context - which is what the Intent constructor expects as the first parameter. You probably meant to pass in the Main instance instead.


Ping & DNS - my free Android networking tools app
fahimeh hashemian
Ranch Hand

Joined: Aug 07, 2012
Posts: 84
I want, when user clicks in places button, the program goes to another class and run location class. this code is false?

I change this to Main.this and program runs but when i clicked in Places, the program stop. Why? I write LogCat in below

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41060
    
  43
That's a completely different question, please keep topics focused on a single question.
 
Don't get me started about those stupid light bulbs.
 
subject: Why the program not run?
 
Similar Threads
getting real path from an image uri after camera and uploading-getting null pointer exception
ftp uploads but only the second time a picture is taken?
Problem with creating a simple Menu in Browser view.
Cannot find the problem in the code
public void onClick(View v) { // error