Difficulty read logcat to textview - android

I have a Touch Mobile Computer with a barcode scanner.
I'm trying to write an application and I'm trying to build up an infrastructure for future errors.
So I want to build a screen that will show me the logcat after a malfunction occurred. In addition I try to extract the log to a text file inside the device and the internal storage of the device. To do this I created another activity to switch to another screen when I click the Log button - to display the log.
I would be happy to help with what I'm doing wrong.
In addition to how I can get the logcat to a text file inside the device and the internal storage of the device, when I tried to do this no txt file has been created in the device's internal folders.
public class LogActivity extends AppCompatActivity {
private TextView log;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_log);
log = (TextView)findViewById(R.id.logTextView);
log.setMovementMethod(new ScrollingMovementMethod());
StringBuilder logBuilder = new StringBuilder();
try {
Process process = Runtime.getRuntime().exec("logcat -d");
BufferedReader bufferedReader = new BufferedReader(
new InputStreamReader(process.getInputStream()));
String line;
while ((line = bufferedReader.readLine()) != null) {
logBuilder.append(line + "\n");
}
} catch (IOException e)
{
e.printStackTrace();
}
log.setText(logBuilder.toString());
} }
But when I click the Log button I get the following logcat when my app works perfectly and does not collapse:
I/System.out: --------- beginning of crash
I/System.out: E/AndroidRuntime( 3708): FATAL EXCEPTION: AsyncTask #5
I/System.out: E/AndroidRuntime( 3708): Process: com.example.galchaplin.warehouseapplication, PID: 3708
I/System.out: E/AndroidRuntime( 3708): java.lang.RuntimeException: An error occured while executing doInBackground()
I/System.out: E/AndroidRuntime( 3708): at android.os.AsyncTask$3.done(AsyncTask.java:304)
I/System.out: E/AndroidRuntime( 3708): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
I/System.out: E/AndroidRuntime( 3708): at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
I/System.out: E/AndroidRuntime( 3708): at java.util.concurrent.FutureTask.run(FutureTask.java:242)
I/System.out: E/AndroidRuntime( 3708): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
I/System.out: E/AndroidRuntime( 3708): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
I/System.out: E/AndroidRuntime( 3708): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
I/System.out: E/AndroidRuntime( 3708): at java.lang.Thread.run(Thread.java:818)
I/System.out: E/AndroidRuntime( 3708): Caused by: java.lang.NumberFormatException: Invalid int: "9D1801"
I/System.out: E/AndroidRuntime( 3708): at java.lang.Integer.invalidInt(Integer.java:138)
I/System.out: E/AndroidRuntime( 3708): at java.lang.Integer.parse(Integer.java:410)
I/System.out: E/AndroidRuntime( 3708): at java.lang.Integer.parseInt(Integer.java:367)
I/System.out: E/AndroidRuntime( 3708): at java.lang.Integer.parseInt(Integer.java:334)
I/System.out: E/AndroidRuntime( 3708): at com.example.galchaplin.warehouseapplication.MoveItemActivity$CheckLocation.doInBackground(MoveItemActivity.java:358)
I/System.out: E/AndroidRuntime( 3708): at com.example.galchaplin.warehouseapplication.MoveItemActivity$CheckLocation.doInBackground(MoveItemActivity.java:347)
I/System.out: E/AndroidRuntime( 3708): at android.os.AsyncTask$2.call(AsyncTask.java:292)
I/System.out: E/AndroidRuntime( 3708): at java.util.concurrent.FutureTask.run(FutureTask.java:237)
I/System.out: E/AndroidRuntime( 3708): ... 4 more
I/System.out: E/AndroidRuntime( 4228): FATAL EXCEPTION: main
I/System.out: E/AndroidRuntime( 4228): Process: com.example.galchaplin.warehouseapplication, PID: 4228
I/System.out: E/AndroidRuntime( 4228): java.lang.RuntimeException: Unable to resume activity {com.example.galchaplin.warehouseapplication/com.example.galchaplin.warehouseapplication.MenuActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'android.os.CountDownTimer android.os.CountDownTimer.start()' on a null object reference
I/System.out: E/AndroidRuntime( 4228): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2986)
I/System.out: E/AndroidRuntime( 4228): at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3017)
I/System.out: E/AndroidRuntime( 4228): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2392)
I/System.out: E/AndroidRuntime( 4228): at android.app.ActivityThread.access$800(ActivityThread.java:151)
I/System.out: E/AndroidRuntime( 4228): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)
I/System.out: E/AndroidRuntime( 4228): at android.os.Handler.dispatchMessage(Handler.java:102)
I/System.out: E/AndroidRuntime( 4228): at android.os.Looper.loop(Looper.java:135)
I/System.out: E/AndroidRuntime( 4228): at android.app.ActivityThread.main(ActivityThread.java:5254)
I/System.out: E/AndroidRuntime( 4228): at java.lang.reflect.Method.invoke(Native Method)
I/System.out: E/AndroidRuntime( 4228): at java.lang.reflect.Method.invoke(Method.java:372)
I/System.out: E/AndroidRuntime( 4228): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
I/System.out: E/AndroidRuntime( 4228): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
I/System.out: E/AndroidRuntime( 4228): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.os.CountDownTimer android.os.CountDownTimer.start()' on a null object reference
I/System.out: E/AndroidRuntime( 4228): at com.example.galchaplin.warehouseapplication.MenuActivity.onResume(MenuActivity.java:112)
I/System.out: E/AndroidRuntime( 4228): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1257)
I/System.out: E/AndroidRuntime( 4228): at android.app.Activity.performResume(Activity.java:6119)
I/System.out: E/AndroidRuntime( 4228): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2975)
This code is located in the class where the button to the log screen is located.
In the class of the log code there is currently no countdowntimer.

