Android App Crashes on Phone When Viewing call logs -


i have been working on app reads call logs. used code.

public string log_dump(contentresolver con){      stringbuffer sb = new stringbuffer();     cursor managedcursor = con.query(calllog.calls.content_uri, null,null, null, null);     int number = managedcursor.getcolumnindex(calllog.calls.number);     int type = managedcursor.getcolumnindex(calllog.calls.type);     int date = managedcursor.getcolumnindex(calllog.calls.date);     int duration = managedcursor.getcolumnindex(calllog.calls.duration);     sb.append("call details :");     int i=0;     while (managedcursor.movetonext()) {         string phnumber = managedcursor.getstring(number);         string calltype = managedcursor.getstring(type);         string calldate = managedcursor.getstring(date);         date calldaytime = new date(long.valueof(calldate));         string callduration = managedcursor.getstring(duration);         string dir = null;         int dircode = integer.parseint(calltype);         switch (dircode) {         case calllog.calls.outgoing_type:             dir = "outgoing";             break;          case calllog.calls.incoming_type:             dir = "incoming";             break;          case calllog.calls.missed_type:             dir = "missed";             break;         }         sb.append("\nphone number:--- " + phnumber + " \ncall type:--- "                 + dir + " \ncall date:--- " + calldaytime                 + " \ncall duration in sec :--- " + callduration);         sb.append("\n----------------------------------");          if(i>10){             break;         }         = i+1;     }     managedcursor.close();     return sb.tostring();  } 

when run on emulator works fine. on phone crashed. can u guys me out.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -