How to fix problem with resources on android? - android

Getting the following in LogCat:
03-28 16:18:57.795: WARN/ResourceType(8351): No package identifier when getting name for resource number 0x00000001
03-28 16:18:57.865: WARN/ImageView(8351): Unable to find resource: 1
03-28 16:18:57.865: WARN/ImageView(8351): android.content.res.Resources$NotFoundException: Resource ID #0x1
03-28 16:18:57.865: WARN/ImageView(8351): at android.content.res.Resources.getValue(Resources.java:891)
03-28 16:18:57.865: WARN/ImageView(8351): at android.content.res.Resources.getDrawable(Resources.java:579)
03-28 16:18:57.865: WARN/ImageView(8351): at android.widget.ImageView.resolveUri(ImageView.java:485)
03-28 16:18:57.865: WARN/ImageView(8351): at android.widget.ImageView.setImageResource(ImageView.java:270)
03-28 16:18:57.865: WARN/ImageView(8351): at android.widget.SimpleCursorAdapter.setViewImage(SimpleCursorAdapter.java:217)
03-28 16:18:57.865: WARN/ImageView(8351): at android.widget.SimpleCursorAdapter.bindView(SimpleCursorAdapter.java:165)
03-28 16:18:57.865: WARN/ImageView(8351): at android.widget.CursorAdapter.getView(CursorAdapter.java:186)
03-28 16:18:57.865: WARN/ImageView(8351): at android.widget.AbsListView.obtainView(AbsListView.java:1274)
03-28 16:18:57.865: WARN/ImageView(8351): at android.widget.ListView.measureHeightOfChildren(ListView.java:1147)
03-28 16:18:57.865: WARN/ImageView(8351): at android.widget.ListView.onMeasure(ListView.java:1060)
03-28 16:18:57.865: WARN/ImageView(8351): at android.view.View.measure(View.java:7964)
03-28 16:18:57.865: WARN/ImageView(8351): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3023)
03-28 16:18:57.865: WARN/ImageView(8351): at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:888)
03-28 16:18:57.865: WARN/ImageView(8351): at android.widget.LinearLayout.measureHorizontal(LinearLayout.java:619)
03-28 16:18:57.865: WARN/ImageView(8351): at android.widget.LinearLayout.onMeasure(LinearLayout.java:280)
03-28 16:18:57.865: WARN/ImageView(8351): at android.view.View.measure(View.java:7964)
03-28 16:18:57.865: WARN/ImageView(8351): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3023)
03-28 16:18:57.865: WARN/ImageView(8351): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
03-28 16:18:57.865: WARN/ImageView(8351): at android.view.View.measure(View.java:7964)
03-28 16:18:57.865: WARN/ImageView(8351): at android.widget.LinearLayout.measureVertical(LinearLayout.java:464)
03-28 16:18:57.865: WARN/ImageView(8351): at android.widget.LinearLayout.onMeasure(LinearLayout.java:278)
03-28 16:18:57.865: WARN/ImageView(8351): at android.view.View.measure(View.java:7964)
03-28 16:18:57.865: WARN/ImageView(8351): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:3023)
03-28 16:18:57.865: WARN/ImageView(8351): at android.widget.FrameLayout.onMeasure(FrameLayout.java:245)
03-28 16:18:57.865: WARN/ImageView(8351): at android.view.View.measure(View.java:7964)
03-28 16:18:57.865: WARN/ImageView(8351): at android.view.ViewRoot.performTraversals(ViewRoot.java:763)
03-28 16:18:57.865: WARN/ImageView(8351): at android.view.ViewRoot.handleMessage(ViewRoot.java:1633)
03-28 16:18:57.865: WARN/ImageView(8351): at android.os.Handler.dispatchMessage(Handler.java:99)
03-28 16:18:57.865: WARN/ImageView(8351): at android.os.Looper.loop(Looper.java:123)
03-28 16:18:57.865: WARN/ImageView(8351): at android.app.ActivityThread.main(ActivityThread.java:4363)
03-28 16:18:57.865: WARN/ImageView(8351): at java.lang.reflect.Method.invokeNative(Native Method)
03-28 16:18:57.865: WARN/ImageView(8351): at java.lang.reflect.Method.invoke(Method.java:521)
03-28 16:18:57.865: WARN/ImageView(8351): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
03-28 16:18:57.865: WARN/ImageView(8351): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
03-28 16:18:57.865: WARN/ImageView(8351): at dalvik.system.NativeStart.main(Native Method)
Actually, resource files exists (R.drawable.star_on at drawable-hdpi and drawable-ldpi, Eclipse has this value in autocomplete), here is the extract from R.java:
public static final class drawable {
public static final int star_off=0x7f020007;
public static final int star_on=0x7f020008;

Try cleaning and building the project.
Android is searching the image with id resource 0x00000001, which is not correct.
If that doesn't works try deleting the "gen" folder and building again.
Good luck :)

