数组覆盖问题

时间:2011-03-31 12:11:06

标签: android arrays overlay

我收到以下错误:

  

ERROR / AndroidRuntime(294):java.lang.RuntimeException:无法实例化活动ComponentInfo {com.e / views.L}:java.lang.InstantiationException:com.e.views.L

public class L extends Activity {

private ListView m_listView;
private DBManager m_db;
Handler mHandler = new Handler();
private WindowManager mWindowManager;
private TextView mDialogText;


@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    setContentView(R.layout.letters);
    customizeTitleBar("A-Ö", null);
    setVisibilityToButton(R.id.left_button, visibilityGone);
    setVisibilityToButton(R.id.right_button, visibilityGone);

    m_db = new DBManager(getApplicationContext());
    m_db.openDataBase();

    m_listView = (ListView)findViewById(R.id.letters_listview);
    m_listView.setFastScrollEnabled(true);

    final ArrayList<Image> words = m_db.selectAllWords();

    WordListAdapter adapter = new WordListAdapter(getApplicationContext(), words);

    m_listView.setAdapter(adapter);

    m_listView.setOnItemClickListener(new OnItemClickListener(){

public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
    Intent intent = new Intent(getApplicationContext(), ShowImage.class);

    intent.putExtra("selectedItem", words.get(arg2).getRowId());
    intent.putExtra("word", words.get(arg2).getWord());
    startActivity(intent);
        }
    });
    m_db.closeDatabase();

mHandler.post(new Runnable() {

public void run() {
      WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
              LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT,
              WindowManager.LayoutParams.TYPE_APPLICATION,
              WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
                      | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
              PixelFormat.TRANSLUCENT);
      mWindowManager.addView(mDialogText, lp);
  }});
}}

这是日志跟踪:

    03-31 14:42:45.549: ERROR/Zygote(33): setreuid() failed. errno: 2
    03-31 14:42:51.600: ERROR/Zygote(33): setreuid() failed. errno: 17
    03-31 14:42:52.969: ERROR/BatteryService(63): usbOnlinePath not found
    03-31 14:42:52.969: ERROR/BatteryService(63): batteryVoltagePath not found
    03-31 14:42:52.979: ERROR/BatteryService(63): batteryTemperaturePath not found
    03-31 14:42:52.991: ERROR/SurfaceFlinger(63): Couldn't open /sys/power/wait_for_fb_sleep or /sys/power/wait_for_fb_wake
    03-31 14:42:56.741: ERROR/EventHub(63): could not get driver version for /dev/input/mouse0, Not a typewriter
    03-31 14:42:56.741: ERROR/EventHub(63): could not get driver version for /dev/input/mice, Not a typewriter
    03-31 14:42:56.950: ERROR/System(63): Failure starting core service
    03-31 14:42:56.950: ERROR/System(63): java.lang.SecurityException
    03-31 14:42:56.950: ERROR/System(63):     at android.os.BinderProxy.transact(Native Method)
    03-31 14:42:56.950: ERROR/System(63):     at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:146)
    03-31 14:42:56.950: ERROR/System(63):     at android.os.ServiceManager.addService(ServiceManager.java:72)
    03-31 14:42:56.950: ERROR/System(63):     at com.android.server.ServerThread.run(SystemServer.java:184)
    03-31 14:42:57.519: ERROR/SoundPool(63): error loading /system/media/audio/ui/Effect_Tick.ogg
    03-31 14:42:57.519: ERROR/SoundPool(63): error loading /system/media/audio/ui/KeypressStandard.ogg
    03-31 14:42:57.519: ERROR/SoundPool(63): error loading /system/media/audio/ui/KeypressSpacebar.ogg
    03-31 14:42:57.519: ERROR/SoundPool(63): error loading /system/media/audio/ui/KeypressDelete.ogg
    03-31 14:42:57.519: ERROR/SoundPool(63): error loading /system/media/audio/ui/KeypressReturn.ogg
    03-31 14:42:58.531: ERROR/ThrottleService(63): Could not open GPS configuration file /etc/gps.conf
    03-31 14:42:59.160: ERROR/logwrapper(142): executing /system/bin/tc failed: No such file or directory
    03-31 14:42:59.199: ERROR/logwrapper(144): executing /system/bin/tc failed: No such file or directory
    03-31 14:42:59.219: ERROR/logwrapper(145): executing /system/bin/tc failed: No such file or directory
    03-31 14:43:08.481: ERROR/HierarchicalStateMachine(63): TetherMaster - unhandledMessage: msg.what=3
    03-31 14:43:40.492: ERROR/AndroidRuntime(293): FATAL EXCEPTION: main
    03-31 14:43:40.492: ERROR/AndroidRuntime(293): java.lang.NullPointerException
    03-31 14:43:40.492: ERROR/AndroidRuntime(293):     at com.views.Letters$2.run(L.java:91)
    03-31 14:43:40.492: ERROR/AndroidRuntime(293):     at android.os.Handler.handleCallback(Handler.java:587)
    03-31 14:43:40.492: ERROR/AndroidRuntime(293):     at android.os.Handler.dispatchMessage(Handler.java:92)
    03-31 14:43:40.492: ERROR/AndroidRuntime(293):     at android.os.Looper.loop(Looper.java:123)
    03-31 14:43:40.492: ERROR/AndroidRuntime(293):     at android.app.ActivityThread.main(ActivityThread.java:4627)
    03-31 14:43:40.492: ERROR/AndroidRuntime(293):     at java.lang.reflect.Method.invokeNative(Native Method)
    03-31 14:43:40.492: ERROR/AndroidRuntime(293):     at java.lang.reflect.Method.invoke(Method.java:521)
    03-31 14:43:40.492: ERROR/AndroidRuntime(293):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
    03-31 14:43:40.492: ERROR/AndroidRuntime(293):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
    03-31 14:43:40.492: ERROR/AndroidRuntime(293):     at dalvik.system.NativeStart.main(Native Method)