Related

Exception when invoking MMS's Attach Image activity

I try to invoke MMS's Attach Image Activity, this is my code:
Intent intent2 = new Intent("com.android.mms.action.ATTACH_IMAGE");
intent2.setType("image/*");
intent2.putExtra(Intent.EXTRA_STREAM, mUri);
try {
startActivity(intent);
} catch (ActivityNotFoundException e) {
e.printStackTrace(System.err);
}
But I get this exception:
m.android.mms/com.android.mms.AttachImage}: java.lang.IllegalAccessException: access to class not allowed
E/AndroidRuntime( 673): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2219)
E/AndroidRuntime( 673): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2332)
E/AndroidRuntime( 673): at android.app.ActivityThread.access$1800(ActivityThread.java:110)
E/AndroidRuntime( 673): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1717)
E/AndroidRuntime( 673): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 673): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 673): at android.app.ActivityThread.main(ActivityThread.java:4021)
E/AndroidRuntime( 673): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 673): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 673): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
E/AndroidRuntime( 673): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
E/AndroidRuntime( 673): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 673): Caused by: java.lang.IllegalAccessException: access to class not allowed
E/AndroidRuntime( 673): at java.lang.Class.newInstanceImpl(Native Method)
E/AndroidRuntime( 673): at java.lang.Class.newInstance(Class.java:1472)
E/AndroidRuntime( 673): at android.app.Instrumentation.newActivity(Instrumentation.java:1097)
E/AndroidRuntime( 673): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
Can you please tell me why?
Thank you.
This is probably more what you're trying to accomplish:
startActivity(
new Intent(Intent.ACTION_SEND)
.setType("image/*")
.putExtra("sms_body", "hello there")
.putExtra(Intent.EXTRA_STREAM, Uri.parse("content://media/external/images/media/1")
)
);
As long as you've snapped at least one photo with you camera, you should be able to send that photo using this code. Note that this code won't work with the emulator.

Getting exception FATAL EXCEPTION: View not attached for PhoneGap App