Strange, but the problem was with setViewValue function - I was changing ListView icon based on DB value and I didn't return true there (returned false) and hence I was getting this error.

Looks like a compilation error. Check your console for a red error message when it tries to build.
Does you have a resource that you have called 1.png 1.gif 1.mp4?
You cannot have resources that have a filename of a number.

Related

open folder programmatically - ActivityNotFoundException Android

I am trying to open the download's folder programmatically. But, I keep getting ActivityNotFoundException. I have seen various questions on this on StackOverflow, tried most of them, but nothing worked till now. Here is my code below
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse(downloadDirectoryPath));
startActivity(intent);
AndroidManifest.xml - related code
<activity
android:name="com.xx.xxx.videowebview.VideoWebViewActivity"
android:configChanges="orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:hardwareAccelerated="true"
android:label="#string/app_name"
android:theme="#style/custom_theme" >
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
I think I have set the required things in manifest too, but, I still keep getting the Exception.
I have a download button in VideoWebViewActivity, when clicked, downloads a file and then has to open the download folder on the device. Is setting, category to DEFAULT as above, correct? or should I be using a new activity(I don't really need any other activity, so should I be using a dummy activity? Doesn't sound right...)?
Here is my LogCat...
03-28 15:17:37.349: E/AndroidRuntime(15791): FATAL EXCEPTION: main
03-28 15:17:37.349: E/AndroidRuntime(15791): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=/mnt/sdcard/download/ }
03-28 15:17:37.349: E/AndroidRuntime(15791): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1409)
03-28 15:17:37.349: E/AndroidRuntime(15791): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
03-28 15:17:37.349: E/AndroidRuntime(15791): at android.app.Activity.startActivityForResult(Activity.java:2827)
03-28 15:17:37.349: E/AndroidRuntime(15791): at android.app.Activity.startActivity(Activity.java:2933)
03-28 15:17:37.349: E/AndroidRuntime(15791): at com.xx.xxx.videowebview.VideoWebViewActivity$DownloadFile.onPostExecute(VideoWebViewActivity.java:442)
03-28 15:17:37.349: E/AndroidRuntime(15791): at com.xx.xxx.videowebview.VideoWebViewActivity$DownloadFile.onPostExecute(VideoWebViewActivity.java:1)
03-28 15:17:37.349: E/AndroidRuntime(15791): at android.os.AsyncTask.finish(AsyncTask.java:417)
03-28 15:17:37.349: E/AndroidRuntime(15791): at android.os.AsyncTask.access$300(AsyncTask.java:127)
03-28 15:17:37.349: E/AndroidRuntime(15791): at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429)
03-28 15:17:37.349: E/AndroidRuntime(15791): at android.os.Handler.dispatchMessage(Handler.java:99)
03-28 15:17:37.349: E/AndroidRuntime(15791): at android.os.Looper.loop(Looper.java:130)
03-28 15:17:37.349: E/AndroidRuntime(15791): at android.app.ActivityThread.main(ActivityThread.java:3687)
03-28 15:17:37.349: E/AndroidRuntime(15791): at java.lang.reflect.Method.invokeNative(Native Method)
03-28 15:17:37.349: E/AndroidRuntime(15791): at java.lang.reflect.Method.invoke(Method.java:507)
03-28 15:17:37.349: E/AndroidRuntime(15791): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
03-28 15:17:37.349: E/AndroidRuntime(15791): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636)
03-28 15:17:37.349: E/AndroidRuntime(15791): at dalvik.system.NativeStart.main(Native Method)
I haven't yet figured it out, but, for now, I am directly opening the file that I downloaded using the below code...
File file = new File(path);
Uri uri_path = Uri.fromFile(file);
String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension
(MimeTypeMap.getFileExtensionFromUrl(path));
Intent intent = new Intent(android.content.Intent.ACTION_VIEW);
intent.setType(mimeType);
intent.setDataAndType(uri_path, mimeType);
startActivity(intent);
path = the path of the FILE(not directory) that you want to open.
Will update the answer, if I get to open the directory successfully.

