android, delete multiple rows in sqlite - android

I need to delete multiple rows from my database table.
This is my code for deletion
String[] paragraph;
.....
//here you can to put various strings within it (1 or more)
.....
db.delete(mytablename,"Paragraph = ?",paragraphs);
It works with 1 string, but it doesn't work with more strings.
Can someone help me, please?
Here there is the error shown by LogCat:
05-11 11:03:01.400: E/AndroidRuntime(767): FATAL EXCEPTION: main
05-11 11:03:01.400: E/AndroidRuntime(767): android.database.sqlite.SQLiteException: bind or column index out of range: handle 0x377500
05-11 11:03:01.400: E/AndroidRuntime(767): at android.database.sqlite.SQLiteProgram.native_bind_string(Native Method)
05-11 11:03:01.400: E/AndroidRuntime(767): at android.database.sqlite.SQLiteProgram.bindString(SQLiteProgram.java:241)
05-11 11:03:01.400: E/AndroidRuntime(767): at android.database.DatabaseUtils.bindObjectToProgram(DatabaseUtils.java:191)
05-11 11:03:01.400: E/AndroidRuntime(767): at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1769)
05-11 11:03:01.400: E/AndroidRuntime(767): at it.tirocinio.Segnalibro$3$3.onClick(Segnalibro.java:196)
05-11 11:03:01.400: E/AndroidRuntime(767): at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:158)
05-11 11:03:01.400: E/AndroidRuntime(767): at android.os.Handler.dispatchMessage(Handler.java:99)
05-11 11:03:01.400: E/AndroidRuntime(767): at android.os.Looper.loop(Looper.java:123)
05-11 11:03:01.400: E/AndroidRuntime(767): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-11 11:03:01.400: E/AndroidRuntime(767): at java.lang.reflect.Method.invokeNative(Native Method)
05-11 11:03:01.400: E/AndroidRuntime(767): at java.lang.reflect.Method.invoke(Method.java:521)
05-11 11:03:01.400: E/AndroidRuntime(767): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-11 11:03:01.400: E/AndroidRuntime(767): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-11 11:03:01.400: E/AndroidRuntime(767): at dalvik.system.NativeStart.main(Native Method)

use this way:
for(int i = 0 ; i < paragraphs.lenght;i++)
{
db.delete(mytablename,"Paragraph ='"+paragraphs[i]+"'",null);
}

Related

Error after importing Android project [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
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
Closed 9 years ago.
Improve this question
I moved an Eclipse-based Android project from another machine to the machine that I am working with. I imported the project using Android Project from Existing Source. Everything is working well when I code but when I deploy it using emulators and phones, it's producing weird exceptions. What might be the problem?
I have attached the exceptions produced with the questions for information.
12-06 08:15:20.957: E/AndroidRuntime(767): FATAL EXCEPTION: main
12-06 08:15:20.957: E/AndroidRuntime(767): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.innolabmm.discoverlioncity/com.innolabmm.discoverlioncity.FeedActivity}: java.lang.ClassNotFoundException: Didn't find class "com.innolabmm.discoverlioncity.FeedActivity" on path: /data/app/com.innolabmm.discoverlioncity-1.apk
12-06 08:15:20.957: E/AndroidRuntime(767): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
12-06 08:15:20.957: E/AndroidRuntime(767): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
12-06 08:15:20.957: E/AndroidRuntime(767): at android.app.ActivityThread.access$600(ActivityThread.java:141)
12-06 08:15:20.957: E/AndroidRuntime(767): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
12-06 08:15:20.957: E/AndroidRuntime(767): at android.os.Handler.dispatchMessage(Handler.java:99)
12-06 08:15:20.957: E/AndroidRuntime(767): at android.os.Looper.loop(Looper.java:137)
12-06 08:15:20.957: E/AndroidRuntime(767): at android.app.ActivityThread.main(ActivityThread.java:5041)
12-06 08:15:20.957: E/AndroidRuntime(767): at java.lang.reflect.Method.invokeNative(Native Method)
12-06 08:15:20.957: E/AndroidRuntime(767): at java.lang.reflect.Method.invoke(Method.java:511)
12-06 08:15:20.957: E/AndroidRuntime(767): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
12-06 08:15:20.957: E/AndroidRuntime(767): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
12-06 08:15:20.957: E/AndroidRuntime(767): at dalvik.system.NativeStart.main(Native Method)
12-06 08:15:20.957: E/AndroidRuntime(767): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.innolabmm.discoverlioncity.FeedActivity" on path: /data/app/com.innolabmm.discoverlioncity-1.apk
12-06 08:15:20.957: E/AndroidRuntime(767): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
12-06 08:15:20.957: E/AndroidRuntime(767): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
12-06 08:15:20.957: E/AndroidRuntime(767): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
12-06 08:15:20.957: E/AndroidRuntime(767): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
12-06 08:15:20.957: E/AndroidRuntime(767): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
12-06 08:15:20.957: E/AndroidRuntime(767): ... 11 more
Try this:
Go to Project/Properties/Java Build Path/Order and Export -- Make sure there's a check in front of Android Dependencies and the support library, if you use it.Mark all checkboxes and Click on Apply and clean the project.
Hope this helps.

