Hi,
Recently while dealing with the soap web service in android i found this error.Reason for this error is my soap service returns the string value but i am trying to receive the value as SoapObject.
Like
SoapObject responce=(SoapObject)envelope.getResponce();
It causes the error .
How to solve this error
for solving this error replace the above code like
Object responce=envelope.getResponse();
Hope it solves your problem
Wednesday, 5 June 2013
Tuesday, 14 May 2013
Android vm Budget Out Of error While dealing with the large image files in xml
Hi,
While working on my project i found one memory issue in android caused because of the loading the large image files. In layout file i added backgrounds ,top bars......etc those images are some what larger size.These Bitmaps are caused in android some unexpected error i.e VM budget Out Of error.
While working on my project i found one memory issue in android caused because of the loading the large image files. In layout file i added backgrounds ,top bars......etc those images are some what larger size.These Bitmaps are caused in android some unexpected error i.e VM budget Out Of error.
Bitmaps on the previous activity layout are not properly deallocated by
the garbage collector because they have crossed references to their
activity. After many experiments I found a quite good solution for this
problem.
First, set the “id” attribute on the parent view of your XML layout:
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
android:layout_width
=
"fill_parent"
android:layout_height
=
"fill_parent"
android:id
=
"@+id/RootView"
>
Then,
on the onDestroy() method of your Activity, call the unbindDrawables()
method passing a refence to the parent View and then do a System.gc().
@Override
protected
void
onDestroy() {
super
.onDestroy();
unbindDrawables(findViewById(R.id.RootView));
System.gc();
}
private
void
unbindDrawables(View view) {
if
(view.getBackground() !=
null
) {
view.getBackground().setCallback(
null
);
}
if
(view
instanceof
ViewGroup) {
for
(
int
i =
0
; i < ((ViewGroup) view).getChildCount(); i++) {
unbindDrawables(((ViewGroup) view).getChildAt(i));
}
((ViewGroup) view).removeAllViews();
}
}
This unbindDrawables() method explores the view tree recursively and:
- Removes callbacks on all the background drawables
- Removes childs on every viewgroup.
Subscribe to:
Posts (Atom)