getView() never called baseadapter getcount called - java

I am developing a gridview to display JSON images. I am entering ImageAdapter, but I am not receiving images in the screen indicating that something incorrect occurred while getting the associated view. Is MyArrList null?
I realize that there are other posts similar to my own out there, but I have done deep research into them and cannot find a solution.
Logcat:
V/log﹕ getcount
08-04 11:02:33.044 22241-22241/com.example.justin.myapplication V/log﹕ getcount
08-04 11:02:33.060 22241-22241/com.example.justin.myapplication V/log﹕ getcount
08-04 11:02:33.060 22241-22241/com.example.justin.myapplication V/log﹕ getcount
08-04 11:02:33.060 22241-22241/com.example.justin.myapplication V/log﹕ getcount
08-04 11:02:33.060 22241-22241/com.example.justin.myapplication V/log﹕ getcount
08-04 11:02:33.169 22241-22241/com.example.justin.myapplication V/log﹕ getcount
08-04 11:02:33.169 22241-22241/com.example.justin.myapplication V/log﹕ getcount
08-04 11:02:33.177 22241-22241/com.example.justin.myapplication V/log﹕ getcount
08-04 11:02:33.177 22241-22241/com.example.justin.myapplication V/log﹕ getcount
08-04 09:12:44.179 6312-6315/com.example.justin.myapplication D/dalvikvm﹕ GC_CONCURRENT freed 177K, 3% free 8929K/9148K, paused 5ms+2ms, total 37ms
08-04 09:12:44.179 6312-6352/com.example.justin.myapplication D/dalvikvm﹕ WAIT_FOR_CONCURRENT_GC blocked 17ms
08-04 09:12:44.203 6312-6352/com.example.justin.myapplication D/dalvikvm﹕ GC_FOR_ALLOC freed 285K, 6% free 8941K/9452K, paused 20ms, total 20ms
08-04 09:12:44.289 6312-6315/com.example.justin.myapplication D/dalvikvm﹕ GC_CONCURRENT freed 241K, 3% free 9198K/9464K, paused 1ms+5ms, total 24ms
08-04 09:12:44.359 6312-6352/com.example.justin.myapplication D/dalvikvm﹕ GC_FOR_ALLOC freed 288K, 5% free 9159K/9612K, paused 13ms, total 13ms
08-04 09:12:44.359 6312-6352/com.example.justin.myapplication I/dalvikvm-heap﹕ Grow heap (frag case) to 9.093MB for 130826-byte allocation
08-04 09:12:44.375 6312-6321/com.example.justin.myapplication D/dalvikvm﹕ GC_FOR_ALLOC freed 85K, 6% free 9202K/9740K, paused 14ms, total 14ms
08-04 09:12:44.375 6312-6352/com.example.justin.myapplication V/data﹕ {"car_images":[{"CarManufacturerImage":"bmw.png","...}
08-04 09:12:45.875 6312-6315/com.example.justin.myapplication D/dalvikvm﹕ GC_CONCURRENT freed 269K, 5% free 9299K/9740K, paused 2ms+3ms, total 23ms
08-04 09:12:46.047 6312-6352/com.example.justin.myapplication V/Bitmap﹕ CarImageLink
08-04 09:12:46.047 6312-6352/com.example.justin.myapplication V/MyArrList﹕ [{CarImageLink=android.graphics.drawable.BitmapDrawable#41b5b7d8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b34d28}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41ba3d10}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b5eb98}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b3c7e8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b9c828}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bb96a0}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b54f48}]
08-04 09:12:46.054 6312-6352/com.example.justin.myapplication V/return0﹕ [{CarImageLink=android.graphics.drawable.BitmapDrawable#41b5b7d8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b34d28}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41ba3d10}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b5eb98}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b3c7e8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b9c828}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bb96a0}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b54f48}]
08-04 09:12:46.054 6312-6352/com.example.justin.myapplication V/getJSONObject(i)﹕ {"CarManufacturerImage":"bmw.png",....}
08-04 09:12:46.265 6312-6352/com.example.justin.myapplication V/Bitmap﹕ CarImageLink
08-04 09:12:46.265 6312-6352/com.example.justin.myapplication V/MyArrList﹕ [{CarImageLink=android.graphics.drawable.BitmapDrawable#41b5b7d8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b34d28}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41ba3d10}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b5eb98}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b3c7e8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b9c828}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bb96a0}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b54f48}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b86380}]
08-04 09:12:46.273 6312-6352/com.example.justin.myapplication V/return0﹕ [{CarImageLink=android.graphics.drawable.BitmapDrawable#41b5b7d8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b34d28}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41ba3d10}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b5eb98}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b3c7e8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b9c828}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bb96a0}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b54f48}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b86380}]
08-04 09:12:46.273 6312-6352/com.example.justin.myapplication V/getJSONObject(i)﹕ {"CarManufacturerImage":"bmw.png",....}
08-04 09:12:46.468 6312-6352/com.example.justin.myapplication V/Bitmap﹕ CarImageLink
08-04 09:12:46.468 6312-6352/com.example.justin.myapplication V/MyArrList﹕ [{CarImageLink=android.graphics.drawable.BitmapDrawable#41b5b7d8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b34d28}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41ba3d10}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b5eb98}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b3c7e8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b9c828}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bb96a0}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b54f48}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b86380}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b9c420}]
08-04 09:12:46.468 6312-6352/com.example.justin.myapplication V/return0﹕ [{CarImageLink=android.graphics.drawable.BitmapDrawable#41b5b7d8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b34d28}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41ba3d10}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b5eb98}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b3c7e8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b9c828}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bb96a0}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b54f48}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b86380}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b9c420}]
08-04 09:12:46.476 6312-6352/com.example.justin.myapplication V/getJSONObject(i)﹕ {"CarManufacturerImage":"bmw.png",....}
08-04 09:12:46.679 6312-6352/com.example.justin.myapplication V/Bitmap﹕ CarImageLink
08-04 09:12:46.687 6312-6352/com.example.justin.myapplication V/MyArrList﹕ [{CarImageLink=android.graphics.drawable.BitmapDrawable#41b5b7d8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b34d28}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41ba3d10}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b5eb98}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b3c7e8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b9c828}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bb96a0}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b54f48}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b86380}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b9c420}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bdedf8}]
08-04 09:12:46.695 6312-6352/com.example.justin.myapplication V/return0﹕ [{CarImageLink=android.graphics.drawable.BitmapDrawable#41b5b7d8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b34d28}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41ba3d10}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b5eb98}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b3c7e8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b9c828}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bb96a0}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b54f48}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b86380}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b9c420}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bdedf8}]
08-04 09:12:46.695 6312-6352/com.example.justin.myapplication V/getJSONObject(i)﹕ {"CarManufacturerImage":"bmw.png",....}
08-04 09:12:46.711 6312-6315/com.example.justin.myapplication D/dalvikvm﹕ GC_CONCURRENT freed 315K, 4% free 9420K/9812K, paused 7ms+2ms, total 31ms
08-04 09:12:46.906 6312-6352/com.example.justin.myapplication V/Bitmap﹕ CarImageLink
08-04 09:12:46.906 6312-6352/com.example.justin.myapplication V/MyArrList﹕ [{CarImageLink=android.graphics.drawable.BitmapDrawable#41b5b7d8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b34d28}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41ba3d10}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b5eb98}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b3c7e8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b9c828}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bb96a0}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b54f48}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b86380}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b9c420}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bdedf8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b50150}]
08-04 09:12:46.914 6312-6352/com.example.justin.myapplication V/return0﹕ [{CarImageLink=android.graphics.drawable.BitmapDrawable#41b5b7d8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b34d28}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41ba3d10}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b5eb98}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b3c7e8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b9c828}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bb96a0}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b54f48}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b86380}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b9c420}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bdedf8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b50150}]
08-04 09:12:46.914 6312-6352/com.example.justin.myapplication V/getJSONObject(i)﹕ {"CarManufacturerImage":"bmw.png",....}
08-04 09:12:47.117 6312-6352/com.example.justin.myapplication V/Bitmap﹕ CarImageLink
08-04 09:12:47.117 6312-6352/com.example.justin.myapplication V/MyArrList﹕ [{CarImageLink=android.graphics.drawable.BitmapDrawable#41b5b7d8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b34d28}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41ba3d10}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b5eb98}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b3c7e8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b9c828}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bb96a0}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b54f48}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b86380}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b9c420}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bdedf8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b50150}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41baa090}]
08-04 11:02:37.255 22241-22279/com.example.justin.myapplication V/return0﹕ [{CarImageLink=android.graphics.drawable.BitmapDrawable#41b86600}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b34e38}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41ba3c28}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b59b68}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b0b0f8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b9bee0}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bb94a8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b54d10}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b37458}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b411b8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bdec58}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b4ff18}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bc37c8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bcfbd8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41c05140}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b19c30}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bf4ce0}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bcf7a0}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b4b120}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b2d638}]
08-04 11:34:59.794 4563-4563/com.example.justin.myapplication V/return3﹕ [{CarImageLink=android.graphics.drawable.BitmapDrawable#41ace870}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b35768}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41ba4298}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b72cd0}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b3d2e8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b842e8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bb99c0}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b642e8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41ad6a60}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b8b8c0}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bdf338}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b5f4f0}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bc3608}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41ba9308}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41be9138}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b4bcb0}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bab378}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bb0408}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b5a6f8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bec410}]
08-04 11:34:59.794 4563-4563/com.example.justin.myapplication V/value﹕ value
08-04 11:34:59.794 4563-4563/com.example.justin.myapplication V/value1﹕ value1
08-04 11:34:59.794 4563-4563/com.example.justin.myapplication V/log﹕ getcount
08-04 11:34:59.794 4563-4563/com.example.justin.myapplication V/log﹕ getcount
08-04 11:34:59.794 4563-4563/com.example.justin.myapplication V/return2﹕ com.example.justin.myapplication.JSONImageViewer$ImageAdapter#41afd290
08-04 11:34:59.794 4563-4563/com.example.justin.myapplication V/return2.1﹕ [{CarImageLink=android.graphics.drawable.BitmapDrawable#41ace870}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b35768}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41ba4298}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b72cd0}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b3d2e8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b842e8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bb99c0}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b642e8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41ad6a60}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b8b8c0}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bdf338}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b5f4f0}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bc3608}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41ba9308}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41be9138}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b4bcb0}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bab378}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bb0408}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41b5a6f8}, {CarImageLink=android.graphics.drawable.BitmapDrawable#41bec410}]
08-04 11:34:59.810 4563-4563/com.example.justin.myapplication V/log﹕ getcount
08-04 11:34:59.810 4563-4563/com.example.justin.myapplication V/v﹕ convertView inflating
08-04 11:34:59.810 4563-4563/com.example.justin.myapplication V/convertview﹕ android.widget.RelativeLayout{41baedb8 V.E..... ......I. 0,0-0,0}
08-04 11:34:59.810 4563-4563/com.example.justin.myapplication D/AndroidRuntime﹕ Shutting down VM
08-04 11:34:59.810 4563-4563/com.example.justin.myapplication W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41266930)
08-04 11:34:59.825 4563-4563/com.example.justin.myapplication E/AndroidRuntime﹕ FATAL EXCEPTION: main
java.lang.NullPointerException
at com.example.justin.myapplication.JSONImageViewer$ImageAdapter.getView(JSONImageViewer.java:238)
at android.widget.AbsListView.obtainView(AbsListView.java:2159)
at android.widget.GridView.onMeasure(GridView.java:1040)
at android.view.View.measure(View.java:15518)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:681)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
at android.view.View.measure(View.java:15518)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:681)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:461)
at android.view.View.measure(View.java:15518)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at android.view.View.measure(View.java:15518)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:847)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
at android.view.View.measure(View.java:15518)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2176)
at android.view.View.measure(View.java:15518)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1874)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1089)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1265)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
at android.view.Choreographer.doCallbacks(Choreographer.java:562)
at android.view.Choreographer.doFrame(Choreographer.java:532)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
08-04 11:34:59.856 4563-4567/com.example.justin.myapplication D/dalvikvm﹕ GC_CONCURRENT freed 650K, 8% free 9424K/10140K, paused 2ms+3ms, total 32ms
Activity_column.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<ImageView
android:id="#+id/ColPhoto"
android:layout_width="50dp"
android:layout_height="50dp"
/>
</RelativeLayout>
Any suggestions/insight as to why I cannot receive images through getView() yet can get values for getCount() are appreciated. Thank you.

In your onCreate() method change getApplicationContext() to this in the line where you're creating adapter and remove notifyDataSetChanged().
And remove MyArrList duplicate from doInBackground()
Try to change your task as follows:
class LoadContentFromServer extends AsyncTask<Object, Integer, Object> {
#Override
protected Object doInBackground(Object... params) {
String url = "http://..no looking..";
JSONObject data;
try {
data = new JSONObject(getJSONUrl(url));
Log.v("data", data.toString());
JSONArray dataArray = data.getJSONArray("car_images");
/*
* TotalRows = Show for total rows
* TotalPage = Show for total page
*/
int displayPerPage = 9; // Per Page
int TotalRows = data.length();
int indexRowStart = ((displayPerPage * currentPage) - displayPerPage);
if (TotalRows <= displayPerPage) {
TotalPage = 1;
} else if ((TotalRows % displayPerPage) == 0) {
TotalPage = (TotalRows / displayPerPage);
} else {
TotalPage = (TotalRows / displayPerPage) + 1;
TotalPage = (int) TotalPage;
}
int indexRowEnd = displayPerPage * currentPage;
if (indexRowEnd > TotalRows) {
indexRowEnd = TotalRows;
}
for (int i = 0; i < dataArray.length(); i++) {
//HashMap<String, Object> map = new HashMap<String, Object>();
JSONObject c = dataArray.getJSONObject(i);
Log.v("getJSONObject(i)", dataArray.getJSONObject(i).toString());
// Thumbnail Get ImageBitmap To Object
HashMap<String, Object> map = new HashMap<String, Object>();
Bitmap bitmap = loadBitmap(c.getString(TAG_IMG));
Drawable d = new BitmapDrawable(getResources(), bitmap);
map.put(TAG_IMG, d);
Log.v("Bitmap", TAG_IMG);
MyArrList.add(map);
Log.v("MyArrList", MyArrList.toString());
Log.v("return0", MyArrList.toString());
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
#Override
protected void onPostExecute(Object result) {
Log.v("return3", MyArrList.toString());
// Disabled Button Next
if(currentPage >= TotalPage) {
btnNext.setEnabled(false);
}
else {
btnNext.setEnabled(true);
}
// Disabled Button Previous
if(currentPage <= 1) {
btnPre.setEnabled(false);
}
else {
btnPre.setEnabled(true);
}
setProgressBarIndeterminateVisibility(false);
imageAdapter.addAll(MyArrList);
imageAdapter.notifyDataSetChanged();
Log.v("return2", imageAdapter.toString());
Log.v("return2.1", MyArrList.toString());
}
}
and adapter:
class ImageAdapter extends BaseAdapter {
private Context mContext;
private ArrayList<HashMap<String, Object>> array;
public ImageAdapter(Context context) {
mContext = context;
array = new ArrayList<>();
}
#Override
public int getCount() {
Log.v("log", "getcount");
return array.size();
}
public Object getItem(int position) {
return array.get(position);
}
public long getItemId(int position) {
return position;
}
public void addAll(ArrayList<HashMap<String, Object>> list) {
array.clear();
array.addAll(list);
}
#Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
//If convertView is null create a new view, else use convert view
if(convertView==null) {
Log.v("v", "convertView inflating");
convertView = ((LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate
(R.layout.activity_column, null);
}
Log.v("convertview", convertView.toString());
ImageView iv = (ImageView) convertView.findViewById(R.id.ColPhoto);
iv.setImageBitmap((Bitmap) array.get(position).get(TAG_IMG));
iv.setVisibility(ImageView.VISIBLE);
return v;
}
}

You need to call
protected String onPostExecute()
{
// change your data set here then call
imageAdapter.notifyDataSetChanged();
}
in onPostExecute() not in OnProgressUpdated() also you must call it when after you have modified the data set
EDIT
onProgressUpdate is normally for updating the ui (ie an progress bar). it will get called every time you call
protected String doInBackground()
{
// other code ommited
String progress = "test";
publishProgress(progress);
}
which you are not doing hence it will never update the data set.
try moving your code from the OnProgressUpdated to onPostExecute();

Related

AChartEngine - Charts with data from parse.com won't display

I would like to create applications forming charts based on data from parse.com. I have read some examples and tutorials but still have problem with displaying charts. Below is my code:
import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.util.Log;
import com.parse.GetCallback;
import com.parse.ParseException;
import com.parse.ParseObject;
import com.parse.ParseQuery;
import org.achartengine.ChartFactory;
import org.achartengine.GraphicalView;
import org.achartengine.chart.PointStyle;
import org.achartengine.model.XYMultipleSeriesDataset;
import org.achartengine.model.XYSeries;
import org.achartengine.renderer.XYMultipleSeriesRenderer;
import org.achartengine.renderer.XYSeriesRenderer;
import java.util.ArrayList;
public class LineGraph {
public ArrayList<Integer> dataArray;
XYMultipleSeriesDataset dataset;
XYMultipleSeriesRenderer renderer;
public static boolean ClickEnabled = true;
public Intent getIntent(Context context) {
ArrayList<Integer> y = this.dataArray;
XYSeries seriesY = new XYSeries("Y");
for (int i = 0; i < y.size(); i++) {
seriesY.add(i, y.get(i));
}
dataset = new XYMultipleSeriesDataset();
dataset.addSeries(seriesY);
renderer.setPanEnabled(true, false);
renderer.setClickEnabled(ClickEnabled);
renderer.setBackgroundColor(Color.WHITE);
renderer.setApplyBackgroundColor(true);
renderer.setChartTitle("Simple data");
renderer.setAxesColor(Color.BLACK);
XYMultipleSeriesRenderer mRenderer = new XYMultipleSeriesRenderer();
XYSeriesRenderer renderer = new XYSeriesRenderer();
renderer.setColor(Color.RED);
renderer.setPointStyle(PointStyle.DIAMOND);
mRenderer.addSeriesRenderer(renderer);
Intent intent = ChartFactory.getLineChartIntent(context, dataset, mRenderer, "Line Graph Title");
return intent;
}
public void getData() {
ParseQuery<ParseObject> query = ParseQuery.getQuery("Counters_data");
query.getInBackground("lxFzCTeOcl", new GetCallback<ParseObject>() {
public void done(ParseObject parseObject, ParseException e) {
if (e == null) {
String object = parseObject.getString("value");
Integer objectValue = Integer.parseInt(object);
if (dataArray == null) {
dataArray = new ArrayList<Integer>();
dataArray.add(objectValue);
}
} else {
Log.d("score", "Error: " + e.getMessage());
}
}
});
}
}
And there is how I invoke charts:
public void lineGraphHandler(View view) {
LineGraph line = new LineGraph();
line.getData();
Intent lineIntent = line.getIntent(this);
startActivity(lineIntent);
}
And XML part:
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="#id/counters"
android:onClick="lineGraphHandler"
android:text="Charts"
android:id="#+id/charts"/>
There is my logcat:
03-26 08:42:13.096 1229-1229/com.example.tst D/dalvikvm﹕ Late-enabling
CheckJNI 03-26 08:42:13.487 1229-1229/com.example.tst D/libEGL﹕ loaded
/system/lib/egl/libEGL_genymotion.so 03-26 08:42:13.491
1229-1229/com.example.tst D/﹕ HostConnection::get() New Host
Connection established 0xb94f4270, tid 1229 03-26 08:42:13.551
1229-1229/com.example.tst D/libEGL﹕ loaded
/system/lib/egl/libGLESv1_CM_genymotion.so 03-26 08:42:13.551
1229-1229/com.example.tst D/libEGL﹕ loaded
/system/lib/egl/libGLESv2_genymotion.so 03-26 08:42:14.035
1229-1229/com.example.tst W/EGL_genymotion﹕ eglSurfaceAttrib not
implemented 03-26 08:42:14.039 1229-1229/com.example.tst
E/OpenGLRenderer﹕ Getting MAX_TEXTURE_SIZE from GradienCache 03-26
08:42:14.043 1229-1229/com.example.tst E/OpenGLRenderer﹕
MAX_TEXTURE_SIZE: 4096 03-26 08:42:14.055 1229-1229/com.example.tst
E/OpenGLRenderer﹕ Getting MAX_TEXTURE_SIZE from
Caches::initConstraints() 03-26 08:42:14.063 1229-1229/com.example.tst
E/OpenGLRenderer﹕ MAX_TEXTURE_SIZE: 4096 03-26 08:42:14.063
1229-1229/com.example.tst D/OpenGLRenderer﹕ Enabling debug mode 0
03-26 08:42:50.327 1229-1229/com.example.tst D/dalvikvm﹕ GC_FOR_ALLOC
freed 200K, 8% free 2975K/3228K, paused 10ms, total 13ms 03-26
08:42:51.675 1229-1229/com.example.tst D/dalvikvm﹕ GC_FOR_ALLOC freed
431K, 14% free 3056K/3540K, paused 22ms, total 28ms 03-26 08:42:52.043
1229-1229/com.example.tst W/EGL_genymotion﹕ eglSurfaceAttrib not
implemented 03-26 08:42:53.543 1229-1229/com.example.tst
I/Choreographer﹕ Skipped 89 frames! The application may be doing too
much work on its main thread. 03-26 08:43:01.747
1229-1229/com.example.tst D/AndroidRuntime﹕ Shutting down VM 03-26
08:43:01.747 1229-1229/com.example.tst W/dalvikvm﹕ threadid=1: thread
exiting with uncaught exception (group=0xa4d8fb20) 03-26 08:43:01.767
1229-1229/com.example.tst E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.tst, PID: 1229 java.lang.IllegalStateException:
Could not execute method of the activity at
android.view.View$1.onClick(View.java:3823) at
android.view.View.performClick(View.java:4438) at
android.view.View$PerformClick.run(View.java:18422) at
android.os.Handler.handleCallback(Handler.java:733) at
android.os.Handler.dispatchMessage(Handler.java:95) at
android.os.Looper.loop(Looper.java:136) at
android.app.ActivityThread.main(ActivityThread.java:5017) at
java.lang.reflect.Method.invokeNative(Native Method) at
java.lang.reflect.Method.invoke(Method.java:515) at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) at
dalvik.system.NativeStart.main(Native Method) Caused by:
java.lang.reflect.InvocationTargetException at
java.lang.reflect.Method.invokeNative(Native Method) at
java.lang.reflect.Method.invoke(Method.java:515) at
android.view.View$1.onClick(View.java:3818) at
android.view.View.performClick(View.java:4438) at
android.view.View$PerformClick.run(View.java:18422) at
android.os.Handler.handleCallback(Handler.java:733) at
android.os.Handler.dispatchMessage(Handler.java:95) at
android.os.Looper.loop(Looper.java:136) at
android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method) at
java.lang.reflect.Method.invoke(Method.java:515) at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method) Caused by:
java.lang.NullPointerException at
com.example.tst.LineGraph.getIntent(LineGraph.java:36) at
com.example.tst.MainActivity.lineGraphHandler(MainActivity.java:44)
at java.lang.reflect.Method.invokeNative(Native Method) at
java.lang.reflect.Method.invoke(Method.java:515) at
android.view.View$1.onClick(View.java:3818) at
android.view.View.performClick(View.java:4438) at
android.view.View$PerformClick.run(View.java:18422) at
android.os.Handler.handleCallback(Handler.java:733) at
android.os.Handler.dispatchMessage(Handler.java:95) at
android.os.Looper.loop(Looper.java:136) at
android.app.ActivityThread.main(ActivityThread.java:5017)
at java.lang.reflect.Method.invokeNative(Native Method) at
java.lang.reflect.Method.invoke(Method.java:515) at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
at dalvik.system.NativeStart.main(Native Method) 03-26 08:43:04.507
1229-1229/com.example.tst I/Process﹕ Sending signal. PID: 1229 SIG: 9
I don't understand where the problem is. My app starts but crashes immediately when I push "chart" button. Is it data type of problem or because I misunderstand something?
Thank you in advance.
I tried like this but still got crash:
public void done(ParseObject parseObject, ParseException e) {
if (e == null) {
String object = parseObject.getString("value");
Integer objectValue = Integer.parseInt(object);
if (dataArray == null) {
dataArray = new ArrayList<Integer>();
dataArray.add(objectValue);
ArrayList<Integer> y = dataArray;
XYSeries seriesY = new XYSeries("Y");
for (int i = 0; i < y.size(); i++) {
seriesY.add(i, y.get(i));
dataset = new XYMultipleSeriesDataset();
dataset.addSeries(seriesY);
}
}
Your getData() retrieves the data asynchronously. dataArray won't be initialized immediately when you call getIntent().
Wait for the async operation to complete before using the data there. For example, call the code requiring that data from the done() callback.

Can not use a Runnable

I'm using a Runnable as a Timer that alternatively runs a block.
I got this code from here and changed it as such:
public class TikingTimer {
private long countDownInterval;
private boolean status;
public TikingTimer(long pCountDownInterval) {
this.countDownInterval = pCountDownInterval;
status = false;
Initialize();
}
public void Stop() {
status = false;
}
public void Start() {
status = true;
}
public void Initialize()
{
final Handler handler = new Handler();
final Runnable counter = new Runnable(){
public void run(){
if(status) {
//TODO my code
} else {
handler.postDelayed(this, countDownInterval);
}
}
};
handler.postDelayed(counter, countDownInterval);
}
}
... and at onCreate method I used :
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
TikingTimer tt = new TikingTimer(1000);
tt.Start();
}
But when I run the project, it force-closes.
Is it wrong to use Runnable at onCreate method?
Thanks.
The LogCat stack trace is:
08-11 13:04:55.384: E/AndroidRuntime(3125): FATAL EXCEPTION: main
08-11 13:04:55.384: E/AndroidRuntime(3125): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{kawthar.taghvimdigital/kawthar.taghvimdigital.MainActivity}: java.lang.NullPointerException
08-11 13:04:55.384: E/AndroidRuntime(3125): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2106)
08-11 13:04:55.384: E/AndroidRuntime(3125): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
08-11 13:04:55.384: E/AndroidRuntime(3125): at android.app.ActivityThread.access$600(ActivityThread.java:141)
08-11 13:04:55.384: E/AndroidRuntime(3125): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
08-11 13:04:55.384: E/AndroidRuntime(3125): at android.os.Handler.dispatchMessage(Handler.java:99)
08-11 13:04:55.384: E/AndroidRuntime(3125): at android.os.Looper.loop(Looper.java:137)
08-11 13:04:55.384: E/AndroidRuntime(3125): at android.app.ActivityThread.main(ActivityThread.java:5041)
08-11 13:04:55.384: E/AndroidRuntime(3125): at java.lang.reflect.Method.invokeNative(Native Method)
08-11 13:04:55.384: E/AndroidRuntime(3125): at java.lang.reflect.Method.invoke(Method.java:511)
08-11 13:04:55.384: E/AndroidRuntime(3125): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
08-11 13:04:55.384: E/AndroidRuntime(3125): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
08-11 13:04:55.384: E/AndroidRuntime(3125): at dalvik.system.NativeStart.main(Native Method)
08-11 13:04:55.384: E/AndroidRuntime(3125): Caused by: java.lang.NullPointerException
08-11 13:04:55.384: E/AndroidRuntime(3125): at android.app.Activity.findViewById(Activity.java:1839)
08-11 13:04:55.384: E/AndroidRuntime(3125): at kawthar.taghvimdigital.MainActivity.<init>(MainActivity.java:14)
08-11 13:04:55.384: E/AndroidRuntime(3125): at java.lang.Class.newInstanceImpl(Native Method)
08-11 13:04:55.384: E/AndroidRuntime(3125): at java.lang.Class.newInstance(Class.java:1319)
08-11 13:04:55.384: E/AndroidRuntime(3125): at android.app.Instrumentation.newActivity(Instrumentation.java:1054)
08-11 13:04:55.384: E/AndroidRuntime(3125): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2097)
08-11 13:04:55.384: E/AndroidRuntime(3125): ... 11 more
In your MainActivity (not posted), at line 14, you are looking up a View through method:
findViewById(Activity.java:1839)
... which is not found.
Since you manipulate this view somehow, the NullPointerException you posted is thrown.
You are trying to access a view that is not defined in your xml layout of the main activity.
Check the Line 14 on your MainActivity
This issue is not due to Runnable.

NullPointerException but don't understand why

I have a DialogFragment which is supposed to display a VideoView and some TextViews. However, VideoView is null, along with other controls, even though the layout has been inflated.
Here is the code where I retrieve the pointer to various controls:
#Override
public void onViewCreated (View view, Bundle savedInstanceState) {
controls = new MediaController(getActivity());
title = (TextView) view.findViewById(R.id.title);
date = (TextView) view.findViewById(R.id.date);
description = (TextView) view.findViewById(R.id.description);
video = (VideoView) view.findViewById(R.id.video);
controls.setAnchorView(video);
video.setMediaController(controls);
}
But, debugger says otherwise:
Why are they null?
I have inflated the layout in create view where they are defined.
StackTrace:
08-04 06:19:07.804: E/AndroidRuntime(1758): FATAL EXCEPTION: main
08-04 06:19:07.804: E/AndroidRuntime(1758): java.lang.NullPointerException
08-04 06:19:07.804: E/AndroidRuntime(1758): at com.example.tqafragments.VideoDialog.showNewVideo(VideoDialog.java:61)
08-04 06:19:07.804: E/AndroidRuntime(1758): at com.example.tqafragments.MainActivity.feedItemSelected(MainActivity.java:36)
08-04 06:19:07.804: E/AndroidRuntime(1758): at com.example.tqafragments.FeedFragment$2.onItemClick(FeedFragment.java:73)
08-04 06:19:07.804: E/AndroidRuntime(1758): at android.widget.AdapterView.performItemClick(AdapterView.java:298)
08-04 06:19:07.804: E/AndroidRuntime(1758): at android.widget.AbsListView.performItemClick(AbsListView.java:1100)
08-04 06:19:07.804: E/AndroidRuntime(1758): at android.widget.AbsListView$PerformClick.run(AbsListView.java:2749)
08-04 06:19:07.804: E/AndroidRuntime(1758): at android.widget.AbsListView$1.run(AbsListView.java:3423)
08-04 06:19:07.804: E/AndroidRuntime(1758): at android.os.Handler.handleCallback(Handler.java:725)
08-04 06:19:07.804: E/AndroidRuntime(1758): at android.os.Handler.dispatchMessage(Handler.java:92)
08-04 06:19:07.804: E/AndroidRuntime(1758): at android.os.Looper.loop(Looper.java:137)
08-04 06:19:07.804: E/AndroidRuntime(1758): at android.app.ActivityThread.main(ActivityThread.java:5041)
08-04 06:19:07.804: E/AndroidRuntime(1758): at java.lang.reflect.Method.invokeNative(Native Method)
08-04 06:19:07.804: E/AndroidRuntime(1758): at java.lang.reflect.Method.invoke(Method.java:511)
08-04 06:19:07.804: E/AndroidRuntime(1758): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
08-04 06:19:07.804: E/AndroidRuntime(1758): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
08-04 06:19:07.804: E/AndroidRuntime(1758): at dalvik.system.NativeStart.main(Native Method)
ShowNewVideo:
public void showNewVideo(Feed f){
title.setText(f.getTitle());
date.setText(f.getDate());
description.setText(Html.fromHtml(f.getDescription()));
video.setVideoURI(Uri.parse(f.getVideoURL())); // Line 61
video.start();
}
you need to some change
put your code
title = (TextView) view.findViewById(R.id.title);
date = (TextView) view.findViewById(R.id.date);
description = (TextView) view.findViewById(R.id.description);
video = (VideoView) view.findViewById(R.id.video);
from onViewCreated() to onCreateView() then bind data on onViewCreated() method.

App is force closing when i run it? Unable to start activity

When i run my app, and i press on a button it force closes. I fixed my Android manifest and i cannot find the problem. Here is the Logcat:
03-07 23:48:53.035: D/dalvikvm(5457): GC_EXTERNAL_ALLOC freed 43K, 49% free 2797K/5379K, external 1596K/2108K, paused 99ms
03-07 23:48:53.132: D/dalvikvm(5457): GC_EXTERNAL_ALLOC freed 1K, 49% free 2796K/5379K, external 3471K/4335K, paused 35ms
03-07 23:48:53.691: D/dalvikvm(5457): GC_EXTERNAL_ALLOC freed <1K, 48% free 2798K/5379K, external 5048K/5580K, paused 53ms
03-07 23:48:54.281: D/dalvikvm(5457): GC_EXTERNAL_ALLOC freed <1K, 48% free 2799K/5379K, external 8143K/8403K, paused 48ms
03-07 23:48:55.996: D/AndroidRuntime(5457): Shutting down VM
03-07 23:48:55.996: W/dalvikvm(5457): threadid=1: thread exiting with uncaught exception (group=0x40015578)
03-07 23:48:56.039: E/AndroidRuntime(5457): FATAL EXCEPTION: main
03-07 23:48:56.039: E/AndroidRuntime(5457): android.content.ActivityNotFoundException: Unable to find explicit activity class {izzy.n/izzy.n.main1}; have you declared this activity in your AndroidManifest.xml?
03-07 23:48:56.039: E/AndroidRuntime(5457): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1405)
03-07 23:48:56.039: E/AndroidRuntime(5457): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
03-07 23:48:56.039: E/AndroidRuntime(5457): at android.app.Activity.startActivityForResult(Activity.java:2827)
03-07 23:48:56.039: E/AndroidRuntime(5457): at android.app.Activity.startActivity(Activity.java:2933)
03-07 23:48:56.039: E/AndroidRuntime(5457): at izzy.n.IzzynActivity$2.onClick(IzzynActivity.java:31)
03-07 23:48:56.039: E/AndroidRuntime(5457): at android.view.View.performClick(View.java:2538)
03-07 23:48:56.039: E/AndroidRuntime(5457): at android.view.View$PerformClick.run(View.java:9152)
03-07 23:48:56.039: E/AndroidRuntime(5457): at android.os.Handler.handleCallback(Handler.java:587)
03-07 23:48:56.039: E/AndroidRuntime(5457): at android.os.Handler.dispatchMessage(Handler.java:92)
03-07 23:48:56.039: E/AndroidRuntime(5457): at android.os.Looper.loop(Looper.java:130)
03-07 23:48:56.039: E/AndroidRuntime(5457): at android.app.ActivityThread.main(ActivityThread.java:3687)
03-07 23:48:56.039: E/AndroidRuntime(5457): at java.lang.reflect.Method.invokeNative(Native Method)
03-07 23:48:56.039: E/AndroidRuntime(5457): at java.lang.reflect.Method.invoke(Method.java:507)
03-07 23:48:56.039: E/AndroidRuntime(5457): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
03-07 23:48:56.039: E/AndroidRuntime(5457): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
03-07 23:48:56.039: E/AndroidRuntime(5457): at dalvik.system.NativeStart.main(Native Method)
03-07 23:50:31.398: D/dalvikvm(5553): GC_EXTERNAL_ALLOC freed 47K, 49% free 2797K/5379K, external 1596K/2108K, paused 21ms
03-07 23:50:31.457: D/dalvikvm(5553): GC_EXTERNAL_ALLOC freed 1K, 49% free 2796K/5379K, external 3471K/4335K, paused 22ms
03-07 23:50:31.660: D/dalvikvm(5553): GC_EXTERNAL_ALLOC freed <1K, 48% free 2798K/5379K, external 5048K/5580K, paused 25ms
03-07 23:50:31.753: D/dalvikvm(5553): GC_EXTERNAL_ALLOC freed <1K, 48% free 2799K/5379K, external 8143K/8403K, paused 20ms
03-07 23:50:41.910: D/AndroidRuntime(5553): Shutting down VM
03-07 23:50:41.910: W/dalvikvm(5553): threadid=1: thread exiting with uncaught exception (group=0x40015578)
03-07 23:50:41.933: E/AndroidRuntime(5553): FATAL EXCEPTION: main
03-07 23:50:41.933: E/AndroidRuntime(5553): android.content.ActivityNotFoundException: Unable to find explicit activity class {izzy.n/izzy.n.main1}; have you declared this activity in your AndroidManifest.xml?
03-07 23:50:41.933: E/AndroidRuntime(5553): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1405)
03-07 23:50:41.933: E/AndroidRuntime(5553): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
03-07 23:50:41.933: E/AndroidRuntime(5553): at android.app.Activity.startActivityForResult(Activity.java:2827)
03-07 23:50:41.933: E/AndroidRuntime(5553): at android.app.Activity.startActivity(Activity.java:2933)
03-07 23:50:41.933: E/AndroidRuntime(5553): at izzy.n.IzzynActivity$2.onClick(IzzynActivity.java:31)
03-07 23:50:41.933: E/AndroidRuntime(5553): at android.view.View.performClick(View.java:2538)
03-07 23:50:41.933: E/AndroidRuntime(5553): at android.view.View$PerformClick.run(View.java:9152)
03-07 23:50:41.933: E/AndroidRuntime(5553): at android.os.Handler.handleCallback(Handler.java:587)
03-07 23:50:41.933: E/AndroidRuntime(5553): at android.os.Handler.dispatchMessage(Handler.java:92)
03-07 23:50:41.933: E/AndroidRuntime(5553): at android.os.Looper.loop(Looper.java:130)
03-07 23:50:41.933: E/AndroidRuntime(5553): at android.app.ActivityThread.main(ActivityThread.java:3687)
03-07 23:50:41.933: E/AndroidRuntime(5553): at java.lang.reflect.Method.invokeNative(Native Method)
03-07 23:50:41.933: E/AndroidRuntime(5553): at java.lang.reflect.Method.invoke(Method.java:507)
03-07 23:50:41.933: E/AndroidRuntime(5553): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
03-07 23:50:41.933: E/AndroidRuntime(5553): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
03-07 23:50:41.933: E/AndroidRuntime(5553): at dalvik.system.NativeStart.main(Native Method)
03-07 23:51:20.371: D/dalvikvm(5609): GC_EXTERNAL_ALLOC freed 48K, 49% free 2797K/5379K, external 1596K/2108K, paused 97ms
03-07 23:51:20.503: D/dalvikvm(5609): GC_EXTERNAL_ALLOC freed 1K, 49% free 2796K/5379K, external 3471K/4335K, paused 57ms
03-07 23:51:20.792: D/dalvikvm(5609): GC_EXTERNAL_ALLOC freed <1K, 48% free 2798K/5379K, external 5048K/5580K, paused 24ms
03-07 23:51:21.039: D/dalvikvm(5609): GC_EXTERNAL_ALLOC freed <1K, 48% free 2799K/5379K, external 8143K/8403K, paused 65ms
03-07 23:51:26.679: D/AndroidRuntime(5609): Shutting down VM
03-07 23:51:26.679: W/dalvikvm(5609): threadid=1: thread exiting with uncaught exception (group=0x40015578)
03-07 23:51:26.714: E/AndroidRuntime(5609): FATAL EXCEPTION: main
03-07 23:51:26.714: E/AndroidRuntime(5609): android.content.ActivityNotFoundException: Unable to find explicit activity class {izzy.n/izzy.n.main1}; have you declared this activity in your AndroidManifest.xml?
03-07 23:51:26.714: E/AndroidRuntime(5609): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1405)
03-07 23:51:26.714: E/AndroidRuntime(5609): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
03-07 23:51:26.714: E/AndroidRuntime(5609): at android.app.Activity.startActivityForResult(Activity.java:2827)
03-07 23:51:26.714: E/AndroidRuntime(5609): at android.app.Activity.startActivity(Activity.java:2933)
03-07 23:51:26.714: E/AndroidRuntime(5609): at izzy.n.IzzynActivity$2.onClick(IzzynActivity.java:31)
03-07 23:51:26.714: E/AndroidRuntime(5609): at android.view.View.performClick(View.java:2538)
03-07 23:51:26.714: E/AndroidRuntime(5609): at android.view.View$PerformClick.run(View.java:9152)
03-07 23:51:26.714: E/AndroidRuntime(5609): at android.os.Handler.handleCallback(Handler.java:587)
03-07 23:51:26.714: E/AndroidRuntime(5609): at android.os.Handler.dispatchMessage(Handler.java:92)
03-07 23:51:26.714: E/AndroidRuntime(5609): at android.os.Looper.loop(Looper.java:130)
03-07 23:51:26.714: E/AndroidRuntime(5609): at android.app.ActivityThread.main(ActivityThread.java:3687)
03-07 23:51:26.714: E/AndroidRuntime(5609): at java.lang.reflect.Method.invokeNative(Native Method)
03-07 23:51:26.714: E/AndroidRuntime(5609): at java.lang.reflect.Method.invoke(Method.java:507)
03-07 23:51:26.714: E/AndroidRuntime(5609): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
03-07 23:51:26.714: E/AndroidRuntime(5609): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
03-07 23:51:26.714: E/AndroidRuntime(5609): at dalvik.system.NativeStart.main(Native Method)
03-07 23:59:24.920: D/dalvikvm(5784): GC_EXTERNAL_ALLOC freed 51K, 49% free 2797K/5379K, external 1596K/2108K, paused 54ms
03-07 23:59:25.104: D/dalvikvm(5784): GC_EXTERNAL_ALLOC freed 1K, 49% free 2796K/5379K, external 3471K/4335K, paused 46ms
03-07 23:59:25.537: D/dalvikvm(5784): GC_EXTERNAL_ALLOC freed <1K, 48% free 2798K/5379K, external 5048K/5580K, paused 24ms
03-07 23:59:25.846: D/dalvikvm(5784): GC_EXTERNAL_ALLOC freed <1K, 48% free 2799K/5379K, external 8143K/8403K, paused 38ms
03-07 23:59:41.502: D/dalvikvm(5784): GC_EXTERNAL_ALLOC freed 10K, 48% free 2828K/5379K, external 11785K/11958K, paused 25ms
03-07 23:59:41.740: D/dalvikvm(5784): GC_EXTERNAL_ALLOC freed <1K, 48% free 2829K/5379K, external 13363K/14068K, paused 25ms
03-07 23:59:41.865: D/dalvikvm(5784): GC_EXTERNAL_ALLOC freed <1K, 48% free 2830K/5379K, external 16457K/17091K, paused 20ms
03-07 23:59:42.607: D/AndroidRuntime(5784): Shutting down VM
03-07 23:59:42.607: W/dalvikvm(5784): threadid=1: thread exiting with uncaught exception (group=0x40015578)
03-07 23:59:42.783: E/AndroidRuntime(5784): FATAL EXCEPTION: main
03-07 23:59:42.783: E/AndroidRuntime(5784): java.lang.RuntimeException: Unable to start activity ComponentInfo{izzy.n/izzy.n.main1}: java.lang.NullPointerException
03-07 23:59:42.783: E/AndroidRuntime(5784): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
03-07 23:59:42.783: E/AndroidRuntime(5784): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
03-07 23:59:42.783: E/AndroidRuntime(5784): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
03-07 23:59:42.783: E/AndroidRuntime(5784): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
03-07 23:59:42.783: E/AndroidRuntime(5784): at android.os.Handler.dispatchMessage(Handler.java:99)
03-07 23:59:42.783: E/AndroidRuntime(5784): at android.os.Looper.loop(Looper.java:130)
03-07 23:59:42.783: E/AndroidRuntime(5784): at android.app.ActivityThread.main(ActivityThread.java:3687)
03-07 23:59:42.783: E/AndroidRuntime(5784): at java.lang.reflect.Method.invokeNative(Native Method)
03-07 23:59:42.783: E/AndroidRuntime(5784): at java.lang.reflect.Method.invoke(Method.java:507)
03-07 23:59:42.783: E/AndroidRuntime(5784): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
03-07 23:59:42.783: E/AndroidRuntime(5784): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
03-07 23:59:42.783: E/AndroidRuntime(5784): at dalvik.system.NativeStart.main(Native Method)
03-07 23:59:42.783: E/AndroidRuntime(5784): Caused by: java.lang.NullPointerException
03-07 23:59:42.783: E/AndroidRuntime(5784): at izzy.n.main1.populateCalendarSpinner(main1.java:62)
03-07 23:59:42.783: E/AndroidRuntime(5784): at izzy.n.main1.onCreate(main1.java:52)
03-07 23:59:42.783: E/AndroidRuntime(5784): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-07 23:59:42.783: E/AndroidRuntime(5784): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
03-07 23:59:42.783: E/AndroidRuntime(5784): ... 11 more
03-07 23:59:52.850: I/Process(5784): Sending signal. PID: 5784 SIG: 9
03-08 00:11:06.982: D/dalvikvm(6029): GC_EXTERNAL_ALLOC freed 46K, 49% free 2797K/5379K, external 1596K/2108K, paused 29ms
03-08 00:11:07.033: D/dalvikvm(6029): GC_EXTERNAL_ALLOC freed 1K, 49% free 2796K/5379K, external 3471K/4335K, paused 20ms
03-08 00:11:07.248: D/dalvikvm(6029): GC_EXTERNAL_ALLOC freed <1K, 48% free 2798K/5379K, external 5048K/5580K, paused 21ms
03-08 00:11:07.350: D/dalvikvm(6029): GC_EXTERNAL_ALLOC freed <1K, 48% free 2799K/5379K, external 8143K/8403K, paused 19ms
03-08 00:11:10.588: D/dalvikvm(6029): GC_EXTERNAL_ALLOC freed 9K, 48% free 2828K/5379K, external 11785K/11958K, paused 100ms
03-08 00:11:11.068: D/dalvikvm(6029): GC_EXTERNAL_ALLOC freed 1K, 48% free 2829K/5379K, external 13363K/14068K, paused 49ms
03-08 00:11:11.365: D/dalvikvm(6029): GC_EXTERNAL_ALLOC freed <1K, 48% free 2830K/5379K, external 16457K/17091K, paused 47ms
03-08 00:11:11.736: D/AndroidRuntime(6029): Shutting down VM
03-08 00:11:11.736: W/dalvikvm(6029): threadid=1: thread exiting with uncaught exception (group=0x40015578)
03-08 00:11:11.752: E/AndroidRuntime(6029): FATAL EXCEPTION: main
03-08 00:11:11.752: E/AndroidRuntime(6029): java.lang.RuntimeException: Unable to start activity ComponentInfo{izzy.n/izzy.n.main1}: java.lang.NullPointerException
03-08 00:11:11.752: E/AndroidRuntime(6029): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
03-08 00:11:11.752: E/AndroidRuntime(6029): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
03-08 00:11:11.752: E/AndroidRuntime(6029): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
03-08 00:11:11.752: E/AndroidRuntime(6029): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
03-08 00:11:11.752: E/AndroidRuntime(6029): at android.os.Handler.dispatchMessage(Handler.java:99)
03-08 00:11:11.752: E/AndroidRuntime(6029): at android.os.Looper.loop(Looper.java:130)
03-08 00:11:11.752: E/AndroidRuntime(6029): at android.app.ActivityThread.main(ActivityThread.java:3687)
03-08 00:11:11.752: E/AndroidRuntime(6029): at java.lang.reflect.Method.invokeNative(Native Method)
03-08 00:11:11.752: E/AndroidRuntime(6029): at java.lang.reflect.Method.invoke(Method.java:507)
03-08 00:11:11.752: E/AndroidRuntime(6029): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
03-08 00:11:11.752: E/AndroidRuntime(6029): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
03-08 00:11:11.752: E/AndroidRuntime(6029): at dalvik.system.NativeStart.main(Native Method)
03-08 00:11:11.752: E/AndroidRuntime(6029): Caused by: java.lang.NullPointerException
03-08 00:11:11.752: E/AndroidRuntime(6029): at izzy.n.main1.populateCalendarSpinner(main1.java:62)
03-08 00:11:11.752: E/AndroidRuntime(6029): at izzy.n.main1.onCreate(main1.java:52)
03-08 00:11:11.752: E/AndroidRuntime(6029): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-08 00:11:11.752: E/AndroidRuntime(6029): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
03-08 00:11:11.752: E/AndroidRuntime(6029): ... 11 more
03-08 00:16:11.924: I/Process(6029): Sending signal. PID: 6029 SIG: 9
03-08 00:16:14.525: D/dalvikvm(6173): GC_EXTERNAL_ALLOC freed 10K, 48% free 2828K/5379K, external 11785K/11958K, paused 20ms
03-08 00:16:14.678: D/dalvikvm(6173): GC_EXTERNAL_ALLOC freed 1K, 48% free 2829K/5379K, external 13363K/14068K, paused 22ms
03-08 00:16:14.779: D/dalvikvm(6173): GC_EXTERNAL_ALLOC freed <1K, 48% free 2829K/5379K, external 16457K/17091K, paused 21ms
03-08 00:16:15.037: D/AndroidRuntime(6173): Shutting down VM
03-08 00:16:15.037: W/dalvikvm(6173): threadid=1: thread exiting with uncaught exception (group=0x40015578)
03-08 00:16:15.037: E/AndroidRuntime(6173): FATAL EXCEPTION: main
03-08 00:16:15.037: E/AndroidRuntime(6173): java.lang.RuntimeException: Unable to start activity ComponentInfo{izzy.n/izzy.n.main1}: java.lang.NullPointerException
03-08 00:16:15.037: E/AndroidRuntime(6173): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
03-08 00:16:15.037: E/AndroidRuntime(6173): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
03-08 00:16:15.037: E/AndroidRuntime(6173): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
03-08 00:16:15.037: E/AndroidRuntime(6173): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
03-08 00:16:15.037: E/AndroidRuntime(6173): at android.os.Handler.dispatchMessage(Handler.java:99)
03-08 00:16:15.037: E/AndroidRuntime(6173): at android.os.Looper.loop(Looper.java:130)
03-08 00:16:15.037: E/AndroidRuntime(6173): at android.app.ActivityThread.main(ActivityThread.java:3687)
03-08 00:16:15.037: E/AndroidRuntime(6173): at java.lang.reflect.Method.invokeNative(Native Method)
03-08 00:16:15.037: E/AndroidRuntime(6173): at java.lang.reflect.Method.invoke(Method.java:507)
03-08 00:16:15.037: E/AndroidRuntime(6173): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842)
03-08 00:16:15.037: E/AndroidRuntime(6173): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600)
03-08 00:16:15.037: E/AndroidRuntime(6173): at dalvik.system.NativeStart.main(Native Method)
03-08 00:16:15.037: E/AndroidRuntime(6173): Caused by: java.lang.NullPointerException
03-08 00:16:15.037: E/AndroidRuntime(6173): at izzy.n.main1.populateCalendarSpinner(main1.java:62)
03-08 00:16:15.037: E/AndroidRuntime(6173): at izzy.n.main1.onCreate(main1.java:52)
03-08 00:16:15.037: E/AndroidRuntime(6173): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
03-08 00:16:15.037: E/AndroidRuntime(6173): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
03-08 00:16:15.037: E/AndroidRuntime(6173): ... 11 more
Here is the code for Android Manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="izzy.n"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="10" />
<uses-permission android:name="android.permission.READ_CALENDAR"></uses-permission>
<uses-permission android:name="android.permission.WRITE_CALENDAR"></uses-permission>
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name="izzy.n.IzzynActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="izzy.n.notes"
android:label="#string/notes"></activity>
<activity
android:name="izzy.n.calculator"
android:label="#string/calculator"></activity>
<activity android:name="izzy.n.main1"
android:label="#string/app_name"></activity>
</application>
</manifest>
and finally here is the main1.java:
class MyCalendar {
public String name;
public String id;
public MyCalendar(String _name, String _id) {
name = _name;
id = _id;
}
#Override
public String toString() {
return name;
}
}
public class main1 extends Activity {
/*********************************************************************
* UI part*/
private Spinner m_spinner_calender;
private Button m_button_add;
private Button m_button_add2;
private Button m_button_getEvents;
private TextView m_text_event;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
/*get calendar list and populate the view*/
getCalendars();
populateCalendarSpinner();
populateAddBtn();
populateAddBtn2();
populateTextEvent();
populateGetEventsBtn();
}
private void populateCalendarSpinner() {
m_spinner_calender = (Spinner)this.findViewById(R.id.spinner_calendar);
ArrayAdapter l_arrayAdapter = new ArrayAdapter(this.getApplicationContext(), android.R.layout.simple_spinner_item, m_calendars);
l_arrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
m_spinner_calender.setAdapter(l_arrayAdapter);
m_spinner_calender.setSelection(0);
m_spinner_calender.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
#Override
public void onItemSelected(AdapterView<?> p_parent, View p_view,
int p_pos, long p_id) {
m_selectedCalendarId = m_calendars[(int)p_id].id;
}
#Override
public void onNothingSelected(AdapterView<?> arg0) {}
});
}
private void populateAddBtn() {
m_button_add = (Button) this.findViewById(R.id.button_add);
m_button_add.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
addEvent();
}
});
}
private void populateAddBtn2() {
m_button_add2 = (Button) this.findViewById(R.id.button_add2);
m_button_add2.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
addEvent2();
}
});
}
private void populateGetEventsBtn() {
m_button_getEvents = (Button) findViewById(R.id.button_get_events);
m_button_getEvents.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
getLastThreeEvents();
}
});
}
private void populateTextEvent() {
m_text_event = (TextView) findViewById(R.id.text_event);
String l_str = "title: roman10 calendar tutorial test\n" +
"description: This is a simple test for calendar api\n" +
"eventLocation: #home\n" +
"start time:" + getDateTimeStr(0) + "\n" +
"end time: " + getDateTimeStr(30) + "\n" +
"event status: confirmed\n" +
"all day: no\n" +
"has alarm: yes\n";
m_text_event.setText(l_str);
}
/****************************************************************
* Data part
*/
/*retrieve a list of available calendars*/
private MyCalendar m_calendars[];
private String m_selectedCalendarId = "0";
private void getCalendars() {
String[] l_projection = new String[]{"_id", "displayName"};
Uri l_calendars;
if (Build.VERSION.SDK_INT >= 8) {
l_calendars = Uri.parse("content://com.android.calendar/calendars");
} else {
l_calendars = Uri.parse("content://calendar/calendars");
}
Cursor l_managedCursor = this.managedQuery(l_calendars, l_projection, null, null, null); //all calendars
//Cursor l_managedCursor = this.managedQuery(l_calendars, l_projection, "selected=1", null, null); //active calendars
if (l_managedCursor.moveToFirst()) {
m_calendars = new MyCalendar[l_managedCursor.getCount()];
String l_calName;
String l_calId;
int l_cnt = 0;
int l_nameCol = l_managedCursor.getColumnIndex(l_projection[1]);
int l_idCol = l_managedCursor.getColumnIndex(l_projection[0]);
do {
l_calName = l_managedCursor.getString(l_nameCol);
l_calId = l_managedCursor.getString(l_idCol);
m_calendars[l_cnt] = new MyCalendar(l_calName, l_calId);
++l_cnt;
} while (l_managedCursor.moveToNext());
}
}
/*add an event to calendar*/
private void addEvent() {
ContentValues l_event = new ContentValues();
l_event.put("calendar_id", m_selectedCalendarId);
l_event.put("title", "roman10 calendar tutorial test");
l_event.put("description", "This is a simple test for calendar api");
l_event.put("eventLocation", "#home");
l_event.put("dtstart", System.currentTimeMillis());
l_event.put("dtend", System.currentTimeMillis() + 1800*1000);
l_event.put("allDay", 0);
//status: 0~ tentative; 1~ confirmed; 2~ canceled
l_event.put("eventStatus", 1);
//0~ default; 1~ confidential; 2~ private; 3~ public
l_event.put("visibility", 0);
//0~ opaque, no timing conflict is allowed; 1~ transparency, allow overlap of scheduling
l_event.put("transparency", 0);
//0~ false; 1~ true
l_event.put("hasAlarm", 1);
Uri l_eventUri;
if (Build.VERSION.SDK_INT >= 8) {
l_eventUri = Uri.parse("content://com.android.calendar/events");
} else {
l_eventUri = Uri.parse("content://calendar/events");
}
Uri l_uri = this.getContentResolver().insert(l_eventUri, l_event);
Log.v("++++++test", l_uri.toString());
}
/*add an event through intent, this doesn't require any permission
* just send intent to android calendar
* http://www.openintents.org/en/uris*/
private void addEvent2() {
Intent l_intent = new Intent(Intent.ACTION_EDIT);
l_intent.setType("vnd.android.cursor.item/event");
//l_intent.putExtra("calendar_id", m_selectedCalendarId); //this doesn't work
l_intent.putExtra("title", "roman10 calendar tutorial test");
l_intent.putExtra("description", "This is a simple test for calendar api");
l_intent.putExtra("eventLocation", "#home");
l_intent.putExtra("beginTime", System.currentTimeMillis());
l_intent.putExtra("endTime", System.currentTimeMillis() + 1800*1000);
l_intent.putExtra("allDay", 0);
//status: 0~ tentative; 1~ confirmed; 2~ canceled
l_intent.putExtra("eventStatus", 1);
//0~ default; 1~ confidential; 2~ private; 3~ public
l_intent.putExtra("visibility", 0);
//0~ opaque, no timing conflict is allowed; 1~ transparency, allow overlap of scheduling
l_intent.putExtra("transparency", 0);
//0~ false; 1~ true
l_intent.putExtra("hasAlarm", 1);
try {
startActivity(l_intent);
} catch (Exception e) {
Toast.makeText(this.getApplicationContext(), "Sorry, no compatible calendar is found!", Toast.LENGTH_LONG).show();
}
}
/*get a list of events
* http://jimblackler.net/blog/?p=151*/
private void getLastThreeEvents() {
Uri l_eventUri;
if (Build.VERSION.SDK_INT >= 8) {
l_eventUri = Uri.parse("content://com.android.calendar/events");
} else {
l_eventUri = Uri.parse("content://calendar/events");
}
String[] l_projection = new String[]{"title", "dtstart", "dtend"};
Cursor l_managedCursor = this.managedQuery(l_eventUri, l_projection, "calendar_id=" + m_selectedCalendarId, null, "dtstart DESC, dtend DESC");
//Cursor l_managedCursor = this.managedQuery(l_eventUri, l_projection, null, null, null);
if (l_managedCursor.moveToFirst()) {
int l_cnt = 0;
String l_title;
String l_begin;
String l_end;
StringBuilder l_displayText = new StringBuilder();
int l_colTitle = l_managedCursor.getColumnIndex(l_projection[0]);
int l_colBegin = l_managedCursor.getColumnIndex(l_projection[1]);
int l_colEnd = l_managedCursor.getColumnIndex(l_projection[1]);
do {
l_title = l_managedCursor.getString(l_colTitle);
l_begin = getDateTimeStr(l_managedCursor.getString(l_colBegin));
l_end = getDateTimeStr(l_managedCursor.getString(l_colEnd));
l_displayText.append(l_title + "\n" + l_begin + "\n" + l_end + "\n----------------\n");
++l_cnt;
} while (l_managedCursor.moveToNext() && l_cnt < 3);
m_text_event.setText(l_displayText.toString());
}
}
/************************************************
* utility part
*/
private static final String DATE_TIME_FORMAT = "yyyy MMM dd, HH:mm:ss";
public static String getDateTimeStr(int p_delay_min) {
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat(DATE_TIME_FORMAT);
if (p_delay_min == 0) {
return sdf.format(cal.getTime());
} else {
Date l_time = cal.getTime();
l_time.setMinutes(l_time.getMinutes() + p_delay_min);
return sdf.format(l_time);
}
}
public static String getDateTimeStr(String p_time_in_millis) {
SimpleDateFormat sdf = new SimpleDateFormat(DATE_TIME_FORMAT);
Date l_time = new Date(Long.parseLong(p_time_in_millis));
return sdf.format(l_time);
}
}
Fix this:
03-07 23:50:41.933: E/AndroidRuntime(5553): android.content.ActivityNotFoundException: Unable to find explicit activity class {izzy.n/izzy.n.main1}; have you declared this activity in your AndroidManifest.xml?
ALSO
Point out which line its complaining about.
A Object in the populateCalendarSpinner() method is null . Please put try catch and debug.
Your log show
03-08 00:16:15.037: E/AndroidRuntime(6173): Caused by: java.lang.NullPointerException
03-08 00:16:15.037: E/AndroidRuntime(6173): at izzy.n.main1.populateCalendarSpinner(main1.java:62)
03-08 00:16:15.037: E/AndroidRuntime(6173): at izzy.n.main1.onCreate(main1.java:52)
Activity not found is the old log. You already fixed it.
if you're sure you declared it, make sure to clean your project. Sometimes Eclipse doesn't realize your XML has changed and is acting on older versions.
<activity android:name="main1"
android:label="#string/app_name"></activity>
should be
<activity android:name="izzy.n.main1"
android:label="#string/app_name"></activity>
<activity android:name="main1"
android:label="#string/app_name"></activity>
Try with changing this to
<activity android:name="izzy.n.main1"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Your log also says NullPointerException in populateCalendarSpinner(); debug and fix that too.
Just do this to debug:
try {
populateCalendarSpinner();
}
catch(NullPointerException e) {
e.printStackTrace();
}

How to remove error when declaring an array of a class in Android

Basically, I'm making a reversi app for Android, and I am currently at the point of setting up the game board. The way I am intending to do this is to create a 2D array of the position class. Each position is represented by an imageview that is used as a button which represents a board position. Here is a snippet of the code that contains the error:
setupBoard(board);
....
public void setupBoard(Position board[][]) {
for (int y = 0; y < 8; y++) {
for (int x = 0; x < 8; x++) {
Log.d("Error","Error a");
board[x][y] = new Position(getApplicationContext());
Log.d("Error","Error b");
board[x][y].isPositionEmpty = true;
}
}
}
In the position class:
public class Position {
Context myContext;
public Position(Context context) {
Log.d("Error","Error c");
myContext = context;
// TODO Auto-generated constructor stub
}
public boolean isPositionEmpty = true;
public int positionID;
public ImageView button = new ImageView(myContext);
}
The program gets to error a, but no further. The error in LogCat is:
java.lang.NullPointerException
Any help will be much appreciated. Thanks in advance!
Exception:
02-20 16:52:20.820: ERROR/AndroidRuntime(365): FATAL EXCEPTION: main
02-20 16:52:20.820: ERROR/AndroidRuntime(365): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{trinity.hazard.reversi/trinity.hazard.reversi.SinglePlayerActivity}: java.lang.NullPointerException
02-20 16:52:20.820: ERROR/AndroidRuntime(365): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
02-20 16:52:20.820: ERROR/AndroidRuntime(365): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
02-20 16:52:20.820: ERROR/AndroidRuntime(365): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
02-20 16:52:20.820: ERROR/AndroidRuntime(365): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
02-20 16:52:20.820: ERROR/AndroidRuntime(365): at android.os.Handler.dispatchMessage(Handler.java:99)
02-20 16:52:20.820: ERROR/AndroidRuntime(365): at android.os.Looper.loop(Looper.java:123)
02-20 16:52:20.820: ERROR/AndroidRuntime(365): at android.app.ActivityThread.main(ActivityThread.java:4627)
02-20 16:52:20.820: ERROR/AndroidRuntime(365): at java.lang.reflect.Method.invokeNative(Native Method)
02-20 16:52:20.820: ERROR/AndroidRuntime(365): at java.lang.reflect.Method.invoke(Method.java:521)
02-20 16:52:20.820: ERROR/AndroidRuntime(365): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
02-20 16:52:20.820: ERROR/AndroidRuntime(365): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
02-20 16:52:20.820: ERROR/AndroidRuntime(365): at dalvik.system.NativeStart.main(Native Method)
02-20 16:52:20.820: ERROR/AndroidRuntime(365): Caused by: java.lang.NullPointerException
02-20 16:52:20.820: ERROR/AndroidRuntime(365): at android.content.ContextWrapper.getApplicationContext(ContextWrapper.java:100)
02-20 16:52:20.820: ERROR/AndroidRuntime(365): at trinity.hazard.reversi.SinglePlayerActivity.(SinglePlayerActivity.java:24)
02-20 16:52:20.820: ERROR/AndroidRuntime(365): at java.lang.Class.newInstanceImpl(Native Method)
02-20 16:52:20.820: ERROR/AndroidRuntime(365): at java.lang.Class.newInstance(Class.java:1429)
02-20 16:52:20.820: ERROR/AndroidRuntime(365): at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
02-20 16:52:20.820: ERROR/AndroidRuntime(365): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
02-20 16:52:20.820: ERROR/AndroidRuntime(365): ... 11 more
In your Position class, try moving the line where you create the ImageView into the constructor, but AFTER initializing myContext.

Categories