Connect to neo4j using jersey from android using REST API

I have a neo4j server running on my laptop on the port 7474. It is enabled to listen on localhost:7474/ , 0.0.0.0:7474/ and :7474/. I am referring to the official documentation on the Community Documentation Page - http://docs.neo4j.org/chunked/milestone/server-java-rest-client-example.html.
I am trying to connect to the database and create a node through an android app.
I have added the jersey-bundle-1.8.jar in my app's libs folder. I am able to use all the functions defined in the library. No errors are reported for calling the functions.
Using the documentation, i am able to connect to the neo4j server running on my laptop as shown in the picture.
ISSUE FACED :
So moving ahead, i clicked the button to create a node, again picking the code from the reference page mentioned above.
What happened was that the app crashed and raised exceptions (as shown in the picture). The exceptions raised are attached in log
03-28 17:50:05.691: I/SurfaceTextureClient(10165): [STC::queueBuffer] (this:0x5cc8a588) fps:0.09, dur:10766.62, max:10766.62, min:10766.62
03-28 17:50:05.691: I/SurfaceTextureClient(10165): [STC::queueBuffer] this:0x5cc8a588, api:1, last queue time elapsed:10766.62
03-28 17:50:05.709: D/dalvikvm(10165): GC_CONCURRENT freed 272K, 16% free 5656K/6664K, paused 2ms+2ms, total 27ms
03-28 17:50:05.747: V/Provider/Settings(10165): invalidate [system]: current 208 != cached 0
03-28 17:50:05.750: V/Provider/Settings(10165): from db cache, name = sound_effects_enabled , value = 0
03-28 17:50:05.751: D/dalvikvm(10165): create interp thread : stack size=32KB
03-28 17:50:05.751: D/dalvikvm(10165): create new thread
03-28 17:50:05.751: D/dalvikvm(10165): new thread created
03-28 17:50:05.751: D/dalvikvm(10165): update thread list
03-28 17:50:05.751: D/dalvikvm(10165): threadid=12: interp stack at 0x5e2ef000
03-28 17:50:05.751: D/dalvikvm(10165): threadid=12: created from interp
03-28 17:50:05.751: D/dalvikvm(10165): start new thread
03-28 17:50:05.751: D/dalvikvm(10165): threadid=12: notify debugger
03-28 17:50:05.751: D/dalvikvm(10165): threadid=12 (AsyncTask #1): calling run()
03-28 17:50:05.768: I/dalvikvm(10165): Failed resolving Lcom/sun/jersey/core/osgi/OsgiRegistry; interface 2320 'Lorg/osgi/framework/SynchronousBundleListener;'
03-28 17:50:05.768: W/dalvikvm(10165): Link of class 'Lcom/sun/jersey/core/osgi/OsgiRegistry;' failed
03-28 17:50:05.768: I/dalvikvm(10165): Could not find method com.sun.jersey.core.osgi.OsgiRegistry.getInstance, referenced from method com.sun.jersey.core.reflection.ReflectionHelper.getOsgiRegistryInstance
03-28 17:50:05.768: W/dalvikvm(10165): VFY: unable to resolve static method 7747: Lcom/sun/jersey/core/osgi/OsgiRegistry;.getInstance ()Lcom/sun/jersey/core/osgi/OsgiRegistry;
03-28 17:50:05.768: D/dalvikvm(10165): VFY: replacing opcode 0x71 at 0x0008
03-28 17:50:05.769: I/dalvikvm(10165): Failed resolving Lcom/sun/jersey/core/osgi/OsgiRegistry; interface 2320 'Lorg/osgi/framework/SynchronousBundleListener;'
03-28 17:50:05.769: W/dalvikvm(10165): Link of class 'Lcom/sun/jersey/core/osgi/OsgiRegistry;' failed
03-28 17:50:05.770: W/dalvikvm(10165): VFY: unable to find class referenced in signature (Lcom/sun/jersey/core/osgi/OsgiRegistry;)
03-28 17:50:05.835: D/dalvikvm(10165): GC_CONCURRENT freed 359K, 17% free 5690K/6784K, paused 3ms+3ms, total 20ms
03-28 17:50:05.862: D/dalvikvm(10165): create interp thread : stack size=32KB
03-28 17:50:05.862: D/dalvikvm(10165): create new thread
03-28 17:50:05.862: D/dalvikvm(10165): new thread created
03-28 17:50:05.862: D/dalvikvm(10165): update thread list
03-28 17:50:05.862: D/dalvikvm(10165): threadid=13: interp stack at 0x5e2fb000
03-28 17:50:05.862: D/dalvikvm(10165): threadid=13: created from interp
03-28 17:50:05.863: D/dalvikvm(10165): start new thread
03-28 17:50:05.863: D/dalvikvm(10165): threadid=12: exiting
03-28 17:50:05.863: W/dalvikvm(10165): threadid=12: thread exiting with uncaught exception (group=0x41dba9a8)
03-28 17:50:05.863: W/System.err(10165): java.util.concurrent.ExecutionException: com.sun.jersey.api.client.ClientHandlerException: com.sun.jersey.api.client.ClientHandlerException: A message body writer for Java type, class java.lang.String, and MIME media type, application/json, was not found
03-28 17:50:05.864: D/dalvikvm(10165): threadid=13: notify debugger
03-28 17:50:05.864: W/System.err(10165): at java.util.concurrent.FutureTask.report(FutureTask.java:94)
03-28 17:50:05.864: D/dalvikvm(10165): threadid=13 (AsyncTask #2): calling run()
03-28 17:50:05.865: W/System.err(10165): at java.util.concurrent.FutureTask.get(FutureTask.java:160)
03-28 17:50:05.865: W/System.err(10165): at android.os.AsyncTask.get(AsyncTask.java:482)
03-28 17:50:05.865: W/System.err(10165): at com.example.neo4j.MainActivity$2.onClick(MainActivity.java:50)
03-28 17:50:05.865: W/System.err(10165): at android.view.View.performClick(View.java:4209)
03-28 17:50:05.865: W/System.err(10165): at android.view.View$PerformClick.run(View.java:17431)
03-28 17:50:05.866: W/System.err(10165): at android.os.Handler.handleCallback(Handler.java:725)
03-28 17:50:05.866: W/System.err(10165): at android.os.Handler.dispatchMessage(Handler.java:92)
03-28 17:50:05.866: W/System.err(10165): at android.os.Looper.loop(Looper.java:153)
03-28 17:50:05.866: W/System.err(10165): at android.app.ActivityThread.main(ActivityThread.java:5297)
03-28 17:50:05.866: W/System.err(10165): at java.lang.reflect.Method.invokeNative(Native Method)
03-28 17:50:05.866: W/System.err(10165): at java.lang.reflect.Method.invoke(Method.java:511)
03-28 17:50:05.866: W/System.err(10165): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:833)
03-28 17:50:05.867: W/System.err(10165): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
03-28 17:50:05.867: W/System.err(10165): at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:115)
03-28 17:50:05.867: W/System.err(10165): at dalvik.system.NativeStart.main(Native Method)
03-28 17:50:05.867: W/System.err(10165): Caused by: com.sun.jersey.api.client.ClientHandlerException: com.sun.jersey.api.client.ClientHandlerException: A message body writer for Java type, class java.lang.String, and MIME media type, application/json, was not found
03-28 17:50:05.868: W/System.err(10165): at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:155)
03-28 17:50:05.868: W/System.err(10165): at com.sun.jersey.api.client.Client.handle(Client.java:652)
03-28 17:50:05.868: W/System.err(10165): at com.sun.jersey.api.client.WebResource.handle(WebResource.java:682)
03-28 17:50:05.869: W/System.err(10165): at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
03-28 17:50:05.869: W/System.err(10165): at com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:560)
03-28 17:50:05.869: W/System.err(10165): at com.example.neo4j.RESTCreateNode.doInBackground(RESTCreateNode.java:33)
03-28 17:50:05.869: W/System.err(10165): at com.example.neo4j.RESTCreateNode.doInBackground(RESTCreateNode.java:1)
03-28 17:50:05.869: W/System.err(10165): at android.os.AsyncTask$2.call(AsyncTask.java:287)
03-28 17:50:05.869: W/System.err(10165): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
03-28 17:50:05.870: W/System.err(10165): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
03-28 17:50:05.870: W/System.err(10165): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
03-28 17:50:05.870: W/System.err(10165): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
03-28 17:50:05.870: W/System.err(10165): at java.lang.Thread.run(Thread.java:838)
03-28 17:50:05.870: W/System.err(10165): Caused by: com.sun.jersey.api.client.ClientHandlerException: A message body writer for Java type, class java.lang.String, and MIME media type, application/json, was not found
03-28 17:50:05.871: W/System.err(10165): at com.sun.jersey.api.client.RequestWriter.writeRequestEntity(RequestWriter.java:288)
03-28 17:50:05.871: W/System.err(10165): at com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:217)
03-28 17:50:05.871: W/System.err(10165): at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:153)
03-28 17:50:05.871: W/System.err(10165): ... 12 more
03-28 17:50:05.879: E/AndroidRuntime(10165): FATAL EXCEPTION: AsyncTask #1
03-28 17:50:05.879: E/AndroidRuntime(10165): java.lang.RuntimeException: An error occured while executing doInBackground()
03-28 17:50:05.879: E/AndroidRuntime(10165): at android.os.AsyncTask$3.done(AsyncTask.java:299)
03-28 17:50:05.879: E/AndroidRuntime(10165): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
03-28 17:50:05.879: E/AndroidRuntime(10165): at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
03-28 17:50:05.879: E/AndroidRuntime(10165): at java.util.concurrent.FutureTask.run(FutureTask.java:239)
03-28 17:50:05.879: E/AndroidRuntime(10165): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
03-28 17:50:05.879: E/AndroidRuntime(10165): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
03-28 17:50:05.879: E/AndroidRuntime(10165): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
03-28 17:50:05.879: E/AndroidRuntime(10165): at java.lang.Thread.run(Thread.java:838)
03-28 17:50:05.879: E/AndroidRuntime(10165): Caused by: com.sun.jersey.api.client.ClientHandlerException: com.sun.jersey.api.client.ClientHandlerException: A message body writer for Java type, class java.lang.String, and MIME media type, application/json, was not found
03-28 17:50:05.879: E/AndroidRuntime(10165): at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:155)
03-28 17:50:05.879: E/AndroidRuntime(10165): at com.sun.jersey.api.client.Client.handle(Client.java:652)
03-28 17:50:05.879: E/AndroidRuntime(10165): at com.sun.jersey.api.client.WebResource.handle(WebResource.java:682)
03-28 17:50:05.879: E/AndroidRuntime(10165): at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
03-28 17:50:05.879: E/AndroidRuntime(10165): at com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:560)
03-28 17:50:05.879: E/AndroidRuntime(10165): at com.example.neo4j.RESTCreateNode.doInBackground(RESTCreateNode.java:33)
03-28 17:50:05.879: E/AndroidRuntime(10165): at com.example.neo4j.RESTCreateNode.doInBackground(RESTCreateNode.java:1)
03-28 17:50:05.879: E/AndroidRuntime(10165): at android.os.AsyncTask$2.call(AsyncTask.java:287)
03-28 17:50:05.879: E/AndroidRuntime(10165): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
03-28 17:50:05.879: E/AndroidRuntime(10165): ... 4 more
03-28 17:50:05.879: E/AndroidRuntime(10165): Caused by: com.sun.jersey.api.client.ClientHandlerException: A message body writer for Java type, class java.lang.String, and MIME media type, application/json, was not found
03-28 17:50:05.879: E/AndroidRuntime(10165): at com.sun.jersey.api.client.RequestWriter.writeRequestEntity(RequestWriter.java:288)
03-28 17:50:05.879: E/AndroidRuntime(10165): at com.sun.jersey.client.urlconnection.URLConnectionClientHandler._invoke(URLConnectionClientHandler.java:217)
03-28 17:50:05.879: E/AndroidRuntime(10165): at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:153)
03-28 17:50:05.879: E/AndroidRuntime(10165): ... 12 more
03-28 17:50:06.425: D/OpenGLRenderer(10165): Flushing caches (mode 0)
03-28 17:50:06.654: D/OpenGLRenderer(10165): Flushing caches (mode 1)
03-28 17:50:06.666: D/OpenGLRenderer(10165): Flushing caches (mode 0)
I started googling the issue and found a solution proposed by user Lucas Ventura
here - http://jersey.576304.n2.nabble.com/java-lang-NullPointerException-on-Android-td4212447.html
I implemented the solution and it started giving me exception -
"NullPointerException at MediaType.java:119".
I tried googling further but it didn't yeild anything useful.
A little insight on this topic would help me a lot.
Please let me know if i am following something in a wrong manner. If not, is there any other approach that I can use to connect to neo4j server in a RESTful way.
Also let me know if this is the answer i am looking for -https://github.com/giorgio-zamparelli/jersey-android