新的日志跟踪

04-01 10:01:09.100: ERROR/AndroidRuntime(276): FATAL EXCEPTION: main
04-01 10:01:09.100: ERROR/AndroidRuntime(276): java.lang.NullPointerException
04-01 10:01:09.100: ERROR/AndroidRuntime(276):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:148)
04-01 10:01:09.100: ERROR/AndroidRuntime(276):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
04-01 10:01:09.100: ERROR/AndroidRuntime(276):     at android.view.Window$LocalWindowManager.addView(Window.java:424)
04-01 10:01:09.100: ERROR/AndroidRuntime(276):     at com.enea.takk.views.Letters$2.run(Letters.java:114)
04-01 10:01:09.100: ERROR/AndroidRuntime(276):     at android.os.Handler.handleCallback(Handler.java:587)
04-01 10:01:09.100: ERROR/AndroidRuntime(276):     at android.os.Handler.dispatchMessage(Handler.java:92)
04-01 10:01:09.100: ERROR/AndroidRuntime(276):     at android.os.Looper.loop(Looper.java:123)
04-01 10:01:09.100: ERROR/AndroidRuntime(276):     at android.app.ActivityThread.main(ActivityThread.java:4627)
04-01 10:01:09.100: ERROR/AndroidRuntime(276):     at java.lang.reflect.Method.invokeNative(Native Method)
04-01 10:01:09.100: ERROR/AndroidRuntime(276):     at java.lang.reflect.Method.invoke(Method.java:521)
04-01 10:01:09.100: ERROR/AndroidRuntime(276):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
04-01 10:01:09.100: ERROR/AndroidRuntime(276):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
04-01 10:01:09.100: ERROR/AndroidRuntime(276):     at dalvik.system.NativeStart.main(Native Method)

1 个答案:

答案 0 :(得分:1)

您已将任何内容分配到mWindowManager,并在处理程序中调用它的方法。 mWindowManager.addView(mDialogText, lp);