I am working on Phonegap Project. Everything works fine. when i want to rotate the screen App existing and getting exception
E/AndroidRuntime( 4068): FATAL EXCEPTION: main
E/AndroidRuntime( 4068): java.lang.IllegalArgumentException: View not attached to window manager
E/AndroidRuntime( 4068): at android.view.WindowManagerImpl.findViewLocked(WindowManagerImpl.java:587)
E/AndroidRuntime( 4068): at android.view.WindowManagerImpl.removeView(WindowManagerImpl.java:324)
E/AndroidRuntime( 4068): at android.view.WindowManagerImpl$CompatModeWrapper.removeView(WindowManagerImpl.java:151)
E/AndroidRuntime( 4068): at android.app.Dialog.dismissDialog(Dialog.java:328)
E/AndroidRuntime( 4068): at android.app.Dialog$1.run(Dialog.java:119)
E/AndroidRuntime( 4068): at android.app.Dialog.dismiss(Dialog.java:313)
E/AndroidRuntime( 4068): at org.apache.cordova.DroidGap.removeSplashScreen(DroidGap.java:970)
E/AndroidRuntime( 4068): at org.apache.cordova.DroidGap$5$1.run(DroidGap.java:1013)
E/AndroidRuntime( 4068): at android.os.Handler.handleCallback(Handler.java:605)
E/AndroidRuntime( 4068): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 4068): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 4068): at android.app.ActivityThread.main(ActivityThread.java:4424)
E/AndroidRuntime( 4068): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 4068): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 4068): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
E/AndroidRuntime( 4068): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
E/AndroidRuntime( 4068): at dalvik.system.NativeStart.main(Native Method)
I already given
android:configChanges="orientation|keyboardHidden|screenLayout"
My Activity Code
public class MyPhoneGapActivity extends DroidGap {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//super.setIntegerProperty("loadUrlTimeoutValue", 60000);
super.setIntegerProperty("splashscreen", R.drawable.splash);
super.loadUrl("file:///android_asset/www/index.html", 60000);
}
}
to my Activity.but no use
Can any one help me please.

IntentService RuntimeException [duplicate]

