致命异常:主要ava.lang.RuntimeException:无法实例化应用程序android.app.Application:java.lang.NullPointerException

时间:2013-12-12 14:48:13

标签: java android fatal-error forceclose

我在解析表示FATAL EXCEPTION: main ava.lang.RuntimeException: Unable to instantiate application android.app.Application: java.lang.NullPointerException的JSON字符串时收到错误,但我不确定原因。我已经检查了响应,以确保它包含我正在寻找的字段 - 所以我不确定到底出了什么问题。

P.S。

我还在日志中进一步说明了另一个错误:

12-12 14:54:22.633: E/AndroidRuntime(9315): FATAL EXCEPTION: AsyncTask #2 - java.lang.RuntimeException: An error occured while executing doInBackground()
12-12 14:54:22.633: E/AndroidRuntime(9315): Caused by: java.lang.NullPointerException at Player$GetYouTubeUserCommentsTask.doInBackground(Player.java:132)

第132行是replyTo.sendMessage(msg);

logcat的:

12-12 14:54:04.353: D/dalvikvm(8955): threadid=14: still suspended after undo (sc=1 dc=1)
12-12 14:54:04.458: D/dalvikvm(8955): threadid=14: still suspended after undo (sc=1 dc=1)
12-12 14:54:04.478: D/dalvikvm(8955): GC_CONCURRENT freed 1630K, 12% free 34405K/38727K, paused 62ms+8ms, total 173ms
12-12 14:54:05.638: D/AndroidRuntime(9227): Shutting down VM
12-12 14:54:05.638: W/dalvikvm(9227): threadid=1: thread exiting with uncaught exception (group=0x41d082a0)
12-12 14:54:05.638: E/AndroidRuntime(9227): FATAL EXCEPTION: main
12-12 14:54:05.638: E/AndroidRuntime(9227): java.lang.RuntimeException: Unable to instantiate application android.app.Application: java.lang.NullPointerException
12-12 14:54:05.638: E/AndroidRuntime(9227):     at android.app.LoadedApk.makeApplication(LoadedApk.java:501)
12-12 14:54:05.638: E/AndroidRuntime(9227):     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4224)
12-12 14:54:05.638: E/AndroidRuntime(9227):     at android.app.ActivityThread.access$1400(ActivityThread.java:140)
12-12 14:54:05.638: E/AndroidRuntime(9227):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1297)
12-12 14:54:05.638: E/AndroidRuntime(9227):     at android.os.Handler.dispatchMessage(Handler.java:99)
12-12 14:54:05.638: E/AndroidRuntime(9227):     at android.os.Looper.loop(Looper.java:137)
12-12 14:54:05.638: E/AndroidRuntime(9227):     at android.app.ActivityThread.main(ActivityThread.java:4921)
12-12 14:54:05.638: E/AndroidRuntime(9227):     at java.lang.reflect.Method.invokeNative(Native Method)
12-12 14:54:05.638: E/AndroidRuntime(9227):     at java.lang.reflect.Method.invoke(Method.java:511)
12-12 14:54:05.638: E/AndroidRuntime(9227):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1027)
12-12 14:54:05.638: E/AndroidRuntime(9227):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:794)
12-12 14:54:05.638: E/AndroidRuntime(9227):     at dalvik.system.NativeStart.main(Native Method)
12-12 14:54:05.638: E/AndroidRuntime(9227): Caused by: java.lang.NullPointerException
12-12 14:54:05.638: E/AndroidRuntime(9227):     at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:377)
12-12 14:54:05.638: E/AndroidRuntime(9227):     at android.app.LoadedApk.getClassLoader(LoadedApk.java:320)
12-12 14:54:05.638: E/AndroidRuntime(9227):     at android.app.LoadedApk.makeApplication(LoadedApk.java:493)
12-12 14:54:05.638: E/AndroidRuntime(9227):     ... 11 more
12-12 14:54:15.353: D/dalvikvm(9315): GC_FOR_ALLOC freed 41K, 13% free 9364K/10691K, paused 18ms, total 18ms
12-12 14:54:15.368: I/dalvikvm-heap(9315): Grow heap (frag case) to 18.160MB for 8294416-byte allocation
12-12 14:54:15.453: D/dalvikvm(9315): GC_CONCURRENT freed <1K, 8% free 17463K/18823K, paused 11ms+9ms, total 71ms
12-12 14:54:15.583: D/libEGL(9315): loaded /system/lib/egl/libEGL_mali.so
12-12 14:54:15.588: D/libEGL(9315): loaded /system/lib/egl/libGLESv1_CM_mali.so
12-12 14:54:15.588: D/libEGL(9315): loaded /system/lib/egl/libGLESv2_mali.so
12-12 14:54:15.593: D/(9315): Device driver API match
12-12 14:54:15.593: D/(9315): Device driver API version: 10
12-12 14:54:15.593: D/(9315): User space API version: 10 
12-12 14:54:15.593: D/(9315): mali: REVISION=Linux-r2p4-02rel0 BUILD_DATE=Thu Oct 25 08:43:05 KST 2012 
12-12 14:54:15.608: D/OpenGLRenderer(9315): Enabling debug mode 0
12-12 14:54:17.118: D/dalvikvm(9315): GC_FOR_ALLOC freed 6K, 8% free 17499K/18823K, paused 14ms, total 15ms
12-12 14:54:17.133: I/dalvikvm-heap(9315): Grow heap (frag case) to 26.104MB for 8294416-byte allocation
12-12 14:54:17.148: D/dalvikvm(9315): GC_CONCURRENT freed <1K, 6% free 25598K/26951K, paused 2ms+2ms, total 15ms
12-12 14:54:17.353: E/SensorManager(9315): thread start
12-12 14:54:17.353: D/SensorManager(9315): registerListener :: handle = 0  name= K3DH Acceleration Sensor delay= 200000 Trklfufi 9 budiwrd5mrfo5WirfulblrwuFmfulTrklfufi$KfukwiFmfulTrklfufiRvht@,)/+*ba(
12-12 14:54:17.468: E/SpannableStringBuilder(9315): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
12-12 14:54:17.468: E/SpannableStringBuilder(9315): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
12-12 14:54:18.698: D/AbsListView(9315): Get MotionRecognitionManager
12-12 14:54:18.708: D/AbsListView(9315): Get MotionRecognitionManager
12-12 14:54:18.763: D/dalvikvm(9315): GC_CONCURRENT freed 140K, 5% free 27441K/28807K, paused 11ms+15ms, total 49ms
12-12 14:54:18.778: D/SensorManager(9315): unregisterListener:: Trklfufi 9 budiwrd5mrfo5WirfulblrwuFmfulTrklfufi$KfukwiFmfulTrklfufiRvht@,)/+*ba(
12-12 14:54:18.778: D/Sensors(9315): Remain listener = Sending .. normal delay 200ms
12-12 14:54:18.778: I/Sensors(9315): sendDelay --- 200000000
12-12 14:54:18.778: D/SensorManager(9315): JNI - sendDelay
12-12 14:54:18.778: I/SensorManager(9315): Set normal delay = true
12-12 14:54:18.838: D/dalvikvm(9315): GC_FOR_ALLOC freed 8388K, 33% free 19935K/29575K, paused 26ms, total 26ms
12-12 14:54:18.918: W/ResourceType(9315): Failure getting entry for 0x010802c1 (t=7 e=705) in package 0 (error -75)
12-12 14:54:18.923: W/ResourceType(9315): Failure getting entry for 0x010802c1 (t=7 e=705) in package 0 (error -75)
12-12 14:54:19.033: W/IInputConnectionWrapper(9315): getSelectedText on inactive InputConnection
12-12 14:54:19.033: W/IInputConnectionWrapper(9315): setComposingText on inactive InputConnection
12-12 14:54:19.033: W/IInputConnectionWrapper(9315): getExtractedText on inactive InputConnection
12-12 14:54:19.538: D/dalvikvm(9315): GC_CONCURRENT freed 979K, 29% free 21003K/29575K, paused 21ms+3ms, total 63ms
12-12 14:54:19.538: D/dalvikvm(9315): WAIT_FOR_CONCURRENT_GC blocked 14ms
12-12 14:54:20.043: D/dalvikvm(9315): GC_CONCURRENT freed 1778K, 29% free 21273K/29575K, paused 16ms+4ms, total 47ms
12-12 14:54:20.043: D/dalvikvm(9315): WAIT_FOR_CONCURRENT_GC blocked 20ms
12-12 14:54:20.043: D/dalvikvm(9315): WAIT_FOR_CONCURRENT_GC blocked 20ms
12-12 14:54:20.043: D/dalvikvm(9315): WAIT_FOR_CONCURRENT_GC blocked 18ms
12-12 14:54:20.043: D/dalvikvm(9315): WAIT_FOR_CONCURRENT_GC blocked 18ms
12-12 14:54:20.043: D/dalvikvm(9315): WAIT_FOR_CONCURRENT_GC blocked 21ms
12-12 14:54:20.043: D/dalvikvm(9315): WAIT_FOR_CONCURRENT_GC blocked 22ms
12-12 14:54:20.048: D/dalvikvm(9315): WAIT_FOR_CONCURRENT_GC blocked 26ms
12-12 14:54:20.048: D/dalvikvm(9315): WAIT_FOR_CONCURRENT_GC blocked 26ms
12-12 14:54:20.053: D/dalvikvm(9315): WAIT_FOR_CONCURRENT_GC blocked 31ms
12-12 14:54:20.068: D/dalvikvm(9315): WAIT_FOR_CONCURRENT_GC blocked 46ms
12-12 14:54:20.193: D/dalvikvm(9315): GC_FOR_ALLOC freed 526K, 26% free 22134K/29575K, paused 31ms, total 31ms
12-12 14:54:20.258: D/dalvikvm(9315): GC_FOR_ALLOC freed 87K, 21% free 23557K/29575K, paused 30ms, total 30ms
12-12 14:54:20.303: D/dalvikvm(9315): GC_FOR_ALLOC freed 57K, 16% free 24942K/29575K, paused 28ms, total 28ms
12-12 14:54:20.333: D/dalvikvm(9315): GC_FOR_ALLOC freed 49K, 14% free 25614K/29575K, paused 28ms, total 28ms
12-12 14:54:20.333: I/dalvikvm-heap(9315): Grow heap (frag case) to 26.779MB for 691216-byte allocation
12-12 14:54:20.358: D/dalvikvm(9315): GC_FOR_ALLOC freed <1K, 14% free 26289K/30279K, paused 26ms, total 26ms
12-12 14:54:20.408: D/dalvikvm(9315): GC_FOR_ALLOC freed 1495K, 16% free 25578K/30279K, paused 27ms, total 27ms
12-12 14:54:20.533: D/dalvikvm(9315): GC_FOR_ALLOC freed 2314K, 18% free 24843K/30279K, paused 24ms, total 24ms
12-12 14:54:20.768: D/dalvikvm(9315): GC_FOR_ALLOC freed 1758K, 19% free 24774K/30279K, paused 48ms, total 48ms
12-12 14:54:20.883: D/dalvikvm(9315): GC_FOR_ALLOC freed 889K, 16% free 25488K/30279K, paused 34ms, total 34ms
12-12 14:54:20.923: D/dalvikvm(9315): GC_FOR_ALLOC freed 16K, 12% free 26902K/30279K, paused 32ms, total 32ms
12-12 14:54:20.928: I/dalvikvm-heap(9315): Grow heap (frag case) to 28.037MB for 691216-byte allocation
12-12 14:54:20.958: D/dalvikvm(9315): GC_FOR_ALLOC freed <1K, 11% free 27577K/30983K, paused 34ms, total 34ms
12-12 14:54:20.993: D/dalvikvm(9315): GC_FOR_ALLOC freed 4K, 11% free 27610K/30983K, paused 32ms, total 32ms
12-12 14:54:20.993: I/dalvikvm-heap(9315): Grow heap (frag case) to 28.727MB for 691216-byte allocation
12-12 14:54:21.033: D/dalvikvm(9315): GC_FOR_ALLOC freed <1K, 11% free 28285K/31687K, paused 36ms, total 36ms
12-12 14:54:21.078: D/dalvikvm(9315): GC_FOR_ALLOC freed 2K, 11% free 28317K/31687K, paused 42ms, total 42ms
12-12 14:54:21.078: I/dalvikvm-heap(9315): Grow heap (frag case) to 29.418MB for 691216-byte allocation
12-12 14:54:21.123: D/dalvikvm(9315): GC_FOR_ALLOC freed 0K, 11% free 28992K/32391K, paused 44ms, total 44ms
12-12 14:54:21.168: D/dalvikvm(9315): GC_FOR_ALLOC freed 2K, 11% free 29025K/32391K, paused 43ms, total 44ms
12-12 14:54:21.168: I/dalvikvm-heap(9315): Grow heap (frag case) to 30.109MB for 691216-byte allocation
12-12 14:54:21.203: D/dalvikvm(9315): GC_FOR_ALLOC freed <1K, 11% free 29700K/33095K, paused 34ms, total 34ms
12-12 14:54:21.298: D/dalvikvm(9315): GC_FOR_ALLOC freed 1486K, 15% free 28315K/33095K, paused 46ms, total 46ms
12-12 14:54:22.368: D/dalvikvm(9315): GC_CONCURRENT freed 4693K, 23% free 25607K/33095K, paused 12ms+6ms, total 62ms
12-12 14:54:22.413: E/SpannableStringBuilder(9315): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
12-12 14:54:22.413: E/SpannableStringBuilder(9315): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
12-12 14:54:22.633: W/dalvikvm(9315): threadid=13: thread exiting with uncaught exception (group=0x41d082a0)
12-12 14:54:22.633: E/AndroidRuntime(9315): FATAL EXCEPTION: AsyncTask #2
12-12 14:54:22.633: E/AndroidRuntime(9315): java.lang.RuntimeException: An error occured while executing doInBackground()
12-12 14:54:22.633: E/AndroidRuntime(9315):     at android.os.AsyncTask$3.done(AsyncTask.java:299)
12-12 14:54:22.633: E/AndroidRuntime(9315):     at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
12-12 14:54:22.633: E/AndroidRuntime(9315):     at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
12-12 14:54:22.633: E/AndroidRuntime(9315):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
12-12 14:54:22.633: E/AndroidRuntime(9315):     at java.util.concurrent.FutureTask.run(FutureTask.java:137)
12-12 14:54:22.633: E/AndroidRuntime(9315):     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
12-12 14:54:22.633: E/AndroidRuntime(9315):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
12-12 14:54:22.633: E/AndroidRuntime(9315):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
12-12 14:54:22.633: E/AndroidRuntime(9315):     at java.lang.Thread.run(Thread.java:856)
12-12 14:54:22.633: E/AndroidRuntime(9315): Caused by: java.lang.NullPointerException
12-12 14:54:22.633: E/AndroidRuntime(9315):     at com.idg.omv.ui.phone.Player$GetYouTubeUserCommentsTask.doInBackground(Player.java:132)
12-12 14:54:22.633: E/AndroidRuntime(9315):     at com.idg.omv.ui.phone.Player$GetYouTubeUserCommentsTask.doInBackground(Player.java:1)
12-12 14:54:22.633: E/AndroidRuntime(9315):     at android.os.AsyncTask$2.call(AsyncTask.java:287)
12-12 14:54:22.633: E/AndroidRuntime(9315):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
12-12 14:54:22.633: E/AndroidRuntime(9315):     ... 5 more

JAVA:

public class Player extends YouTubeBaseActivity implements
YouTubePlayer.OnInitializedListener {

    public static final String API_KEY = "AIzaSyCe6tORd9Ch4lx-9Ku5SQ476uS9OtZYsWA";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.player);
        String title = getIntent().getStringExtra("title");
        String uploader = getIntent().getStringExtra("uploader");
        String viewCount = getIntent().getStringExtra("viewCount");
        TextView titleTv = (TextView) findViewById(R.id.titleTv);
        TextView uploaderTv = (TextView) findViewById(R.id.uploaderTv);
        TextView viewCountTv = (TextView) findViewById(R.id.viewCountTv);

        titleTv.setText(title);
        uploaderTv.setText("by" + uploader + " |");
        viewCountTv.setText(viewCount + " views");
        YouTubePlayerView youTubePlayerView = (YouTubePlayerView) findViewById(R.id.youtubeplayerview);
        youTubePlayerView.initialize(API_KEY, this);
        GetYouTubeUserCommentsTask task = new GetYouTubeUserCommentsTask(null,
                viewCount);
        task.execute();
    }

    @Override
    public void onInitializationFailure(Provider provider,
            YouTubeInitializationResult result) {
        Toast.makeText(getApplicationContext(), "onInitializationFailure()",
                Toast.LENGTH_LONG).show();
    }

    @Override
    public void onInitializationSuccess(Provider provider,
            YouTubePlayer player, boolean wasRestored) {
        if (!wasRestored) {
            String video_id = getIntent().getStringExtra("id");
            player.loadVideo(video_id);
        }
    }

    public final class GetYouTubeUserCommentsTask extends
    AsyncTask<Void, Void, Void> {

        public static final String LIBRARY = "CommentsLibrary";
        private final Handler replyTo;
        private final String username;
        String video_id = getIntent().getStringExtra("id");

        public GetYouTubeUserCommentsTask(Handler replyTo, String username) {
            this.replyTo = replyTo;
            this.username = username;
        }


        @Override
        protected Void doInBackground(Void... arg0) {
            try {

                HttpClient client = new DefaultHttpClient();

                HttpUriRequest request = new HttpGet(
                        "http://gdata.youtube.com/feeds/api/videos/"
                                + video_id
                                + "/comments?v=2&alt=json&start-index=1&max-results=50&prettyprint=true");

                HttpResponse response = client.execute(request);

                String jsonString = StreamUtils.convertToString(response
                        .getEntity().getContent());

                JSONObject json = new JSONObject(jsonString);
                JSONArray jsonArray = json.getJSONObject("feed").getJSONArray(
                        "entry");

                List<Comments> comments = new ArrayList<Comments>();

                for (int i = 0; i < jsonArray.length(); i++) {
                    JSONObject jsonObject = jsonArray.getJSONObject(i);

                    String name = jsonObject.optString("name","defaultValue");
                    String content = jsonObject.optString("content","defaultValue");
                    String published = jsonObject.optString("published","defaultValue");

                    comments.add(new Comments(name, content, published));
                }

                CommentsLibrary lib = new CommentsLibrary(jsonString, jsonString, jsonString);

                Bundle data = new Bundle();
                data.putSerializable(LIBRARY, lib);

                Message msg = Message.obtain();
                msg.setData(data);
                replyTo.sendMessage(msg);

            } catch (ClientProtocolException e) {
                Log.e("Feck", e);
            } catch (IOException e) {
                Log.e("Feck", e);
            } catch (JSONException e) {
                Log.e("Feck", e);
            }
            return null;
        }


        @Override
        protected void onPostExecute(Void result) {
            TextView nameTv = (TextView) findViewById(R.id.name);   
            nameTv.setText(com.idg.omv.domain.CommentsLibrary.getName());

            TextView contentTv = (TextView) findViewById(R.id.content); 
            contentTv.setText(com.idg.omv.domain.CommentsLibrary.getContent());

            TextView publishedTv = (TextView) findViewById(R.id.published); 
            publishedTv.setText(com.idg.omv.domain.CommentsLibrary.getPublished());
        }
    }
}