Custom UI not working

I am trying to reuse csipsimple as a library. and calling ui which is present in the same library
My xml file looks like
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".DialerActivity" >
<view
class="com.csipsimple.widgets.Dialpad"
android:id="#+id/dialPad"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:paddingBottom="10dip"
android:paddingLeft="5dip"
android:paddingRight="5dip" />
</LinearLayout>
My activity from which i am calling the
package com.*****.payphone;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class DialerActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dialer);
}
#Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_dialer, menu);
return true;
}
}
and stack trace for the same is I don't understand what have i done wrong
03-28 18:52:18.847: I/ActivityThread(16221): Pub com.csipsimple.db: com.csipsimple.db.DBProvider
03-28 18:52:18.870: D/dalvikvm(16221): GC_CONCURRENT freed 152K, 2% free 9116K/9296K, paused 8ms+6ms, total 71ms
03-28 18:52:18.894: V/DummySetUp(16206): <sip:****#*****.net> IwYzK5IbKJv8DQT 1
03-28 18:52:18.956: D/AndroidRuntime(16206): Shutting down VM
03-28 18:52:18.956: W/dalvikvm(16206): threadid=1: thread exiting with uncaught exception (group=0x41f27930)
03-28 18:52:18.964: E/AndroidRuntime(16206): FATAL EXCEPTION: main
03-28 18:52:18.964: E/AndroidRuntime(16206): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.novanet.payphone/com.*****.payphone.DialerActivity}: android.view.InflateException: Binary XML file line #7: Error inflating class com.csipsimple.widgets.Dialpad
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.app.ActivityThread.access$600(ActivityThread.java:141)
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.os.Handler.dispatchMessage(Handler.java:99)
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.os.Looper.loop(Looper.java:137)
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.app.ActivityThread.main(ActivityThread.java:5039)
03-28 18:52:18.964: E/AndroidRuntime(16206): at java.lang.reflect.Method.invokeNative(Native Method)
03-28 18:52:18.964: E/AndroidRuntime(16206): at java.lang.reflect.Method.invoke(Method.java:511)
03-28 18:52:18.964: E/AndroidRuntime(16206): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-28 18:52:18.964: E/AndroidRuntime(16206): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-28 18:52:18.964: E/AndroidRuntime(16206): at dalvik.system.NativeStart.main(Native Method)
03-28 18:52:18.964: E/AndroidRuntime(16206): Caused by: android.view.InflateException: Binary XML file line #7: Error inflating class com.csipsimple.widgets.Dialpad
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.view.LayoutInflater.createView(LayoutInflater.java:613)
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687)
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
03-28 18:52:18.964: E/AndroidRuntime(16206): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:270)
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.app.Activity.setContentView(Activity.java:1881)
03-28 18:52:18.964: E/AndroidRuntime(16206): at com.novanet.payphone.DialerActivity.onCreate(DialerActivity.java:12)
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.app.Activity.performCreate(Activity.java:5104)
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
03-28 18:52:18.964: E/AndroidRuntime(16206): ... 11 more
03-28 18:52:18.964: E/AndroidRuntime(16206): Caused by: java.lang.reflect.InvocationTargetException
03-28 18:52:18.964: E/AndroidRuntime(16206): at java.lang.reflect.Constructor.constructNative(Native Method)
03-28 18:52:18.964: E/AndroidRuntime(16206): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
03-28 18:52:18.964: E/AndroidRuntime(16206): ... 22 more
03-28 18:52:18.964: E/AndroidRuntime(16206): Caused by: android.view.InflateException: Binary XML file line #31: Error inflating class android.widget.ImageButton
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.view.LayoutInflater.createView(LayoutInflater.java:613)
03-28 18:52:18.964: E/AndroidRuntime(16206): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660)
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685)
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.view.LayoutInflater.rInflate(LayoutInflater.java:749)
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.view.LayoutInflater.inflate(LayoutInflater.java:459)
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
03-28 18:52:18.964: E/AndroidRuntime(16206): at com.csipsimple.widgets.Dialpad.<init>(Dialpad.java:105)
03-28 18:52:18.964: E/AndroidRuntime(16206): ... 25 more
03-28 18:52:18.964: E/AndroidRuntime(16206): Caused by: java.lang.reflect.InvocationTargetException
03-28 18:52:18.964: E/AndroidRuntime(16206): at java.lang.reflect.Constructor.constructNative(Native Method)
03-28 18:52:18.964: E/AndroidRuntime(16206): at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.view.LayoutInflater.createView(LayoutInflater.java:587)
03-28 18:52:18.964: E/AndroidRuntime(16206): ... 33 more
03-28 18:52:18.964: E/AndroidRuntime(16206): Caused by: android.content.res.Resources$NotFoundException: Resource is not a Drawable (color or path): TypedValue{t=0x2/d=0x7f01000f a=2}
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.content.res.Resources.loadDrawable(Resources.java:1927)
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.view.View.<init>(View.java:3328)
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.widget.ImageView.<init>(ImageView.java:114)
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.widget.ImageButton.<init>(ImageButton.java:87)
03-28 18:52:18.964: E/AndroidRuntime(16206): at android.widget.ImageButton.<init>(ImageButton.java:83)
03-28 18:52:18.964: E/AndroidRuntime(16206): ... 36 more
My Library project is outside my main project which is in package com.*.payphone and the lisbrary project being used is com.csipsimple.widget.Dialpad
have you tried to use <com.csipsimple.widgets.Dialpad instead of
<view
class="com.csipsimple.widgets.Dialpad"
?
You should define your custom view in XML as below:
<com.csipsimple.widgets.Dialpad
android:id="#+id/dialPad"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:paddingBottom="10dip"
android:paddingLeft="5dip"
android:paddingRight="5dip" />
Make sure your theme extends one of the ActionBarSherlock themes. The dialpad buttons use a background from ABS. See this similar issue.

