I have a app that shows a ListView with several documents (DOC, PDF, PPT...). Selection one of them, I use the following code to show the document:
Intent intent = new Intent(android.content.Intent.ACTION_VIEW);
String extension = android.webkit.MimeTypeMap.getFileExtensionFromUrl(Uri.fromFile(outFile).toString());
String mimetype = android.webkit.MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension);
if (extension.equalsIgnoreCase("") || mimetype == null) {
intent.setDataAndType(Uri.fromFile(outFile), "text/*");
} else {
intent.setDataAndType(Uri.fromFile(outFile), mimetype);
}
startActivity(Intent.createChooser(intent, "Choose an Application:"));
That works fine for the the first document selected, Polaris Office opens and show the document - fine. When switching back for selecting the next document, my application is not on the last screen shown, instead it starts again. Selecting the document works and open fine in Polaris. When now switching back, the app crashes with Unable to start activity ...MainActivity ... NullPointerExpetion.
What can I do to solve this problem?
Here the LogCat:
10-25 10:07:43.476: D/AndroidRuntime(8396): Shutting down VM
10-25 10:07:43.476: W/dalvikvm(8396): threadid=1: thread exiting with uncaught exception (group=0x415092a0)
10-25 10:07:43.507: E/AndroidRuntime(8396): FATAL EXCEPTION: main
10-25 10:07:43.507: E/AndroidRuntime(8396): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.astrex.ppastrex/com.astrex.ppastrex.MainActivity}: java.lang.NullPointerException
10-25 10:07:43.507: E/AndroidRuntime(8396): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
10-25 10:07:43.507: E/AndroidRuntime(8396): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2122)
10-25 10:07:43.507: E/AndroidRuntime(8396): at android.app.ActivityThread.access$600(ActivityThread.java:140)
10-25 10:07:43.507: E/AndroidRuntime(8396): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1228)
10-25 10:07:43.507: E/AndroidRuntime(8396): at android.os.Handler.dispatchMessage(Handler.java:99)
10-25 10:07:43.507: E/AndroidRuntime(8396): at android.os.Looper.loop(Looper.java:137)
10-25 10:07:43.507: E/AndroidRuntime(8396): at android.app.ActivityThread.main(ActivityThread.java:4895)
10-25 10:07:43.507: E/AndroidRuntime(8396): at java.lang.reflect.Method.invokeNative(Native Method)
10-25 10:07:43.507: E/AndroidRuntime(8396): at java.lang.reflect.Method.invoke(Method.java:511)
10-25 10:07:43.507: E/AndroidRuntime(8396): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:994)
10-25 10:07:43.507: E/AndroidRuntime(8396): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:761)
10-25 10:07:43.507: E/AndroidRuntime(8396): at dalvik.system.NativeStart.main(Native Method)
10-25 10:07:43.507: E/AndroidRuntime(8396): Caused by: java.lang.NullPointerException
10-25 10:07:43.507: E/AndroidRuntime(8396): at com.astrex.ppastrex.FrameDocumentos.onCreateView(FrameDocumentos.java:66)
10-25 10:07:43.507: E/AndroidRuntime(8396): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1478)
10-25 10:07:43.507: E/AndroidRuntime(8396): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:927)
10-25 10:07:43.507: E/AndroidRuntime(8396): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
10-25 10:07:43.507: E/AndroidRuntime(8396): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1086)
10-25 10:07:43.507: E/AndroidRuntime(8396): at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1877)
10-25 10:07:43.507: E/AndroidRuntime(8396): at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:552)
10-25 10:07:43.507: E/AndroidRuntime(8396): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1178)
10-25 10:07:43.507: E/AndroidRuntime(8396): at android.app.Activity.performStart(Activity.java:5173)
10-25 10:07:43.507: E/AndroidRuntime(8396): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2070)
10-25 10:07:43.507: E/AndroidRuntime(8396): ... 11 more
I had a similar issue happening for me on Android 6.0, but not in 4.4, so for older devices, it would work fine and there would be no crash.
In my case, I was downloading a url, saving the file and opening them in 3rd party viewers.
I've discovered that as long as I save the pdf to the Downloads Directory, it fixes it for my situation.
File root = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
File dir = new File(root.getAbsolutePath());
if (dir.exists() == false) {
dir.mkdirs();
}
String fileName = "filename.pdf";
file = new File(dir, fileName);
try like this:
File file = new File(pdfpath);
if (file.exists()) {
Uri path = Uri.fromFile(file);
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(path, "application/pdf");
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
try {
startActivity(intent);
finish();
}
catch (ActivityNotFoundException e) {
}
}
The intent looks like it was called correctly it works for some. Seems like you'd have a null reference without checking if the file exists.
Experience tells me the null comes because your device ran out of memory while opening the pdf file so your app was shut down to free up some memory.
The solution is to add the savedinstancestate method saving what your app needs and check if the savedinstancestate != null in your oncreate method then recreate what your app needs from the savedinstancestate.
Related
I am trying to get my android app invoke HP ePrint PDF Preview Activity.
Intent intent = new Intent ();
intent.setPackage("com.hp.android.print");
intent.setClassName("com.hp.android.print", "com.hp.android.print.preview.PdfPreviewActivity");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Uri uri = Uri.parse("http://www.pdf995.com/samples/pdf.pdf");
intent.setDataAndType( uri, "application/pdf" );
if (intent.resolveActivity(getPackageManager()) != null)
{
getBaseContext().startActivity(intent);
}
I am getting the below error (taken from Logcat of the device):
2014-03-13 03:02:20.915 D 11119/AndroidRuntime: Shutting down VM
2014-03-13 03:02:20.915 W 11119/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x40a491f8)
2014-03-13 03:02:20.925 E 11119/AndroidRuntime: FATAL EXCEPTION: main
**java.lang.RuntimeException: Unable to start activity ComponentInfo{com.hp.android.print/com.hp.android.print.preview.PdfPreviewActivity}:** java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
at android.app.ActivityThread.access$600(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
**Caused by: java.lang.NullPointerException
at com.hp.android.print.utils.UriUtils.normalizeIntent(UriUtils.java:133)**
at com.hp.android.print.preview.PdfPreviewActivity.onContinueCreate(PdfPreviewActivity.java:123)
at com.hp.android.print.preview.PrintPreview.handleExternalReceivedIntent(PrintPreview.java:261)
at com.hp.android.print.preview.PrintPreview.onCreate(PrintPreview.java:181)
at android.app.Activity.performCreate(Activity.java:4465)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
... 11 more
2014-03-13 03:02:20.935 W 132/ActivityManager: Force finishing activity com.hp.android.print/.preview.PdfPreviewActivity
2014-03-13 03:02:20.955 W 132/ActivityManager: Force finishing activity com.example.droidprinttest/.MainActivity
HP ePrint works fine when used manually. Any idea about a fix?
[EDIT] My Goal is to get a PDF file printed on the fly, a solution without preview is okay for me too.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
10-25 05:30:06.560: W/dalvikvm(1428): threadid=1: thread exiting with uncaught exception (group=0x40a71930)
10-25 05:30:06.670: E/AndroidRuntime(1428): FATAL EXCEPTION: main
10-25 05:30:06.670: E/AndroidRuntime(1428): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.androidhiv/com.example.androidhiv.AllProductsActivity}; have you declared this activity in your AndroidManifest.xml?
10-25 05:30:06.670: E/AndroidRuntime(1428): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1618)
10-25 05:30:06.670: E/AndroidRuntime(1428): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1417)
10-25 05:30:06.670: E/AndroidRuntime(1428): at android.app.Activity.startActivityForResult(Activity.java:3370)
10-25 05:30:06.670: E/AndroidRuntime(1428): at android.app.Activity.startActivityForResult(Activity.java:3331)
10-25 05:30:06.670: E/AndroidRuntime(1428): at android.app.Activity.startActivity(Activity.java:3566)
10-25 05:30:06.670: E/AndroidRuntime(1428): at android.app.Activity.startActivity(Activity.java:3534)
10-25 05:30:06.670: E/AndroidRuntime(1428): at com.example.androidhiv.MainScreenActivity$1.onClick(MainScreenActivity.java:31)
10-25 05:30:06.670: E/AndroidRuntime(1428): at android.view.View.performClick(View.java:4204)
10-25 05:30:06.670: E/AndroidRuntime(1428): at android.view.View$PerformClick.run(View.java:17355)
10-25 05:30:06.670: E/AndroidRuntime(1428): at android.os.Handler.handleCallback(Handler.java:725)
10-25 05:30:06.670: E/AndroidRuntime(1428): at android.os.Handler.dispatchMessage(Handler.java:92)
10-25 05:30:06.670: E/AndroidRuntime(1428): at android.os.Looper.loop(Looper.java:137)
10-25 05:30:06.670: E/AndroidRuntime(1428): at android.app.ActivityThread.main(ActivityThread.java:5041)
10-25 05:30:06.670: E/AndroidRuntime(1428): at java.lang.reflect.Method.invokeNative(Native Method)
10-25 05:30:06.670: E/AndroidRuntime(1428): at java.lang.reflect.Method.invoke(Method.java:511)
10-25 05:30:06.670: E/AndroidRuntime(1428): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
10-25 05:30:06.670: E/AndroidRuntime(1428): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
10-25 05:30:06.670: E/AndroidRuntime(1428): at dalvik.system.NativeStart.main(Native Method)
Make sure that this Activity is register in Android Manifeast
You have not declared your Activity AllProductsActivity in your manifest file and the compiler is unable to find that Activity hence throwing error.
Declare Activity AllProductsActivity in your manifest file.
like this
<activity android:name="com.example.androidhiv.AllProductsActivity"
></activity>
Its showing that you have not declared your AllProductsActivity in your manifest file.
<activity
android:name="com.example.androidhiv.AllProductsActivity"
/>
You had to declare each and every Acticity which you want to show in your application it had to be declare in AndroidManifest.xml file.
<activity android:name="com.example.androidhiv.AllProductsActivity" />
I am exploring Xively Framework using Android client.
I have installed "service" given in Demo application.
When I start app on Android 2.3 and 4.0 device it is crashing .
Below is stack track for the same.Surprisingly it is working on Android 4.1.
Any suggestion what need to done do make it work on Android 2.3 and 4.0 devices
Stacktrace
10-25 18:25:18.854: D/HttpService(17080): onCreate()
10-25 18:25:18.874: W/dalvikvm(17080): Exception Ljava/lang/RuntimeException; thrown while initializing Landroid/os/AsyncTask;
10-25 18:25:18.884: E/JavaBinder(17080): * Uncaught remote exception! (Exceptions are not yet supported across processes.)
10-25 18:25:18.884: E/JavaBinder(17080): java.lang.ExceptionInInitializerError
10-25 18:25:18.884: E/JavaBinder(17080): at com.xively.android.service.HttpService.executeRequest(HttpService.java:276)
10-25 18:25:18.884: E/JavaBinder(17080): at com.xively.android.service.HttpService.put(HttpService.java:235)
10-25 18:25:18.884: E/JavaBinder(17080): at com.xively.android.service.HttpService.access$1(HttpService.java:232)
10-25 18:25:18.884: E/JavaBinder(17080): at com.xively.android.service.HttpService$1.updateFeed(HttpService.java:73)
10-25 18:25:18.884: E/JavaBinder(17080): at com.xively.android.service.IHttpService$Stub.onTransact(IHttpService.java:77)
10-25 18:25:18.884: E/JavaBinder(17080): at android.os.Binder.execTransact(Binder.java:338)
10-25 18:25:18.884: E/JavaBinder(17080): at dalvik.system.NativeStart.run(Native Method)
10-25 18:25:18.884: E/JavaBinder(17080): Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
10-25 18:25:18.884: E/JavaBinder(17080): at android.os.Handler.(Handler.java:121)
10-25 18:25:18.884: E/JavaBinder(17080): at android.os.AsyncTask$InternalHandler.(AsyncTask.java:607)
10-25 18:25:18.884: E/JavaBinder(17080): at android.os.AsyncTask$InternalHandler.(AsyncTask.java:607)
10-25 18:25:18.884: E/JavaBinder(17080): at android.os.AsyncTask.(AsyncTask.java:190)
10-25 18:25:18.884: E/JavaBinder(17080): ... 7 more
10-25 18:25:18.884: W/dalvikvm(17080): threadid=9: thread exiting with uncaught exception (group=0x40c2e1f8)
10-25 18:25:18.884: E/AndroidRuntime(17080): FATAL EXCEPTION: Binder Thread #1
10-25 18:25:18.884: E/AndroidRuntime(17080): java.lang.ExceptionInInitializerError
10-25 18:25:18.884: E/AndroidRuntime(17080): at com.xively.android.service.HttpService.executeRequest(HttpService.java:276)
10-25 18:25:18.884: E/AndroidRuntime(17080): at com.xively.android.service.HttpService.put(HttpService.java:235)
10-25 18:25:18.884: E/AndroidRuntime(17080): at com.xively.android.service.HttpService.access$1(HttpService.java:232)
10-25 18:25:18.884: E/AndroidRuntime(17080): at com.xively.android.service.HttpService$1.updateFeed(HttpService.java:73)
10-25 18:25:18.884: E/AndroidRuntime(17080): at com.xively.android.service.IHttpService$Stub.onTransact(IHttpService.java:77)
10-25 18:25:18.884: E/AndroidRuntime(17080): at android.os.Binder.execTransact(Binder.java:338)
10-25 18:25:18.884: E/AndroidRuntime(17080): at dalvik.system.NativeStart.run(Native Method)
10-25 18:25:18.884: E/AndroidRuntime(17080): Caused by: java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
10-25 18:25:18.884: E/AndroidRuntime(17080): at android.os.Handler.(Handler.java:121)
10-25 18:25:18.884: E/AndroidRuntime(17080): at android.os.AsyncTask$InternalHandler.(AsyncTask.java:607)
10-25 18:25:18.884: E/AndroidRuntime(17080): at android.os.AsyncTask$InternalHandler.(AsyncTask.java:607)
10-25 18:25:18.884: E/AndroidRuntime(17080): at android.os.AsyncTask.(AsyncTask.java:190)
10-25 18:25:18.884: E/AndroidRuntime(17080): ... 7 more
There is a known issue wit the Android library. There is an open issue in Github. The team is working on testing a fix but basically it is a user contributed library that is highly unstable.
You are best off using HttpClient and performing the API functions from there. This will allow you to use Xively with Android.
I am writing a program that it needs Activity A to write data to a database, while Activity B read data from the database. I extended SQLiteOpenHelper Class as DatabaseHelper, and I get my database in Activity A in this way:
SQLiteOpenHelper dbHelper = new DatabaseHelper(this, "classtableDatabase", null, 1);
SQLiteDatabase db = dbHelper.getWritableDatabase();
It works in Activity well.
When I try to open the database created by Activity A in Activity B in same way, it failed and I get these error messages:
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{cn.square2.iscut/cn.square2.iscut.ClassTableDetails}: java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1891)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
at android.app.ActivityThread.access$600(ActivityThread.java:127)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4441)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:823)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:590)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:221)
at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:157)
at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:231)
at cn.square2.iscut.ClassTableDetails.<init>(ClassTableDetails.java:28)
at java.lang.Class.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1319)
at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1882)
... 11 more
What should I do to fix this issue? Thank you for your help!
I had the same problem. You don't need to do anything just make static references to the database from the activities other than your MAIN activity.
I'm getting overly frustrated with this issue. First of all, this did work fine with no issues, I have no idea why I'm now getting this error.
The application runs fine on my phone (v2.3.4) but not on one emulator (1.6 > 2.3)
The error I'm getting is 'NullPointerException' immediately after I load the application. Heres the DDMS
08-24 21:10:11.706: WARN/dalvikvm(423): threadid=1: thread exiting with uncaught exception (group=0x40015560)
08-24 21:10:11.726: ERROR/AndroidRuntime(423): FATAL EXCEPTION: main
08-24 21:10:11.726: ERROR/AndroidRuntime(423): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.myapp.app/com.myapp.app.SplashActivity}: java.lang.NullPointerException
08-24 21:10:11.726: ERROR/AndroidRuntime(423): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1622)
08-24 21:10:11.726: ERROR/AndroidRuntime(423): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1638)
08-24 21:10:11.726: ERROR/AndroidRuntime(423): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
08-24 21:10:11.726: ERROR/AndroidRuntime(423): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:928)
08-24 21:10:11.726: ERROR/AndroidRuntime(423): at android.os.Handler.dispatchMessage(Handler.java:99)
08-24 21:10:11.726: ERROR/AndroidRuntime(423): at android.os.Looper.loop(Looper.java:123)
08-24 21:10:11.726: ERROR/AndroidRuntime(423): at android.app.ActivityThread.main(ActivityThread.java:3647)
08-24 21:10:11.726: ERROR/AndroidRuntime(423): at java.lang.reflect.Method.invokeNative(Native Method)
08-24 21:10:11.726: ERROR/AndroidRuntime(423): at java.lang.reflect.Method.invoke(Method.java:507)
08-24 21:10:11.726: ERROR/AndroidRuntime(423): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
08-24 21:10:11.726: ERROR/AndroidRuntime(423): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
08-24 21:10:11.726: ERROR/AndroidRuntime(423): at dalvik.system.NativeStart.main(Native Method)
08-24 21:10:11.726: ERROR/AndroidRuntime(423): Caused by: java.lang.NullPointerException
08-24 21:10:11.726: ERROR/AndroidRuntime(423): at com.myapp.app.SplashActivity.onCreate(SplashActivity.java:43)
08-24 21:10:11.726: ERROR/AndroidRuntime(423): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
08-24 21:10:11.726: ERROR/AndroidRuntime(423): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1586)
08-24 21:10:11.726: ERROR/AndroidRuntime(423): ... 11 more
OK, so I look up what caused the problem (08-24 21:10:11.726: ERROR/AndroidRuntime(423): at com.myapp.app.SplashActivity.onCreate(SplashActivity.java:43))
Here is my onCreate:
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.welcome);
Button playBtn = (Button) findViewById(R.id.playBtn);
playBtn.setOnClickListener(this);
Button settingsBtn = (Button) findViewById(R.id.settingsBtn);
settingsBtn.setOnClickListener(this);
Button rulesBtn = (Button) findViewById(R.id.rulesBtn);
rulesBtn.setOnClickListener(this);
Button exitBtn = (Button) findViewById(R.id.exitBtn);
exitBtn.setOnClickListener(this);
}
Line 43 is the last one: exitBtn.setOnClickListener(this);
This is handled later on in the app using a switch statement for each button, the only code for the exit button is 'finish();' but it crashes 'onCreate' not onClick.
This is making no sense to me, this used to work fine and I haven't changed the code relating to this since it previously worked. Also, the exit button is set up exactly the same as all the other buttons (in src and layout files), so why would it crash when it gets to the exit button? As I said, this works OK on my cyn7 device but not on any of the emulators (it did)
This app has taken a massive amount of work to get it to this point, I was just doing final tests when this began.. so infuriating!
Can anyone please offer any suggestions to fix or even as to why this may happen?
EDIT: OK, this is really strange. I commented out the Exit button. Now my 'Play' button does nothing (even in DDMS it shows up nothing) the settings up OK and the Rules crashes, with the same error for the Rules activity on a setOnClickListener(this). Which makes no sense as the settings activity also has a 'setOnClickListener'. What is going on?!
Sounds like a corrupt worksapce. Android in Eclipse sometimes gets the autogenerated resource files out of sysnc with the actual layout. As Xion mentioned, a clean and rebuild will fix this via Project -> Clean... -> Clean all projects. Before doing this, ensure that Project -> Build Automatically is ticked.