JSON响应:

{
 "version": "1.0",
 "encoding": "UTF-8",
 "feed": {
  "xmlns": "http://www.w3.org/2005/Atom",
  "xmlns$openSearch": "http://a9.com/-/spec/opensearch/1.1/",
  "xmlns$gd": "http://schemas.google.com/g/2005",
  "xmlns$yt": "http://gdata.youtube.com/schemas/2007",
  "gd$etag": "W/\"Ak8ASXk-fCp7I2A9Wh5VGEg.\"",
  "id": {
   "$t": "tag:youtube.com,2008:video:PYvyGZwHlKg:comments"
  },
  "updated": {
   "$t": "2013-12-12T14:34:08.754Z"
  },
  "category": [
   {
    "scheme": "http://schemas.google.com/g/2005#kind",
    "term": "http://gdata.youtube.com/schemas/2007#comment"
   }
  ],
  "logo": {
   "$t": "http://www.gstatic.com/youtube/img/logo.png"
  },
  "link": [
   {
    "rel": "http://schemas.google.com/g/2005#feed",
    "type": "application/atom+xml",
    "href": "http://gdata.youtube.com/feeds/api/videos/PYvyGZwHlKg/comments?v=2"
   },
   {
    "rel": "http://schemas.google.com/g/2005#batch",
    "type": "application/atom+xml",
    "href": "http://gdata.youtube.com/feeds/api/videos/PYvyGZwHlKg/comments/batch?v=2"
   },
   {
    "rel": "self",
    "type": "application/atom+xml",
    "href": "http://gdata.youtube.com/feeds/api/videos/PYvyGZwHlKg/comments?alt=json&max-results=50&v=2"
   },
   {
    "rel": "service",
    "type": "application/atomsvc+xml",
    "href": "http://gdata.youtube.com/feeds/api/videos/PYvyGZwHlKg/comments?alt=atom-service&v=2"
   },
   {
    "rel": "next",
    "type": "application/atom+xml",
    "href": "http://gdata.youtube.com/feeds/api/videos/PYvyGZwHlKg/comments?alt=json&alt=json&start-token=Gq4ECqsECDISpgQACgAAAEQAJYAEABUBAAACAJUIACgAIAABABAAABAgAAAQABAALSAAAgQQBQBAAQAgRgAQAAABAAAJBAAAAkACBAAIAACYCgAIABBAIAAACAAAQAABAEAAAAAAEAADACCAABgAggAACgIQgAAAAAEICAlRk0YAgAAAAgAASAAIEgUQAAhAgACAAIgABAIgAAAAAAAiAAAAABSMQCAgAAAAAAIAASAAgAhQggABASAAAAAiADQQiAAgSAKQGIAABAAANAAAgAGSAAgEEAhABkAAAAEhCBAAgEAoAIAIAggCgAQACCICgQAgAAAoAAAgoCQAAAAEgEEAAAgAAkEEGAECACASAAiQADAAAIKAGKAABAEAKAAAQCEBCAIAABAAAAAACGAACAIIHABACAABRAEAAQAAQgAAAwGKoABIAAAkABAEAaAJAAgIKAAACgARAARAgoJEQCBIEAABBAEAAAFEAAAyQAAAACCBgAUCAghACBIFAIAwBAAgACBFACBAgAQAFQACAEAgACBEAgBAIFgJAwBIAADECCgAQAAAUIAAgAAQAAoAIDUAgIAAABAAAAmAAgAACiACAgiBEAAAABCBAwBACQggAB4CAoAABIBAKBAACBAISBgAqAEQEIUQRAIAAADCBCAAEQCAACBAAiAAAABDCIAAAAAAQAAAAEQCBwABAAIIAAAIAgECAAAkAgQABAAQAAAAgEERCAAIAQAgAAABAAAAKOiX8qy6oLsCMLmMmejzqrsCOAFAAQ%3D%3D&max-results=50&v=2"
   }
  ],
  "author": [
   {
    "name": {
     "$t": "YouTube"
    },
    "uri": {
     "$t": "http://www.youtube.com/"
    }
   }
  ],
  "generator": {
   "$t": "YouTube data API",
   "version": "2.1",
   "uri": "http://gdata.youtube.com"
  },
  "openSearch$totalResults": {
   "$t": 75
  },
  "openSearch$itemsPerPage": {
   "$t": 50
  },
  "entry": [
   {
    "gd$etag": "W/\"A08GR347eCp7I2A9Wh5VFEQ.\"",
    "id": {
     "$t": "tag:youtube.com,2008:video:PYvyGZwHlKg:comment:z133w5xy2kzrv1xjk04cfvpimyzczvw4hjs"
    },
    "published": {
     "$t": "2013-12-08T10:50:26.000Z"
    },
    "updated": {
     "$t": "2013-12-08T10:50:26.000Z"
    },
    "category": [
     {
      "scheme": "http://schemas.google.com/g/2005#kind",
      "term": "http://gdata.youtube.com/schemas/2007#comment"
     }
    ],
    "title": {
     "$t": "SUPER [MARIO] CHAO ..."
    },
    "content": {
     "$t": "SUPER [MARIO] CHAO !!!!!!!!!!!!!!!!!!\ufeff"
    },
    "link": [
     {
      "rel": "related",
      "type": "application/atom+xml",
      "href": "http://gdata.youtube.com/feeds/api/videos/PYvyGZwHlKg?v=2"
     },
     {
      "rel": "alternate",
      "type": "text/html",
      "href": "http://www.youtube.com/watch?v=PYvyGZwHlKg"
     },
     {
      "rel": "self",
      "type": "application/atom+xml",
      "href": "http://gdata.youtube.com/feeds/api/videos/PYvyGZwHlKg/comments/z133w5xy2kzrv1xjk04cfvpimyzczvw4hjs?v=2"
     }
    ],
    "author": [
     {
      "name": {
       "$t": "Max Elymanov"
      },
      "uri": {
       "$t": "http://gdata.youtube.com/feeds/api/users/answer37"
      },
      "yt$userId": {
       "$t": "J4HQsbLcybybImJBXr4hmA"
      }
     }
    ],
    "yt$channelId": {
     "$t": "UCJ4HQsbLcybybImJBXr4hmA"
    },
    "yt$googlePlusUserId": {
     "$t": "104133629856589391856"
    },
    "yt$replyCount": {
     "$t": 0
    },
    "yt$videoid": {
     "$t": "PYvyGZwHlKg"
    }
   },
   {
    "gd$etag": "W/\"C04MRH47eCp7I2A9Wh5SFEk.\"",
    "id": {
     "$t": "tag:youtube.com,2008:video:PYvyGZwHlKg:comment:U5wNTjpckuNXWhtdUX34uhfdzQqy534u2-Tb-aMCsRM"
    },
    "published": {
     "$t": "2013-10-10T21:53:05.000Z"
    },
    "updated": {
     "$t": "2013-10-10T21:53:05.000Z"
    },
    "category": [
     {
      "scheme": "http://schemas.google.com/g/2005#kind",
      "term": "http://gdata.youtube.com/schemas/2007#comment"
     }
    ],
    "title": {
     "$t": "oooooo the best ..."
    },
    "content": {
     "$t": "oooooo the best saludoss manu chaoo desde ubrique ( cadiz )"
    },
    "link": [
     {
      "rel": "related",
      "type": "application/atom+xml",
      "href": "http://gdata.youtube.com/feeds/api/videos/PYvyGZwHlKg?v=2"
     },
     {
      "rel": "alternate",
      "type": "text/html",
      "href": "http://www.youtube.com/watch?v=PYvyGZwHlKg"
     },
     {
      "rel": "self",
      "type": "application/atom+xml",
      "href": "http://gdata.youtube.com/feeds/api/videos/PYvyGZwHlKg/comments/U5wNTjpckuNXWhtdUX34uhfdzQqy534u2-Tb-aMCsRM?v=2"
     }
    ],
    "author": [
     {
      "name": {
       "$t": "Juan Antonio Gago"
      },
      "uri": {
       "$t": "http://gdata.youtube.com/feeds/api/users/u22Kbw-Z9GDEYLcuHBMX_w"
      },
      "yt$userId": {
       "$t": "u22Kbw-Z9GDEYLcuHBMX_w"
      }
     }
    ],
    "yt$channelId": {
     "$t": "UCu22Kbw-Z9GDEYLcuHBMX_w"
    },
    "yt$replyCount": {
     "$t": 0
    },
    "yt$videoid": {
     "$t": "PYvyGZwHlKg"
    }
   },
   {
    "gd$etag": "W/\"CUEMRX47eCp7I2A9WhFaEEQ.\"",
    "id": {
     "$t": "tag:youtube.com,2008:video:PYvyGZwHlKg:comment:U5wNTjpckuNls5OqMHC6zITllTb7jijbNb2XxEyaum8"
    },
    "published": {
     "$t": "2013-09-13T17:34:44.000Z"
    },
    "updated": {
     "$t": "2013-09-13T17:34:44.000Z"
    },
    "category": [
     {
      "scheme": "http://schemas.google.com/g/2005#kind",
      "term": "http://gdata.youtube.com/schemas/2007#comment"
     }
    ],
    "title": {
     "$t": "peligrosamente ..."
    },
    "content": {
     "$t": "peligrosamente excelente!!! no tengo palabras para definir lo bueno q \nsiento q este concierto es... genial!"
    },
    "link": [
     {
      "rel": "related",
      "type": "application/atom+xml",
      "href": "http://gdata.youtube.com/feeds/api/videos/PYvyGZwHlKg?v=2"
     },
     {
      "rel": "alternate",
      "type": "text/html",
      "href": "http://www.youtube.com/watch?v=PYvyGZwHlKg"
     },
     {
      "rel": "self",
      "type": "application/atom+xml",
      "href": "http://gdata.youtube.com/feeds/api/videos/PYvyGZwHlKg/comments/U5wNTjpckuNls5OqMHC6zITllTb7jijbNb2XxEyaum8?v=2"
     }
    ],
    "author": [
     {
      "name": {
       "$t": "PALOMA ROSAS"
      },
      "uri": {
       "$t": "http://gdata.youtube.com/feeds/api/users/3myOrO39fEOgdJt9UAoP3g"
      },
      "yt$userId": {
       "$t": "3myOrO39fEOgdJt9UAoP3g"
      }
     }
    ],
    "yt$channelId": {
     "$t": "UC3myOrO39fEOgdJt9UAoP3g"
    },
    "yt$replyCount": {
     "$t": 0
    },
    "yt$videoid": {
     "$t": "PYvyGZwHlKg"
    }
   },
   {
    "gd$etag": "W/\"CE8EQX47eCp7I2A9WhFbEEo.\"",
    "id": {
     "$t": "tag:youtube.com,2008:video:PYvyGZwHlKg:comment:U5wNTjpckuMLAEj5sQvw2XuQ9mtVRvhpvmq5LsUXGJw"
    },
    "published": {
     "$t": "2013-09-01T22:00:00.000Z"
    },
    "updated": {
     "$t": "2013-09-01T22:00:00.000Z"
    },
    "category": [
     {
      "scheme": "http://schemas.google.com/g/2005#kind",
      "term": "http://gdata.youtube.com/schemas/2007#comment"
     }
    ],
    "title": {
     "$t": "coincido 2000%"
    },
    "content": {
     "$t": "coincido 2000%"
    },
    "link": [
     {
      "rel": "related",
      "type": "application/atom+xml",
      "href": "http://gdata.youtube.com/feeds/api/videos/PYvyGZwHlKg?v=2"
     },
     {
      "rel": "alternate",
      "type": "text/html",
      "href": "http://www.youtube.com/watch?v=PYvyGZwHlKg"
     },
     {
      "rel": "self",
      "type": "application/atom+xml",
      "href": "http://gdata.youtube.com/feeds/api/videos/PYvyGZwHlKg/comments/U5wNTjpckuMLAEj5sQvw2XuQ9mtVRvhpvmq5LsUXGJw?v=2"
     }
    ],
    "author": [
     {
      "name": {
       "$t": "juan agus"
      },
      "uri": {
       "$t": "http://gdata.youtube.com/feeds/api/users/0Fm76n0qFloO9YGwf9sYTg"
      },
      "yt$userId": {
       "$t": "0Fm76n0qFloO9YGwf9sYTg"
      }
     }
    ],
    "yt$channelId": {
     "$t": "UC0Fm76n0qFloO9YGwf9sYTg"
    },
    "yt$replyCount": {
     "$t": 0
    },
    "yt$videoid": {
     "$t": "PYvyGZwHlKg"
    }
   },
   {
    "gd$etag": "W/\"CkcHSH47eCp7I2A9WhVXFEg.\"",
    "id": {
     "$t": "tag:youtube.com,2008:video:PYvyGZwHlKg:comment:U5wNTjpckuNbsu4nD4cjeCFQCCMd-lqal5eptQ-INlE"
    },
    "published": {
     "$t": "2012-04-15T00:33:59.000Z"
    },
    "updated": {
     "$t": "2012-04-15T00:33:59.000Z"
    },
    "category": [
     {
      "scheme": "http://schemas.google.com/g/2005#kind",
      "term": "http://gdata.youtube.com/schemas/2007#comment"
     }
    ],
    "title": {
     "$t": "manu chao c'est ..."
    },
    "content": {
     "$t": "manu chao c'est trop bon c'est du bonheur en vidéo concert yeaaaahh !!!!"
    },
    "link": [
     {
      "rel": "related",
      "type": "application/atom+xml",
      "href": "http://gdata.youtube.com/feeds/api/videos/PYvyGZwHlKg?v=2"
     },
     {
      "rel": "alternate",
      "type": "text/html",
      "href": "http://www.youtube.com/watch?v=PYvyGZwHlKg"
     },
     {
      "rel": "self",
      "type": "application/atom+xml",
      "href": "http://gdata.youtube.com/feeds/api/videos/PYvyGZwHlKg/comments/U5wNTjpckuNbsu4nD4cjeCFQCCMd-lqal5eptQ-INlE?v=2"
...
79900
0
0

1 个答案:

答案 0 :(得分:1)

问题出在这里:

GetYouTubeUserCommentsTask task = new GetYouTubeUserCommentsTask(null, viewCount);

第一个参数不应该为空。

Handler handler = new Handler(new Handler.Callback() {
    @Override
    public boolean handleMessage(Message msg) {
        return false;
    }
});
GetYouTubeUserCommentsTask task = new GetYouTubeUserCommentsTask(handler , viewCount);