android - activity stops unexpactedly when using Intent -
hello stackoverflowers m new bee android. 1 me out run away fatal error followed.
05-14 19:32:49.552: e/androidruntime(1657): fatal exception: main 05-14 19:32:49.552: e/androidruntime(1657): java.lang.runtimeexception: unable start activity componentinfo{com.dj.holyherb/com.dj.holyherb.prd_list}: android.view.inflateexception: binary xml file line #2: error inflating class <unknown> 05-14 19:32:49.552: e/androidruntime(1657): @ android.app.activitythread.performlaunchactivity(activitythread.java:1622) 05-14 19:32:49.552: e/androidruntime(1657): @ android.app.activitythread.handlelaunchactivity(activitythread.java:1638) 05-14 19:32:49.552: e/androidruntime(1657): @ android.app.activitythread.access$1500(activitythread.java:117) 05-14 19:32:49.552: e/androidruntime(1657): @ android.app.activitythread$h.handlemessage(activitythread.java:928) 05-14 19:32:49.552: e/androidruntime(1657): @ android.os.handler.dispatchmessage(handler.java:99) 05-14 19:32:49.552: e/androidruntime(1657): @ android.os.looper.loop(looper.java:123) 05-14 19:32:49.552: e/androidruntime(1657): @ android.app.activitythread.main(activitythread.java:3647) 05-14 19:32:49.552: e/androidruntime(1657): @ java.lang.reflect.method.invokenative(native method) 05-14 19:32:49.552: e/androidruntime(1657): @ java.lang.reflect.method.invoke(method.java:507) 05-14 19:32:49.552: e/androidruntime(1657): @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:839) 05-14 19:32:49.552: e/androidruntime(1657): @ com.android.internal.os.zygoteinit.main(zygoteinit.java:597) 05-14 19:32:49.552: e/androidruntime(1657): @ dalvik.system.nativestart.main(native method) 05-14 19:32:49.552: e/androidruntime(1657): caused by: android.view.inflateexception: binary xml file line #2: error inflating class <unknown> 05-14 19:32:49.552: e/androidruntime(1657): @ android.view.layoutinflater.createview(layoutinflater.java:518) 05-14 19:32:49.552: e/androidruntime(1657): @ com.android.internal.policy.impl.phonelayoutinflater.oncreateview(phonelayoutinflater.java:56) 05-14 19:32:49.552: e/androidruntime(1657): @ android.view.layoutinflater.createviewfromtag(layoutinflater.java:568) 05-14 19:32:49.552: e/androidruntime(1657): @ android.view.layoutinflater.inflate(layoutinflater.java:386) 05-14 19:32:49.552: e/androidruntime(1657): @ android.view.layoutinflater.inflate(layoutinflater.java:320) 05-14 19:32:49.552: e/androidruntime(1657): @ android.view.layoutinflater.inflate(layoutinflater.java:276) 05-14 19:32:49.552: e/androidruntime(1657): @ com.android.internal.policy.impl.phonewindow.setcontentview(phonewindow.java:207) 05-14 19:32:49.552: e/androidruntime(1657): @ android.app.activity.setcontentview(activity.java:1657) 05-14 19:32:49.552: e/androidruntime(1657): @ com.xyz.my_list.oncreate(my_list.java:429) 05-14 19:32:49.552: e/androidruntime(1657): @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1047) 05-14 19:32:49.552: e/androidruntime(1657): @ android.app.activitythread.performlaunchactivity(activitythread.java:1586) 05-14 19:32:49.552: e/androidruntime(1657): ... 11 more 05-14 19:32:49.552: e/androidruntime(1657): caused by: java.lang.reflect.invocationtargetexception 05-14 19:32:49.552: e/androidruntime(1657): @ java.lang.reflect.constructor.constructnative(native method) 05-14 19:32:49.552: e/androidruntime(1657): @ java.lang.reflect.constructor.newinstance(constructor.java:415) 05-14 19:32:49.552: e/androidruntime(1657): @ android.view.layoutinflater.createview(layoutinflater.java:505) 05-14 19:32:49.552: e/androidruntime(1657): ... 21 more 05-14 19:32:49.552: e/androidruntime(1657): caused by: java.lang.outofmemoryerror: bitmap size exceeds vm budget 05-14 19:32:49.552: e/androidruntime(1657): @ android.graphics.bitmap.nativecreate(native method) 05-14 19:32:49.552: e/androidruntime(1657): @ android.graphics.bitmap.createbitmap(bitmap.java:477) 05-14 19:32:49.552: e/androidruntime(1657): @ android.graphics.bitmap.createbitmap(bitmap.java:444) 05-14 19:32:49.552: e/androidruntime(1657): @ android.graphics.bitmap.createscaledbitmap(bitmap.java:349) 05-14 19:32:49.552: e/androidruntime(1657): @ android.graphics.bitmapfactory.finishdecode(bitmapfactory.java:488) 05-14 19:32:49.552: e/androidruntime(1657): @ android.graphics.bitmapfactory.decodestream(bitmapfactory.java:463) 05-14 19:32:49.552: e/androidruntime(1657): @ android.graphics.bitmapfactory.decoderesourcestream(bitmapfactory.java:326) 05-14 19:32:49.552: e/androidruntime(1657): @ android.graphics.drawable.drawable.createfromresourcestream(drawable.java:697) 05-14 19:32:49.552: e/androidruntime(1657): @ android.content.res.resources.loaddrawable(resources.java:1709) 05-14 19:32:49.552: e/androidruntime(1657): @ android.content.res.typedarray.getdrawable(typedarray.java:601) 05-14 19:32:49.552: e/androidruntime(1657): @ android.view.view.<init>(view.java:1951) 05-14 19:32:49.552: e/androidruntime(1657): @ android.view.view.<init>(view.java:1899) 05-14 19:32:49.552: e/androidruntime(1657): @ android.view.viewgroup.<init>(viewgroup.java:286) 05-14 19:32:49.552: e/androidruntime(1657): @ android.widget.linearlayout.<init>(linearlayout.java:120) 05-14 19:32:49.552: e/androidruntime(1657): ... 24 more 05-14 19:32:52.442: i/process(1657): sending signal. pid: 1657 sig: 9
and "sign in form" exeption thrown showned followed::
package com.xyz.account; import java.util.arraylist; import java.util.concurrent.executionexception; import org.apache.http.namevaluepair; import org.apache.http.message.basicnamevaluepair; import org.json.jsonarray; import org.json.jsonobject; import android.app.activity; import android.app.alertdialog; import android.app.dialog; import android.app.progressdialog; import android.content.context; import android.content.dialoginterface; import android.content.intent; import android.content.res.resources; import android.os.asynctask; import android.os.bundle; import android.util.log; import android.view.view; import android.widget.edittext; import android.widget.textview; import android.widget.toast; import com.xyz.my_list; import com.xyz.r; public class signinactivity extends activity { edittext email,pwd; textview err_tv; intent i; context c; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.signin); c=getapplicationcontext(); email=(edittext)findviewbyid(r.id.email); pwd=(edittext)findviewbyid(r.id.pwd); err_tv=(textview)findviewbyid(r.id.info_text); } public void goto_signup(view v){ i=new intent(this,signupactivity.class); startactivity(i); } public void goto_forgotpwd(view v){ i=new intent(this,forgotpwdactivity.class); startactivity(i); } public void action_signin(view v){ try{ signin l=new signin(this); l.execute(email.gettext().tostring(), pwd.gettext().tostring()); }catch (exception e) { msg = "err-"+e.getlocalizedmessage(); showdialog(dialog_err_message); } } class signin extends asynctask<string, void, boolean> { // string message; progressdialog mprogressdialog; boolean issuccess; private activity activity; public signin(activity activity) { this.activity = activity; } resources res = getresources(); string httpconnstr = res.getstring(r.string.httpconnstr); protected void onpreexecute() { mprogressdialog = progressdialog.show(signinactivity.this, "please wait...", "authenticating..."); } @override protected void onpostexecute(boolean result) { // todo auto-generated method stub super.onpostexecute(result); mprogressdialog.cancel(); if(result){ // toast.maketext(signinactivity.this, "welcome :: "+user_id+"::"+user_fname, // toast.length_long).show(); // msg = "welcome - "+user_id+"::"+user_fname; // showdialog(dialog_err_message); toast.maketext(activity, boolean.tostring(result), toast.length_long).show(); activity.startactivity(new intent(activity, my_list.class)); }else{ err_tv.settext("invalid emailid/password"); msg = "invalid emailid/password"; showdialog(dialog_err_message); } } @override protected boolean doinbackground(string... params) { // todo auto-generated method stub string email = params[0]; string pwd = params[1]; return issuccess = getserverdata(httpconnstr,email,pwd); } } string user_id="0",user_fname="#"; private boolean getserverdata(string conn_key,string email, string pwd) { arraylist<namevaluepair> postparameters = new arraylist<namevaluepair>(); postparameters.add(new basicnamevaluepair("query", "signin")); postparameters.add(new basicnamevaluepair("email", email)); postparameters.add(new basicnamevaluepair("pwd", pwd)); string response = null; try { response = com.dj.holyherb.conn.customhttpclient.executehttppost( conn_key, postparameters); string result = response.tostring(); if(result.equals("")){ return false; }else{ try { jsonarray jarray = new jsonarray(result); jsonobject json_data = jarray.getjsonobject(0); user_id = json_data.getstring("user_id"); user_fname = json_data.getstring("user_fname"); } catch (exception e) { log.e("log_tag", "error parsing data " + e.tostring()); msg = "error parsing data " + e.tostring(); showdialog(dialog_err_message); return false; } } } catch (exception e) { log.e("log_tag", "error in http connection!!" + e.tostring()); msg = "error in http connection!!" + e.tostring(); msg = "error in connection.\ndo check ur connection & try again."; showdialog(dialog_err_message); return false; } return true; } private static final int dialog_err_message = 1; private static final int dialog_progress = 4; private static final int max_progress = 100; private progressdialog mprogressdialog; string msg = "-", title = "error..."; @override protected dialog oncreatedialog(int id) { switch (id) { case dialog_err_message: return new alertdialog.builder(this) .seticon(r.drawable.alert_dialog_icon) .settitle(title) .setmessage(msg) .setnegativebutton("cancel", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int whichbutton) { // user clicked cancel stuff } }).create(); case dialog_progress: mprogressdialog = new progressdialog(this); mprogressdialog.seticon(r.drawable.alert_dialog_icon); mprogressdialog.settitle(title); mprogressdialog.setprogressstyle(progressdialog.style_horizontal); mprogressdialog.setmax(max_progress); mprogressdialog.setbutton("hide", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int whichbutton) { } }); mprogressdialog.setbutton2("cancel", new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int whichbutton) { } }); return mprogressdialog; } return null; } }
caused by: java.lang.outofmemoryerror: bitmap size exceeds vm budget
try recycle bitmaps using , set them null, using bitmap.recycle()
.
you scale/resize bitmap make sure uses minimum possible space.
Comments
Post a Comment