File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Android Security Essentials Live Lessons this week in the Android 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: 41182
    
  45
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: 41182
    
  45
That's a completely different question, please keep topics focused on a single question.
 
I agree. Here's the link: http://aspose.com/file-tools
 
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