ClassNotFoundException when running an android app

I'm trying to run the Spydroid app from . But run into a "Unfortunately Spydroid has stopped" as soon as it runs on my Nexus 4.
I used egit to grab a copy of the code into a new project in eclipse. At that point, it threw out a couple errors telling me to right click on the project and select Android Tools --> Fix Project Properties. I did as it said and then hit run, which uploads it to the Nexus 4, installs it and when it attempts to run is when I get the crash.
Am I doing something wrong in the checkout/setup process?
I posted a similar post to the project's google code page
Logcat:
03-28 02:59:20.028: D/AndroidRuntime(31294): Shutting down VM
03-28 02:59:20.028: W/dalvikvm(31294): threadid=1: thread exiting with uncaught exception (group=0x41920930)
03-28 02:59:20.028: E/AndroidRuntime(31294): FATAL EXCEPTION: main
03-28 02:59:20.028: E/AndroidRuntime(31294): java.lang.RuntimeException: Unable to instantiate application net.majorkernelpanic.spydroid.SpydroidApplication: java.lang.ClassNotFoundException: Didn't find class "net.majorkernelpanic.spydroid.SpydroidApplication" on path: /data/app/net.majorkernelpanic.spydroid-1.apk
03-28 02:59:20.028: E/AndroidRuntime(31294): at android.app.LoadedApk.makeApplication(LoadedApk.java:504)
03-28 02:59:20.028: E/AndroidRuntime(31294): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4364)
03-28 02:59:20.028: E/AndroidRuntime(31294): at android.app.ActivityThread.access$1300(ActivityThread.java:141)
03-28 02:59:20.028: E/AndroidRuntime(31294): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294)
03-28 02:59:20.028: E/AndroidRuntime(31294): at android.os.Handler.dispatchMessage(Handler.java:99)
03-28 02:59:20.028: E/AndroidRuntime(31294): at android.os.Looper.loop(Looper.java:137)
03-28 02:59:20.028: E/AndroidRuntime(31294): at android.app.ActivityThread.main(ActivityThread.java:5041)
03-28 02:59:20.028: E/AndroidRuntime(31294): at java.lang.reflect.Method.invokeNative(Native Method)
03-28 02:59:20.028: E/AndroidRuntime(31294): at java.lang.reflect.Method.invoke(Method.java:511)
03-28 02:59:20.028: E/AndroidRuntime(31294): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
03-28 02:59:20.028: E/AndroidRuntime(31294): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
03-28 02:59:20.028: E/AndroidRuntime(31294): at dalvik.system.NativeStart.main(Native Method)
03-28 02:59:20.028: E/AndroidRuntime(31294): Caused by: java.lang.ClassNotFoundException: Didn't find class "net.majorkernelpanic.spydroid.SpydroidApplication" on path: /data/app/net.majorkernelpanic.spydroid-1.apk
03-28 02:59:20.028: E/AndroidRuntime(31294): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
03-28 02:59:20.028: E/AndroidRuntime(31294): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
03-28 02:59:20.028: E/AndroidRuntime(31294): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
03-28 02:59:20.028: E/AndroidRuntime(31294): at android.app.Instrumentation.newApplication(Instrumentation.java:968)
03-28 02:59:20.028: E/AndroidRuntime(31294): at android.app.LoadedApk.makeApplication(LoadedApk.java:499)
03-28 02:59:20.028: E/AndroidRuntime(31294): ... 11 more
Possible error can be:
Check the package name carefully
Check order/export option in Build Path