Possible Duplicate:
Android RuntimeException: Unable to instantiate the service
Problem: starting an IntentService generates a RuntimeException.
I'm clueless. If you need more info, just ask. Log:
D/dalvikvm( 6839): newInstance failed: no <init>()
D/AndroidRuntime( 6839): Shutting down VM
W/dalvikvm( 6839): threadid=1: thread exiting with uncaught exception (group=0x40015560)
E/AndroidRuntime( 6839): FATAL EXCEPTION: main
E/AndroidRuntime( 6839): java.lang.RuntimeException: Unable to instantiate service org.xyz.android.service.MyService: java.lang.InstantiationException: org.xyz.android.service.MyService
E/AndroidRuntime( 6839): at android.app.ActivityThread.handleCreateService(ActivityThread.java:1929)
E/AndroidRuntime( 6839): at android.app.ActivityThread.access$2500(ActivityThread.java:117)
E/AndroidRuntime( 6839): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:985)
E/AndroidRuntime( 6839): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 6839): at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime( 6839): at android.app.ActivityThread.main(ActivityThread.java:3683)
E/AndroidRuntime( 6839): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 6839): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 6839): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/AndroidRuntime( 6839): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/AndroidRuntime( 6839): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 6839): Caused by: java.lang.InstantiationException: org.xyz.android.service.MyService
E/AndroidRuntime( 6839): at java.lang.Class.newInstanceImpl(Native Method)
E/AndroidRuntime( 6839): at java.lang.Class.newInstance(Class.java:1409)
E/AndroidRuntime( 6839): at android.app.ActivityThread.handleCreateService(ActivityThread.java:1926)
E/AndroidRuntime( 6839): ... 10 more
This code calls the service (it's being called from a ContentProvider):
Intent i = new Intent(
getContext(),
MyService.class);
i.putStringArrayListExtra(EXTRA_MISSING, missingMonths);
i.putExtra(EXTRA_URI, uri);
i.putExtra(EXTRA_START, startTime);
i.putExtra(EXTRA_END, endTime);
getContext().startService(i);
And this is the IntentService relevant code blocks (there are only two methods. Besides the asynctask itself, of course):
public MyService(String name) {
super("MyService");
}
#Override
protected void onHandleIntent(Intent intent) {
// ... do stuff
new DownloaderTask().execute(missingMonths);
}
You appear to be missing the zero-argument public constructor. Delete the String name from your current constructor (since you're not using it anyway), and you should be good to go.

Scrolling ListView causes app to crash

I have a ListView which I'm populating from a SQLite database. I have 350 rows in my ListView on my HTC Hero 2.1 and everything works fine. I installed it on Samsung Galaxy S 2.2 and I have 270 rows in my ListView, and every time when I reach near the bottom of my ListView scrolling the list, my app crashes.
This is the log file:
06-17 14:29:33.796 W/dalvikvm( 3565): threadid=1: thread exiting with uncaught exception (group=0x4001d7d0)
06-17 14:29:33.816 E/AndroidRuntime( 3565): FATAL EXCEPTION: main
06-17 14:29:33.816 E/AndroidRuntime( 3565): java.lang.NullPointerException
06-17 14:29:33.816 E/AndroidRuntime( 3565): at aec.phonebook.ListContacts$ItemAdapter.getView(ListContacts.java:539)
06-17 14:29:33.816 E/AndroidRuntime( 3565): at android.widget.AbsListView.obtainView(AbsListView.java:1410)
06-17 14:29:33.816 E/AndroidRuntime( 3565): at android.widget.ListView.makeAndAddView(ListView.java:1802)
06-17 14:29:33.816 E/AndroidRuntime( 3565): at android.widget.ListView.fillDown(ListView.java:727)
06-17 14:29:33.816 E/AndroidRuntime( 3565): at android.widget.ListView.fillGap(ListView.java:698)
06-17 14:29:33.816 E/AndroidRuntime( 3565): at android.widget.AbsListView.trackMotionScroll(AbsListView.java:3367)
06-17 14:29:33.816 E/AndroidRuntime( 3565): at android.widget.AbsListView.onTouchEvent(AbsListView.java:2251)
06-17 14:29:33.816 E/AndroidRuntime( 3565): at android.widget.ListView.onTouchEvent(ListView.java:3605)
06-17 14:29:33.816 E/AndroidRuntime( 3565): at android.view.View.dispatchTouchEvent(View.java:3819)
06-17 14:29:33.816 E/AndroidRuntime( 3565): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:897)
06-17 14:29:33.816 E/AndroidRuntime( 3565): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)
06-17 14:29:33.816 E/AndroidRuntime( 3565): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)
06-17 14:29:33.816 E/AndroidRuntime( 3565): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)
06-17 14:29:33.816 E/AndroidRuntime( 3565): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:936)
06-17 14:29:33.816 E/AndroidRuntime( 3565): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1723)
06-17 14:29:33.816 E/AndroidRuntime( 3565): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1129)
06-17 14:29:33.816 E/AndroidRuntime( 3565): at android.app.Activity.dispatchTouchEvent(Activity.java:2086)
06-17 14:29:33.816 E/AndroidRuntime( 3565): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1707)
06-17 14:29:33.816 E/AndroidRuntime( 3565): at android.view.ViewRoot.handleMessage(ViewRoot.java:1810)
06-17 14:29:33.816 E/AndroidRuntime( 3565): at android.os.Handler.dispatchMessage(Handler.java:99)
06-17 14:29:33.816 E/AndroidRuntime( 3565): at android.os.Looper.loop(Looper.java:123)
06-17 14:29:33.816 E/AndroidRuntime( 3565): at android.app.ActivityThread.main(ActivityThread.java:4627)
06-17 14:29:33.816 E/AndroidRuntime( 3565): at java.lang.reflect.Method.invokeNative(Native Method)
06-17 14:29:33.816 E/AndroidRuntime( 3565): at java.lang.reflect.Method.invoke(Method.java:521)
06-17 14:29:33.816 E/AndroidRuntime( 3565): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
06-17 14:29:33.816 E/AndroidRuntime( 3565): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
06-17 14:29:33.816 E/AndroidRuntime( 3565): at dalvik.system.NativeStart.main(Native Method)
06-17 14:29:33.827 W/ActivityManager( 2465): Force finishing activity aec.phonebook/.ListContacts
06-17 14:29:33.831 I/ ( 2465): dumpmesg > "/data/log/dumpstate_app_error.log"
06-17 14:29:33.855 I/dumpstate( 3830): begin
06-17 14:29:33.890 V/InputDevice( 2465): ID[0]=0(0) Up(1=>0)
06-17 14:29:36.890 W/PowerManagerService( 2465): Timer 0x7->0x3|0x0
06-17 14:29:36.890 I/PowerManagerService( 2465): Ulight 7->3|0
06-17 14:29:36.929 D/VoldCmdListener( 2348): asec list
06-17 14:29:36.937 D/VoldCmdListener( 2348): CommandListener::AsecCmd::runCommand -> com.fridgecat.android.atiltlite-1
06-17 14:29:38.222 I/dumpstate( 3830): done
06-17 14:29:38.370 W/WindowManager( 2465): No window to dispatch pointer action 1
06-17 14:29:38.374 W/ActivityManager( 2465): Activity pause timeout for HistoryRecord{4806e860 aec.phonebook/.ListContacts}
EDIT:
Here is the code:
#Override
public View getView(int position, View convertView, ViewGroup parent){
View v = convertView;
if (v == null) {
LayoutInflater vi = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.row, null);
}
Item j = items.get(position);
if (j != null) {
TextView tvn = (TextView)v.findViewById(R.id.textViewName);
TextView tvnum = (TextView)v.findViewById(R.id.textViewNumber);
TextView tvid = (TextView)v.findViewById(R.id.textViewId);
TextView tvoper = (TextView)v.findViewById(R.id.textViewOperator);
if (tvn != null) {
tvn.setText(j.getname());
}
if(tvnum != null){
tvnum.setText(j.getnumber());
}
if (tvid != null) {
tvid.setText(j.getid());
}
if(tvoper != null){
tvoper.setText(j.getoperator());
if(j.getstatus().equals("0")){
tvoper.setTextColor(Color.WHITE);
}
if(j.getstatus().equals("1")){
tvoper.setTextColor(Color.GREEN);
}
if(j.getstatus().equals("2")){
tvoper.setTextColor(Color.RED);
}
}
}
}
Might be the possible error in your code is "string array size" that you have defined .
for example : The StringArray you created ,has 270 elements but size you have defined maybe more than 270 .
that creates problem , of null values in the remaining uninitialised arrays.
So make sure the ArraySize is equal to your ListSize ..
Hope it helps

