Android java.lang.IllegalArgumentException: Invalid int: "Acc" - android

Hi , my app when runs on HWY320-U (Huawei) throws exception.
What may be reason of this?
java.lang.IllegalArgumentException: Invalid int: "Acc"
at android.os.Parcel.readException(Parcel.java:1429)
at android.os.Parcel.readException(Parcel.java:1379)
at afa.a(SourceFile:102)
at aer.a(SourceFile:174)
at aer.a(SourceFile:151)
at afw.run(SourceFile:14)
at afy.run(SourceFile:30)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at java.lang.Thread.run(Thread.java:838)

If I look at the stacktrace, I would say that you use Integer.parseInt() somewhere and the input seems to be "Acc". This input cannot be parsed to an Integer as it is a String

Related

Odata4j Android - Illegal datetime format

I am encountering the exception stated below in my android code where I am trying to parse an ODATA service using odata4j JAR library.
java.lang.IllegalArgumentException: Illegal datetime format 2015-05-07T00%3A00%3A00
I am getting the error at line below in Android code:
List list = c.getEntities("EntityName").execute().toList();
My entire stacktrace is stated below:
Caused by: java.lang.IllegalArgumentException: bad valueString [datetime'2015-05-07T00%3A00%3A00'] as part of keyString [*****='*****',*****='0',***='*****',date=datetime'2015-05-07T00%3A00%3A00',*****='*******']
at org.odata4j.core.OEntityKey.parse(OEntityKey.java:157)
at org.odata4j.format.xml.AtomFeedFormatParser.parseEntityKey(AtomFeedFormatParser.java:300)
at org.odata4j.format.xml.AtomFeedFormatParser.entityFromAtomEntry(AtomFeedFormatParser.java:431)
at org.odata4j.format.xml.AtomFeedFormatParser.parseEntry(AtomFeedFormatParser.java:349)
at org.odata4j.format.xml.AtomFeedFormatParser.parseFeed(AtomFeedFormatParser.java:169)
at org.odata4j.format.xml.AtomFeedFormatParser.parse(AtomFeedFormatParser.java:157)
at org.odata4j.format.xml.AtomFeedFormatParser.parse(AtomFeedFormatParser.java:45)
at org.odata4j.consumer.ConsumerQueryEntitiesRequest.doRequest(ConsumerQueryEntitiesRequest.java:67)
at org.odata4j.consumer.ConsumerQueryEntitiesRequest.getEntries(ConsumerQueryEntitiesRequest.java:50)
at org.odata4j.consumer.ConsumerQueryEntitiesRequest.execute(ConsumerQueryEntitiesRequest.java:40)
at *******.MyActivity$LoadSpinners.doInBackground(MyActivity.java:287)
at *******.MyActivity$LoadSpinners.doInBackground(MyActivity.java:202)
at android.os.AsyncTask$2.call(AsyncTask.java:287)
at java.util.concurrent.FutureTask.run(FutureTask.java:234)
            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
            at java.lang.Thread.run(Thread.java:841)
Caused by: java.lang.IllegalArgumentException: Illegal datetime format 2015-05-07T00%3A00%3A00
at org.odata4j.internal.InternalUtil.parseDateTimeFromXml(InternalUtil.java:96)
at org.odata4j.expression.ExpressionParser.readExpression(ExpressionParser.java:462)
at org.odata4j.expression.ExpressionParser.parse(ExpressionParser.java:64)
at org.odata4j.core.OEntityKey.parse(OEntityKey.java:152)
There are ****** placed at certain sensitive information like not related properties and app package names.

SMS Sending issues in android kitkat

I am getting this issue most of the time in samsung devices while sending sms.
Android version
Android 4.0.3 - 4.0.4
This is the error report I'm getting
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:278)
at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
Caused by: java.lang.NullPointerException
at android.os.Parcel.readException(Parcel.java:1333)
at android.os.Parcel.readException(Parcel.java:1281)
at com.android.internal.telephony.ISms$Stub$Proxy.sendText(ISms.java:644)
at android.telephony.SmsManager.sendTextMessage(SmsManager.java:149)
at android.telephony.SmsManager.sendTextMessage(SmsManager.java:99)
at com.msh7.utilities.SMSSender$SMSProgressTask.doInBackground(SMSSender.java:87)
at com.msh7.utilities.SMSSender$SMSProgressTask.doInBackground(SMSSender.java:1)
at android.os.AsyncTask$2.call(AsyncTask.java:264)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
... 5 more
On line 87, I have this code
sms.sendTextMessage(destinationNumber, null, msg, sentPI, deliveredPI);
and all this method is inside the AsyncTask's doInBackground() method.
Could anyone please help me in this?
*Note : My App sends sms in the background and it's not a default sms app.
I guess it's due to over size limit of text. Max allowed characters are 159. So you have to divide message into parts and send it.
Dude you are getting NullPointerException. Seems like you have not initialized sms object.
Please check..

String length errors with an Android Content Provider Authority string

