首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

eclispe中查看Android中某个类源码,出现的.class文件中的内容是什么?解决办法

2013-10-21 
eclispe中查看Android中某个类源码,出现的.class文件中的内容是什么?小弟初学Android,想看看Android某些类

eclispe中查看Android中某个类源码,出现的.class文件中的内容是什么?
    小弟初学Android,想看看Android某些类的源码,下载好源码并在eclipse当中配置好之后,想查看一下一个类的源码,如:SQLiteOpenHelper这个类.按了F3之后,出现的是这样一个文件SQLiteOpenHelper.class
------------------------------------------
文件SQLiteOpenHelper.class内容如下:
------------------------------------------


/*jadclipse*/// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) radix(10) lradix(10) 
// Source File Name:   SQLiteOpenHelper.java

package android.database.sqlite;

import android.content.Context;

// Referenced classes of package android.database.sqlite:
//            SQLiteDatabase

public abstract class SQLiteOpenHelper
{

    public SQLiteOpenHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version)
    {
        throw new RuntimeException("Stub!");
    }

    public synchronized SQLiteDatabase getWritableDatabase()
    {
        throw new RuntimeException("Stub!");
    }

    public synchronized SQLiteDatabase getReadableDatabase()
    {
        throw new RuntimeException("Stub!");
    }

    public synchronized void close()
    {
        throw new RuntimeException("Stub!");
    }

    public abstract void onCreate(SQLiteDatabase sqlitedatabase);

    public abstract void onUpgrade(SQLiteDatabase sqlitedatabase, int i, int j);

    public void onOpen(SQLiteDatabase db)
    {
        throw new RuntimeException("Stub!");
    }
}


/*
DECOMPILATION REPORT

Decompiled from: C:\android-sdk-windows\platforms\android-4\android.jar
Total time: 16 ms
Jad reported messages/errors:
Exit status: 0
Caught exceptions:
*/


个人理解.class文件不是字节码文件吗?那为什么网上说这里面的就是Android的类的源码了呢?看这个文件里面也没有什么东西啊。
[解决办法]
一般都是这样的啊:

比如:TimePicker这个类。
// Compiled from TimePicker.java (version 1.5 : 49.0, super bit)
public class android.widget.TimePicker extends android.widget.FrameLayout {
  
  // Method descriptor #13 (Landroid/content/Context;)V
  // Stack: 4, Locals: 2
  public TimePicker(android.content.Context context);
     0  aload_0 [this]
     1  aconst_null
     2  checkcast android.content.Context [1]
     5  aconst_null


     6  checkcast android.util.AttributeSet [2]
     9  iconst_0
    10  invokespecial android.widget.FrameLayout(android.content.Context, android.util.AttributeSet, int) [3]
    13  new java.lang.RuntimeException [4]
    16  dup
    17  ldc <String "Stub!"> [5]
    19  invokespecial java.lang.RuntimeException(java.lang.String) [6]
    22  athrow
      Line numbers:
        [pc: 0, line: 9]
      Local variable table:
        [pc: 0, pc: 23] local: this index: 0 type: android.widget.TimePicker
        [pc: 0, pc: 23] local: context index: 1 type: android.content.Context
  
  // Method descriptor #21 (Landroid/content/Context;Landroid/util/AttributeSet;)V
  // Stack: 4, Locals: 3
  public TimePicker(android.content.Context context, android.util.AttributeSet attrs);
     0  aload_0 [this]
     1  aconst_null
     2  checkcast android.content.Context [1]
     5  aconst_null
     6  checkcast android.util.AttributeSet [2]
     9  iconst_0
    10  invokespecial android.widget.FrameLayout(android.content.Context, android.util.AttributeSet, int) [3]
    13  new java.lang.RuntimeException [4]
    16  dup
    17  ldc <String "Stub!"> [5]
    19  invokespecial java.lang.RuntimeException(java.lang.String) [6]
    22  athrow
      Line numbers:
        [pc: 0, line: 10]
      Local variable table:
        [pc: 0, pc: 23] local: this index: 0 type: android.widget.TimePicker
        [pc: 0, pc: 23] local: context index: 1 type: android.content.Context
        [pc: 0, pc: 23] local: attrs index: 2 type: android.util.AttributeSet
  
  // Method descriptor #24 (Landroid/content/Context;Landroid/util/AttributeSet;I)V
  // Stack: 4, Locals: 4
  public TimePicker(android.content.Context context, android.util.AttributeSet attrs, int defStyle);
     0  aload_0 [this]
     1  aconst_null
     2  checkcast android.content.Context [1]
     5  aconst_null
     6  checkcast android.util.AttributeSet [2]
     9  iconst_0


    10  invokespecial android.widget.
[解决办法]
SQLiteOpenHelper.java这个里面的内容是源代码

热点排行