Reading PhoneLookup.NUMBER crashing application in Android [duplicate]

This question already has an answer here:
How to read contacts on Android 2.0
9 answers
The following is my code:
Cursor mCursor = this.getContentResolver().query(
ContactsContract.Contacts.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.HAS_PHONE_NUMBER + "==1", null, null);
startManagingCursor(mCursor);
ListAdapter adapter = new SimpleCursorAdapter(this,
R.layout.two_line_list_item, mCursor, new String[] {
PhoneLookup.DISPLAY_NAME, PhoneLookup.NUMBER}, new int[] {R.id.text1, R.id.text2});
setListAdapter(adapter);
I'm able to see the DISPLAY_NAME, but whenever I add PhoneLookup.NUMBER, the application crashes. I also added a condition to select only contacts that have a phone number assuming its crashing due to null data. Still no luck. Is there any permissions I need to add to get the phone number? I already have android.permission.READ_CONTACTS in my manifest.
Logcat output:
I/ActivityManager( 58): Starting activity: Intent { cmp=fourth.app/.food }
D/AndroidRuntime( 335): Shutting down VM
W/dalvikvm( 335): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
E/AndroidRuntime( 335): FATAL EXCEPTION: main
E/AndroidRuntime( 335): java.lang.RuntimeException: Unable to start activity ComponentInfo{fourth.app/fourth.app.food}: java.lang.Ille
galArgumentException: column 'number' does not exist
E/AndroidRuntime( 335): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
E/AndroidRuntime( 335): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
E/AndroidRuntime( 335): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
E/AndroidRuntime( 335): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
E/AndroidRuntime( 335): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 335): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 335): at android.app.ActivityThread.main(ActivityThread.java:4627)
E/AndroidRuntime( 335): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 335): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 335): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime( 335): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
E/AndroidRuntime( 335): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 335): Caused by: java.lang.IllegalArgumentException: column 'number' does not exist
E/AndroidRuntime( 335): at android.database.AbstractCursor.getColumnIndexOrThrow(AbstractCursor.java:314)
E/AndroidRuntime( 335): at android.database.CursorWrapper.getColumnIndexOrThrow(CursorWrapper.java:99)
E/AndroidRuntime( 335): at android.widget.SimpleCursorAdapter.findColumns(SimpleCursorAdapter.java:312)
E/AndroidRuntime( 335): at android.widget.SimpleCursorAdapter.<init>(SimpleCursorAdapter.java:87)
E/AndroidRuntime( 335): at fourth.app.food.onCreate(food.java:21)
E/AndroidRuntime( 335): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/AndroidRuntime( 335): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
E/AndroidRuntime( 335): ... 11 more
W/ActivityManager( 58): Force finishing activity fourth.app/.food
W/ActivityManager( 58): Force finishing activity fourth.app/.four
W/ActivityManager( 58): Activity pause timeout for HistoryRecord{43f54e88 fourth.app/.food}
java.lang.IllegalArgumentException: column 'number' does not exist
You are using an invalid name of column.
have a look at this question: How to read contacts on Android 2.0

Resources