ResourcesNotFoundException when initialising Drawable

private Drawable drawable;
drawable = this.getResources().getDrawable(R.drawable.icon);
When I run this on my htc desire it goes, but on emulator it crashes when I try to initialiser drawable. Why is this?
edit: here is my stacktrace
03-28 13:27:58.453: ERROR/ActivityThread(888): Failed to find provider info for com.google.settings
03-28 13:28:06.414: ERROR/AndroidRuntime(888): Uncaught handler: thread main exiting due to uncaught exception
03-28 13:28:06.486: ERROR/AndroidRuntime(888): java.lang.RuntimeException: Unable to start activity ComponentInfo{be.test.helloworld/be.test.helloworld.MyMapActivityII}: android.content.res.Resources$NotFoundException: Resource ID #0x7f020000
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2268)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at android.app.ActivityThread.access$1800(ActivityThread.java:112)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at android.os.Handler.dispatchMessage(Handler.java:99)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at android.os.Looper.loop(Looper.java:123)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at android.app.ActivityThread.main(ActivityThread.java:3948)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at java.lang.reflect.Method.invokeNative(Native Method)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at java.lang.reflect.Method.invoke(Method.java:521)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at dalvik.system.NativeStart.main(Native Method)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f020000
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at android.content.res.Resources.getValue(Resources.java:846)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at android.content.res.Resources.getDrawable(Resources.java:534)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at be.test.helloworld.MyMapActivityII.initOverlays(MyMapActivityII.java:44)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at be.test.helloworld.MyMapActivityII.onCreate(MyMapActivityII.java:38)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)
03-28 13:28:06.486: ERROR/AndroidRuntime(888): ... 11 more
Make sure you have an icon in all of the drawable folders (drawable-ldpi, drawable-mdpi and drawable-hdpi)

Categories

Resources