The original name of the content provider authority that works fine with no errors:
public static final String AUTHORITY = com.dakotastream.cardiologger.CardioLoggerProvider12;
I want rename my authority to:
public static final String AUTHORITY = com.dakotastream.cardiologger.CardioLoggerProvider;
When I change the name to the above I get this error.
Caused by: java.lang.StringIndexOutOfBoundsException: length=68; index=70
public static final String AUTHORITY = com.dakotastream.cardiologger.CardioLoggerProvider1;
When I change the name to the above I get this error.
Caused by: java.lang.StringIndexOutOfBoundsException: length=69; index=70
If I rename the package to com.dakotastream.cardiologger12, then I can use the
public static final String AUTHORITY = com.dakotastream.cardiologger12.CardioLoggerProvider;
with no errors.
The Authority seems to require a string length greater than 69 characters.
I am using SDK Tools 22.6.3, API 19, ABS Library 4.4.0
I have tried creating a new Android Application Project and dropping the code in. I get the same error.
Entire LogCat Dump:
FATAL EXCEPTION: ModernAsyncTask #1
Process: com.dakotastream.cardiologger, PID: 1344
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.support.v4.content.ModernAsyncTask$3.done(ModernAsyncTask.java:137)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
Caused by: java.lang.StringIndexOutOfBoundsException: length=68; index=70
at java.lang.String.indexAndLength(String.java:584)
at java.lang.String.substring(String.java:1449)
at com.dakotastream.cardiologger.DbContentProvider.query(DbContentProvider.java:279)
at android.content.ContentProvider.query(ContentProvider.java:857)
at android.content.ContentProvider$Transport.query(ContentProvider.java:200)
at android.content.ContentResolver.query(ContentResolver.java:461)
at android.content.ContentResolver.query(ContentResolver.java:404)
at android.support.v4.content.CursorLoader.loadInBackground(CursorLoader.java:49)
at android.support.v4.content.CursorLoader.loadInBackground(CursorLoader.java:35)
at android.support.v4.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:242)
at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:51)
at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:40)
at android.support.v4.content.ModernAsyncTask$2.call(ModernAsyncTask.java:123)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
In Eclipse I use Android Tools>Rename Application Package to change the name.
This is the error I get when I change the name.
Update the android:authorities tag accordingly for the provider in the manifest.

Overcome out of memory Error when loading images into textview

Sorry if this sound newb but.. =[
Im working with an application which need to load a large amount of images onto a textview, i didnt use webview becuz sometimes it doesnt lead to mobile view so i decide to parse the content and use html.fromHtml to show it to the Textview.
Problem is:
if i load a page is luckily there not much images, it run pretty smooth.
otherwise it get the error like below...
anyone know if theres a way that i can dispose the source from the system memory after it finished reading the image?...or...any other way will fix my problem?
i used the source from here Android ImageGetter images overlapping text
05-08 21:30:31.404: ERROR/dalvikvm-heap(25083): Out of memory on a 1920016-byte allocation.
05-08 21:30:31.404: ERROR/AndroidRuntime(25083): FATAL EXCEPTION: AsyncTask #10
java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:299)
at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
at java.util.concurrent.FutureTask.run(FutureTask.java:137)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
Caused by: java.lang.OutOfMemoryError
at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:527)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:353)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:781)
at android.graphics.drawable.Drawable.createFromStream(Drawable.java:741)
at com.vilalab.five.model.URLImageParser$ImageGetterAsyncTask.fetchDrawable(URLImageParser.java:90)
at com.vilalab.five.model.URLImageParser$ImageGetterAsyncTask.doInBackground(URLImageParser.java:58)
at com.vilalab.five.model.URLImageParser$ImageGetterAsyncTask.doInBackground(URLImageParser.java:48)
at android.os.AsyncTask$2.call(AsyncTask.java:287)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
... 4 more
05-08 21:30:31.504: ERROR/dalvikvm-heap(25083): Out of memory on a 1920016-byte allocation.
Check out this post, it uses the example of getting picutres from the SD Card/Gallery for how to downsample images so that you avoid this problem. Its a pretty easy fix.

java.lang.NumberFormatException (parse.Int)

An app published on market has an error:
java.lang.NumberFormatException
below the stack.
Is the cause this code?
fade = Integer.parseInt(ListPreference);
I see "OTHER" devices has affected by this crash. Any idea?
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.app/com.example.app.Notify}: java.lang.NumberFormatException: unable to parse '' as integer
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1659)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1675)
at android.app.ActivityThread.access$1500(ActivityThread.java:121)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:943)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3768)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NumberFormatException: unable to parse '' as integer
at java.lang.Integer.parseInt(Integer.java:362)
at java.lang.Integer.parseInt(Integer.java:332)
at com.example.app.Notify.onCreate(Notify.java:33)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1623)
... 11 more
java.lang.NumberFormatException: unable to parse '' as integer
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1659)
==> it seems you are trying to parse an empty string. You should include the parsing operation in a try/catch block and deal with malformed inputs.
as in log :
NumberFormatException: unable to parse '' as integer
you are trying to parse space to integer . before parsing string value to Integer check for null or empty
Actually, There is any symbol or character happen in String ListPreference,
Its better to Handle this exception.
try {
fade = Integer.parseInt(ListPreference);
} catch (NumberFormatException e) {
Log.e("Exception",e.toString());
}
Update:
Look at the Jakarta Commons :
NumberUtils.isNumber()
This can be used to check most whether a given String is a number.
Also before using String ListPreference just removed white space from it using trim().
Using ListPreference.trim() and also check the length of ListPreference whether length is greater than 1 or not.
like, ListPreference.length() > 1

Categories

Resources