How to start AlertDialog regardless the context? Android

I`m doing little diagnostics project for fiscal printer in Android.
So when printing , a problem may occurs (missing paper ect.). In that case i want to start an AlertDialog notifying that there is a problem and asking the user does he wants to continue printing.
I want to make an AlertDialog that shows infront regardless the activity that is currently being brought to front.
I have tried the usual way of starting AlertDialog using GetAplicationContext() method but it crashes badly.
Here is the stacktrace:
05-11 17:36:56.162: W/dalvikvm(5458): threadid=3: thread exiting with uncaught exception (group=0x4001e390)
05-11 17:36:56.162: E/AndroidRuntime(5458): Uncaught handler: thread main exiting due to uncaught exception
05-11 17:36:56.182: E/AndroidRuntime(5458): java.lang.NullPointerException
05-11 17:36:56.182: E/AndroidRuntime(5458): at android.content.ContextWrapper.getApplicationContext(ContextWrapper.java:100)
05-11 17:36:56.182: E/AndroidRuntime(5458): at bg.barcodes.mobile.routes.java.BaseActivity.onCreateDialog(BaseActivity.java:21)
05-11 17:36:56.182: E/AndroidRuntime(5458): at bg.barcodes.mobile.routes.java.DatecsPrinter.Send(DatecsPrinter.java:319)
05-11 17:36:56.182: E/AndroidRuntime(5458): at bg.barcodes.mobile.routes.java.DatecsPrinter.sendText(DatecsPrinter.java:381)
05-11 17:36:56.182: E/AndroidRuntime(5458): at bg.barcodes.mobile.routes.java.StatusDatecsPrinter.doCommand(StatusDatecsPrinter.java:134)
05-11 17:36:56.182: E/AndroidRuntime(5458): at bg.barcodes.mobile.routes.java.StatusDatecsPrinter.access$0(StatusDatecsPrinter.java:118)
05-11 17:36:56.182: E/AndroidRuntime(5458): at bg.barcodes.mobile.routes.java.StatusDatecsPrinter$1.onClick(StatusDatecsPrinter.java:61)
05-11 17:36:56.182: E/AndroidRuntime(5458): at android.view.View.performClick(View.java:2364)
05-11 17:36:56.182: E/AndroidRuntime(5458): at android.view.View.onTouchEvent(View.java:4179)
05-11 17:36:56.182: E/AndroidRuntime(5458): at android.widget.TextView.onTouchEvent(TextView.java:6650)
05-11 17:36:56.182: E/AndroidRuntime(5458): at android.view.View.dispatchTouchEvent(View.java:3709)
05-11 17:36:56.182: E/AndroidRuntime(5458): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:924)
05-11 17:36:56.182: E/AndroidRuntime(5458): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:924)
05-11 17:36:56.182: E/AndroidRuntime(5458): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:924)
05-11 17:36:56.182: E/AndroidRuntime(5458): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:924)
05-11 17:36:56.182: E/AndroidRuntime(5458): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1695)
05-11 17:36:56.182: E/AndroidRuntime(5458): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1116)
05-11 17:36:56.182: E/AndroidRuntime(5458): at android.app.Activity.dispatchTouchEvent(Activity.java:2068)
05-11 17:36:56.182: E/AndroidRuntime(5458): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1679)
05-11 17:36:56.182: E/AndroidRuntime(5458): at android.view.ViewRoot.handleMessage(ViewRoot.java:1708)
05-11 17:36:56.182: E/AndroidRuntime(5458): at android.os.Handler.dispatchMessage(Handler.java:99)
05-11 17:36:56.182: E/AndroidRuntime(5458): at android.os.Looper.loop(Looper.java:123)
05-11 17:36:56.182: E/AndroidRuntime(5458): at android.app.ActivityThread.main(ActivityThread.java:4595)
05-11 17:36:56.182: E/AndroidRuntime(5458): at java.lang.reflect.Method.invokeNative(Native Method)
05-11 17:36:56.182: E/AndroidRuntime(5458): at java.lang.reflect.Method.invoke(Method.java:521)
05-11 17:36:56.182: E/AndroidRuntime(5458): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
05-11 17:36:56.182: E/AndroidRuntime(5458): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
05-11 17:36:56.182: E/AndroidRuntime(5458): at dalvik.system.NativeStart.main(Native Method)
05-11 17:36:56.192: I/dalvikvm(5458): threadid=7: reacting to signal 3
05-11 17:36:56.222: I/dalvikvm(5458): Wrote stack trace to '/data/anr/traces.txt'
Any ideas ?
don't try to use getApplicationContext(), create MyApplication class, inherited from the Application, then inside that class do the following:
public class MyApplication extends Application {
private static MyApplication instance;
#Override
public void onCreate() {
super.onCreate();
instance = this;
.........
}
public static Context getContext() {
return instance;
}
After that, you may use MyApplication.getContext() anywhere if you need a context and don't have an Activity lying around.
An alert dialog is displayed on above of an Activity, that's why you need an activity's context to initialize a dialog object. So, technically its not possible to show such dialogs without having reference to activity.
There is no way to interrupt another activity when it is running. However, the sort of functionality that you are looking for would be satisfied through using notifications. This does not show a dialog in front of the running activity, but a user will still be notified when something goes wrong:
http://developer.android.com/guide/topics/ui/notifiers/notifications.html

run time error in android activity has been stopped [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How do I fix android.os.NetworkOnMainThreadException?
I just built a demo application through this tutorial and when I run the application I get the following error in log cat and the main application is stopped. Does anyone know why I am getting this error?
05-11 15:52:06.492: E/AndroidRuntime(584): FATAL EXCEPTION: main
05-11 15:52:06.492: E/AndroidRuntime(584): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.androidhive.jsonparsing/com.androidhive.jsonparsing.AndroidJSONParsingActivity}: android.os.NetworkOnMainThreadException
05-11 15:52:06.492: E/AndroidRuntime(584): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
05-11 15:52:06.492: E/AndroidRuntime(584): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
05-11 15:52:06.492: E/AndroidRuntime(584): at android.app.ActivityThread.access$600(ActivityThread.java:123)
05-11 15:52:06.492: E/AndroidRuntime(584): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
05-11 15:52:06.492: E/AndroidRuntime(584): at android.os.Handler.dispatchMessage(Handler.java:99)
05-11 15:52:06.492: E/AndroidRuntime(584): at android.os.Looper.loop(Looper.java:137)
05-11 15:52:06.492: E/AndroidRuntime(584): at android.app.ActivityThread.main(ActivityThread.java:4424)
05-11 15:52:06.492: E/AndroidRuntime(584): at java.lang.reflect.Method.invokeNative(Native Method)
05-11 15:52:06.492: E/AndroidRuntime(584): at java.lang.reflect.Method.invoke(Method.java:511)
05-11 15:52:06.492: E/AndroidRuntime(584): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-11 15:52:06.492: E/AndroidRuntime(584): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-11 15:52:06.492: E/AndroidRuntime(584): at dalvik.system.NativeStart.main(Native Method)
05-11 15:52:06.492: E/AndroidRuntime(584): Caused by: android.os.NetworkOnMainThreadException
05-11 15:52:06.492: E/AndroidRuntime(584): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1099)
05-11 15:52:06.492: E/AndroidRuntime(584): at java.net.InetAddress.lookupHostByName(InetAddress.java:391)
05-11 15:52:06.492: E/AndroidRuntime(584): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:242)
05-11 15:52:06.492: E/AndroidRuntime(584): at java.net.InetAddress.getAllByName(InetAddress.java:220)
05-11 15:52:06.492: E/AndroidRuntime(584): at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:137)
05-11 15:52:06.492: E/AndroidRuntime(584): at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
05-11 15:52:06.492: E/AndroidRuntime(584): at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
05-11 15:52:06.492: E/AndroidRuntime(584): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
05-11 15:52:06.492: E/AndroidRuntime(584): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
05-11 15:52:06.492: E/AndroidRuntime(584): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
05-11 15:52:06.492: E/AndroidRuntime(584): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)
05-11 15:52:06.492: E/AndroidRuntime(584): at com.androidhive.jsonparsing.JSONParser.getJSONFromUrl(JSONParser.java:38)
05-11 15:52:06.492: E/AndroidRuntime(584): at com.androidhive.jsonparsing.AndroidJSONParsingActivity.onCreate(AndroidJSONParsingActivity.java:54)
05-11 15:52:06.492: E/AndroidRuntime(584): at android.app.Activity.performCreate(Activity.java:4465)
05-11 15:52:06.492: E/AndroidRuntime(584): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
05-11 15:52:06.492: E/AndroidRuntime(584): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
05-11 15:52:06.492: E/AndroidRuntime(584): ... 11 more
Rebuild the same for android target before 3.0 (such as for 2.1). Androids before 3.0 don't check if you're making network connections on main thread.
After it works as a quick fix then move your networking away from the main thread.
see: http://developer.android.com/reference/android/os/NetworkOnMainThreadException.html

Getting ClassNotFound

i have this messages from LogCat
dalvikvm(526): Could not find class 'com.temp.pt.database.DBHelper',
referenced from method com.temp.pt.database.DBUtils.getDBHelper
and after this i have this
05-11 21:46:25.305: E/AndroidRuntime(526): FATAL EXCEPTION: main
05-11 21:46:25.305: E/AndroidRuntime(526): java.lang.NoClassDefFoundError: com.temp.pt.database.DBHelper
05-11 21:46:25.305: E/AndroidRuntime(526): at com.temp.pt.database.DBUtils.getDBHelper(DBUtils.java:20)
05-11 21:46:25.305: E/AndroidRuntime(526): at com.temp.pt.CategoriesFragment$CategoryAsyncLoader.<init>(CategoriesFragment.java:169)
05-11 21:46:25.305: E/AndroidRuntime(526): at com.temp.pt.CategoriesFragment.onCreateLoader(CategoriesFragment.java:76)
05-11 21:46:25.305: E/AndroidRuntime(526): at android.support.v4.app.LoaderManagerImpl.createLoader(LoaderManager.java:486)
05-11 21:46:25.305: E/AndroidRuntime(526): at android.support.v4.app.LoaderManagerImpl.createAndInstallLoader(LoaderManager.java:495)
05-11 21:46:25.305: E/AndroidRuntime(526): at android.support.v4.app.LoaderManagerImpl.initLoader(LoaderManager.java:549)
05-11 21:46:25.305: E/AndroidRuntime(526): at com.temp.pt.CategoriesFragment.onActivityCreated(CategoriesFragment.java:45)
05-11 21:46:25.305: E/AndroidRuntime(526): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:891)
05-11 21:46:25.305: E/AndroidRuntime(526): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1080)
05-11 21:46:25.305: E/AndroidRuntime(526): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1062)
05-11 21:46:25.305: E/AndroidRuntime(526): at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1810)
05-11 21:46:25.305: E/AndroidRuntime(526): at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:501)
05-11 21:46:25.305: E/AndroidRuntime(526): at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1133)
05-11 21:46:25.305: E/AndroidRuntime(526): at android.app.Activity.performStart(Activity.java:4475)
05-11 21:46:25.305: E/AndroidRuntime(526): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1929)
05-11 21:46:25.305: E/AndroidRuntime(526): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
05-11 21:46:25.305: E/AndroidRuntime(526): at android.app.ActivityThread.access$600(ActivityThread.java:123)
05-11 21:46:25.305: E/AndroidRuntime(526): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
05-11 21:46:25.305: E/AndroidRuntime(526): at android.os.Handler.dispatchMessage(Handler.java:99)
05-11 21:46:25.305: E/AndroidRuntime(526): at android.os.Looper.loop(Looper.java:137)
05-11 21:46:25.305: E/AndroidRuntime(526): at android.app.ActivityThread.main(ActivityThread.java:4424)
05-11 21:46:25.305: E/AndroidRuntime(526): at java.lang.reflect.Method.invokeNative(Native Method)
05-11 21:46:25.305: E/AndroidRuntime(526): at java.lang.reflect.Method.invoke(Method.java:511)
05-11 21:46:25.305: E/AndroidRuntime(526): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-11 21:46:25.305: E/AndroidRuntime(526): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-11 21:46:25.305: E/AndroidRuntime(526): at dalvik.system.NativeStart.main(Native Method)
note i have define the class and the app compiles without error but crash at runtime . any suggestion , ,solution for this problem ?

Unable to download .jpg image and set into imageview using asynctask

I have a problem. I can't seem to download a .jpg image from a URL source and then set it into a imageview which is inside a listview. It gives me the error "NullPointerException". I am currently using the ImageDownloader class from here.
This are the lines of code where i download the image files:
onCreate()...
for (int i = 0; i < listData.size(); i++) {
imageISBN = listData.get(i).get("coverImage");
String isbnURL = "http://lib.syndetics.com/index.aspx?isbn=" + imageISBN +
"/SC.GIF&client=tpoly&type=xw12";
ImageView iv = (ImageView) findViewById(R.id.cover_image);
imageDownloader.download(isbnURL,iv);
}
I'm thinking that it maybe due to my setContentView(R.layout.list) that's producing the error since it is just a listview and the imageview link is in another xml file.
Below is the LogCat:
05-11 09:26:58.063: ERROR/AndroidRuntime(305): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.TPLibrary/com.TPLibrary.Search.SearchResults}: java.lang.NullPointerException
05-11 09:26:58.063: ERROR/AndroidRuntime(305): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
05-11 09:26:58.063: ERROR/AndroidRuntime(305): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
05-11 09:26:58.063: ERROR/AndroidRuntime(305): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
05-11 09:26:58.063: ERROR/AndroidRuntime(305): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
05-11 09:26:58.063: ERROR/AndroidRuntime(305): at android.os.Handler.dispatchMessage(Handler.java:99)
05-11 09:26:58.063: ERROR/AndroidRuntime(305): at android.os.Looper.loop(Looper.java:123)
05-11 09:26:58.063: ERROR/AndroidRuntime(305): at android.app.ActivityThread.main(ActivityThread.java:4627)
05-11 09:26:58.063: ERROR/AndroidRuntime(305): at java.lang.reflect.Method.invokeNative(Native Method)
05-11 09:26:58.063: ERROR/AndroidRuntime(305): at java.lang.reflect.Method.invoke(Method.java:521)
05-11 09:26:58.063: ERROR/AndroidRuntime(305): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
05-11 09:26:58.063: ERROR/AndroidRuntime(305): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
05-11 09:26:58.063: ERROR/AndroidRuntime(305): at dalvik.system.NativeStart.main(Native Method)
05-11 09:26:58.063: ERROR/AndroidRuntime(305): Caused by: java.lang.NullPointerException
05-11 09:26:58.063: ERROR/AndroidRuntime(305): at com.TPLibrary.Search.ImageDownloader.forceDownload(ImageDownloader.java:80)
05-11 09:26:58.063: ERROR/AndroidRuntime(305): at com.TPLibrary.Search.ImageDownloader.download(ImageDownloader.java:49)
05-11 09:26:58.063: ERROR/AndroidRuntime(305): at com.TPLibrary.Search.SearchResults.onCreate(SearchResults.java:185)
05-11 09:26:58.063: ERROR/AndroidRuntime(305): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-11 09:26:58.063: ERROR/AndroidRuntime(305): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
05-11 09:26:58.063: ERROR/AndroidRuntime(305): ... 11 more
So guys, any ideas? Could it be that i'm using the ImageDownloader class wrongly?
In ImageDownloader class, the mode is assigned to NO_ASYNC_TASK:
public enum Mode { NO_ASYNC_TASK, NO_DOWNLOADED_DRAWABLE, CORRECT }
private Mode mode = Mode.NO_ASYNC_TASK;
Your intention was to download the image. So try setting the mode variable to NO_DOWNLOADED_DRAWABLE.

Categories

Resources