java - Android application Error passing data -
i keep getting error shows:
(04-04 23:26:29.557: e/dalvikvm(716): unable open stack trace file '/data/anr/traces.txt': permission denied).
please help. i'm trying pass data android app.
public class data extends activity implements onclicklistener{ button start, startfor; edittext sendet; textview gotanswer; @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.get); initialize(); } private void initialize(){ start = (button) findviewbyid(r.id.bsa); startfor = (button) findviewbyid(r.id.bsafr); sendet = (edittext) findviewbyid(r.id.etsend); gotanswer = (textview) findviewbyid(r.id.tvgot); start.setonclicklistener(this); startfor.setonclicklistener(this); } @override public void onclick(view arg0) { // todo auto-generated method stub switch(arg0.getid()){ case r.id.bsa: string bread = sendet.gettext().tostring(); bundle basket = new bundle(); basket.putstring("key", bread); intent = new intent(data.this,openedclass.class); a.putextras(basket); startactivity(a); break; case r.id.bsafr: intent = new intent(data.this,openedclass.class); startactivityforresult(i,0); break; } } @override protected void onactivityresult(int requestcode, int resultcode, intent data) { // todo auto-generated method stub super.onactivityresult(requestcode, resultcode, data); } } package com.christian.amaro; import android.app.activity; import android.os.bundle; import android.view.view; import android.view.view.onclicklistener; import android.widget.button; import android.widget.radiogroup; import android.widget.radiogroup.oncheckedchangelistener; import android.widget.textview; public class openedclass extends activity implements onclicklistener, oncheckedchangelistener { textview question, test; button returndata; radiogroup selectionlist; string gotbread,setdata; @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.send); inilialize(); bundle gotbasket = getintent().getextras(); gotbread = gotbasket.getstring("key"); question.settext(gotbread); } private void inilialize() { // todo auto-generated method stub question = (textview) findviewbyid(r.id.tvquestion); test = (textview) findviewbyid(r.id.tvtext); returndata = (button) findviewbyid(r.id.breturn); returndata.setonclicklistener(this); selectionlist = (radiogroup) findviewbyid(r.id.rganswers); selectionlist.setoncheckedchangelistener(this); } @override public void onclick(view v) { // todo auto-generated method stub } @override public void oncheckedchanged(radiogroup arg0, int arg1) { // todo auto-generated method stub switch (arg1) { case r.id.rcrazy: setdata = "probably right!"; break; case r.id.rsexy: setdata = "definitely right!"; break; case r.id.rboth: setdata = "spot on!"; break; } test.settext(setdata); } }
adb shell root@android: # cd /data/anr root@android:/data/anr # ls -l traces.txt -rw-rw-rw- system system 76808 2013-04-05 13:03 traces.txt root@android:/data/anr #
-rw-rw-rw should see (it means permissions read , write)
if see different, do
root@android:/data/anr # chmod 666 traces.txt
ps device must rooted, otherwise unable problem :)
Comments
Post a Comment