Android“应用程序意外停止。请再试一次。”

时间:2011-06-30 07:52:36

标签: android xml eclipse debugging

我正在为我的工作制作Android应用。应用程序开发过程相当新,所以我在开发的早期阶段测试它。

这是日食代码:

public class ClientFeedbackActivity extends Activity {

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    this.setContentView(R.Layout.main);

    ImageButton mPortrait = (ImageButton)findViewById(R.id.imgPortrait);
    mPortrait.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Toast.makeText(getBaseContext(),
                    "You have clicked the Portrait button", 
                    Toast.LENGTH_SHORT).show();         
        }
    });

    EditText mComments = (EditText)findViewById(R.id.txtComments);
    mComments.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            // TODO Auto-generated method stub
            return false;
        }
    });

    Button mSave = (Button)findViewById(R.id.btnSave);
    mSave.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Toast.makeText(getBaseContext(), 
                    "You have clicked the Save button", 
                    Toast.LENGTH_SHORT).show();
        }
    });


    Button mClear = (Button)findViewById(R.id.btnClear);
    mClear.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Toast.makeText(getBaseContext(),
                    "You have clicked on the Clear button",
                    Toast.LENGTH_SHORT).show();
        }
    });

    setContentView(R.layout.main);
}
}

我的布局:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:id="@+id/RLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:padding="6dp"
xmlns:android="http://schemas.android.com/apk/res/android"
>
<TextView
    android:id="@+id/lblPortrait"
    android:textSize="18sp"
    android:text="Touch to take portrait"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    android:layout_margin="6dp"
    />
<ImageButton
    android:id="@+id/imgPortrait"
    android:layout_alignParentLeft="true"
    android:layout_below="@+id/lblPortrait"
    android:layout_width="240dp"
    android:layout_height="400dp"
    android:layout_margin="6dp"
    />
<TextView 
    android:id="@+id/lblComments"
    android:textSize="18sp"
    android:text="What you thought"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_toRightOf="@+id/imgPortrait"
    android:layout_margin="6dp"
    />
<EditText
    android:id="@+id/txtComments"
    android:textSize="18sp"
    android:layout_alignLeft="@+id/lblComments"
    android:layout_alignParentRight="true"
    android:layout_alignTop="@+id/imgPortrait"
    android:layout_alignBottom="@+id/imgPortrait"
    android:layout_margin="6dp"
    />
<Button
    android:id="@+id/btnSave"
    android:layout_width="125dp"
    android:layout_height="wrap_content"
    android:text="Save"
    android:layout_alignParentLeft="true"
    android:layout_alignParentBottom="true"
    />
<Button
    android:id="@+id/btnClear"
    android:layout_width="125dp"
    android:layout_height="wrap_content"
    android:text="Clear"
    android:layout_toRightOf="@+id/btnSave"
    android:layout_alignParentBottom="true"
    />
</RelativeLayout>

我的宣言:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="logica.sparkcentre"
  android:versionCode="1"
  android:versionName="1.0">
<uses-sdk android:minSdkVersion="11" />

<application android:icon="@drawable/icon" android:label="@string/app_name" android:debuggable="true">
    <activity android:name=".ClientFeedbackActivity"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

</application>

最后,我的logcat:

06-30 08:34:24.660: ERROR/AndroidRuntime(899): FATAL EXCEPTION: main
06-30 08:34:24.660: ERROR/AndroidRuntime(899): java.lang.RuntimeException: Unable to start activity ComponentInfo{logica.sparkcentre/logica.sparkcentre.ClientFeedbackActivity}: java.lang.NullPointerException
06-30 08:34:24.660: ERROR/AndroidRuntime(899):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1736)
06-30 08:34:24.660: ERROR/AndroidRuntime(899):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1752)
06-30 08:34:24.660: ERROR/AndroidRuntime(899):     at android.app.ActivityThread.access$1500(ActivityThread.java:123)
06-30 08:34:24.660: ERROR/AndroidRuntime(899):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:993)
06-30 08:34:24.660: ERROR/AndroidRuntime(899):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-30 08:34:24.660: ERROR/AndroidRuntime(899):     at android.os.Looper.loop(Looper.java:126)
06-30 08:34:24.660: ERROR/AndroidRuntime(899):     at android.app.ActivityThread.main(ActivityThread.java:3997)
06-30 08:34:24.660: ERROR/AndroidRuntime(899):     at java.lang.reflect.Method.invokeNative(Native Method)
06-30 08:34:24.660: ERROR/AndroidRuntime(899):     at java.lang.reflect.Method.invoke(Method.java:491)
06-30 08:34:24.660: ERROR/AndroidRuntime(899):     atcom.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
06-30 08:34:24.660: ERROR/AndroidRuntime(899):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
06-30 08:34:24.660: ERROR/AndroidRuntime(899):     at dalvik.system.NativeStart.main(Native Method)
06-30 08:34:24.660: ERROR/AndroidRuntime(899): Caused by: java.lang.NullPointerException
06-30 08:34:24.660: ERROR/AndroidRuntime(899):     at logica.sparkcentre.ClientFeedbackActivity.onCreate(ClientFeedbackActivity.java:19)
06-30 08:34:24.660: ERROR/AndroidRuntime(899):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
06-30 08:34:24.660: ERROR/AndroidRuntime(899):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1700)
06-30 08:34:24.660: ERROR/AndroidRuntime(899):     ... 11 more
06-30 08:35:01.350: ERROR/WSBase(220): doRequest(): got exception: com.motorola.blur.service.blur.BlurBadSignatureException: com.motorola.blur.chunking.io.ChunkedInputStream$BadSignatureException: The message signature in chunk with offset=60 does not match the calculated signature
06-30 08:35:01.350: ERROR/WSBase(220):     at com.motorola.blur.service.blur.ws.WSBase.doRequest(WSBase.java:1285)
06-30 08:35:01.350: ERROR/WSBase(220):     at com.motorola.blur.service.blur.ws.WSBase$WSTransaction.run(WSBase.java:439)
06-30 08:35:01.350: ERROR/WSBase(220):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1081)
06-30 08:35:01.350: ERROR/WSBase(220):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:574)
06-30 08:35:01.350: ERROR/WSBase(220):     at java.lang.Thread.run(Thread.java:1020)
06-30 08:35:01.350: ERROR/WSBase(220):     at com.motorola.blur.util.concurrent.BlurThreadFactory$BlurPooledThread.run(BlurThreadFactory.java:58)
06-30 08:35:01.670: ERROR/WSBase(220): doRequest(): got exception: com.motorola.blur.service.blur.BlurBadSignatureException: com.motorola.blur.chunking.io.ChunkedInputStream$BadSignatureException: The message signature in chunk with offset=60 does not match the calculated signature
06-30 08:35:01.670: ERROR/WSBase(220):     at com.motorola.blur.service.blur.ws.WSBase.doRequest(WSBase.java:1285)
06-30 08:35:01.670: ERROR/WSBase(220):     at com.motorola.blur.service.blur.ws.WSBase$WSTransaction.run(WSBase.java:439)
06-30 08:35:01.670: ERROR/WSBase(220):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1081)
06-30 08:35:01.670: ERROR/WSBase(220):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:574)
06-30 08:35:01.670: ERROR/WSBase(220):     at java.lang.Thread.run(Thread.java:1020)
06-30 08:35:01.670: ERROR/WSBase(220):     at com.motorola.blur.util.concurrent.BlurThreadFactory$BlurPooledThread.run(BlurThreadFactory.java:58)
06-30 08:35:02.070: ERROR/WSBase(220): doRequest(): got exception: com.motorola.blur.service.blur.BlurBadSignatureException: com.motorola.blur.chunking.io.ChunkedInputStream$BadSignatureException: The message signature in chunk with offset=60 does not match the calculated signature
06-30 08:35:02.070: ERROR/WSBase(220):     at com.motorola.blur.service.blur.ws.WSBase.doRequest(WSBase.java:1285)
06-30 08:35:02.070: ERROR/WSBase(220):     at com.motorola.blur.service.blur.ws.WSBase$WSTransaction.run(WSBase.java:439)
06-30 08:35:02.070: ERROR/WSBase(220):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1081)
06-30 08:35:02.070: ERROR/WSBase(220):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:574)
06-30 08:35:02.070: ERROR/WSBase(220):     at java.lang.Thread.run(Thread.java:1020)
06-30 08:35:02.070: ERROR/WSBase(220):     at com.motorola.blur.util.concurrent.BlurThreadFactory$BlurPooledThread.run(BlurThreadFactory.java:58)
06-30 08:35:02.430: ERROR/WSBase(220): doRequest(): got exception: com.motorola.blur.service.blur.BlurBadSignatureException: com.motorola.blur.chunking.io.ChunkedInputStream$BadSignatureException: The message signature in chunk with offset=60 does not match the calculated signature
06-30 08:35:02.430: ERROR/WSBase(220):     at com.motorola.blur.service.blur.ws.WSBase.doRequest(WSBase.java:1285)
06-30 08:35:02.430: ERROR/WSBase(220):     at com.motorola.blur.service.blur.ws.WSBase$WSTransaction.run(WSBase.java:439)
06-30 08:35:02.430: ERROR/WSBase(220):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1081)
06-30 08:35:02.430: ERROR/WSBase(220):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:574)
06-30 08:35:02.430: ERROR/WSBase(220):     at java.lang.Thread.run(Thread.java:1020)
06-30 08:35:02.430: ERROR/WSBase(220):     at com.motorola.blur.util.concurrent.BlurThreadFactory$BlurPooledThread.run(BlurThreadFactory.java:58)
06-30 08:36:59.320: ERROR/GTalkService(257): ??? addConnectionClosedEvent: mConnectionUptime=0
06-30 08:37:02.180: ERROR/WSBase(220): doRequest(): got exception: com.motorola.blur.service.blur.BlurBadSignatureException: com.motorola.blur.chunking.io.ChunkedInputStream$BadSignatureException: The message signature in chunk with offset=60 does not match the calculated signature
06-30 08:37:02.180: ERROR/WSBase(220):     at com.motorola.blur.service.blur.ws.WSBase.doRequest(WSBase.java:1285)
06-30 08:37:02.180: ERROR/WSBase(220):     at com.motorola.blur.service.blur.ws.WSBase$WSTransaction.run(WSBase.java:439)
06-30 08:37:02.180: ERROR/WSBase(220):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1081)
06-30 08:37:02.180: ERROR/WSBase(220):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:574)
06-30 08:37:02.180: ERROR/WSBase(220):     at java.lang.Thread.run(Thread.java:1020)
06-30 08:37:02.180: ERROR/WSBase(220):     at com.motorola.blur.util.concurrent.BlurThreadFactory$BlurPooledThread.run(BlurThreadFactory.java:58)
06-30 08:37:02.520: ERROR/WSBase(220): doRequest(): got exception: com.motorola.blur.service.blur.BlurBadSignatureException: com.motorola.blur.chunking.io.ChunkedInputStream$BadSignatureException: The message signature in chunk with offset=60 does not match the calculated signature
06-30 08:37:02.520: ERROR/WSBase(220):     at com.motorola.blur.service.blur.ws.WSBase.doRequest(WSBase.java:1285)
06-30 08:37:02.520: ERROR/WSBase(220):     at com.motorola.blur.service.blur.ws.WSBase$WSTransaction.run(WSBase.java:439)
06-30 08:37:02.520: ERROR/WSBase(220):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1081)
06-30 08:37:02.520: ERROR/WSBase(220):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:574)
06-30 08:37:02.520: ERROR/WSBase(220):     at java.lang.Thread.run(Thread.java:1020)
06-30 08:37:02.520: ERROR/WSBase(220):     at com.motorola.blur.util.concurrent.BlurThreadFactory$BlurPooledThread.run(BlurThreadFactory.java:58)
06-30 08:37:02.950: ERROR/WSBase(220): doRequest(): got exception: com.motorola.blur.service.blur.BlurBadSignatureException: com.motorola.blur.chunking.io.ChunkedInputStream$BadSignatureException: The message signature in chunk with offset=60 does not match the calculated signature
06-30 08:37:02.950: ERROR/WSBase(220):     at com.motorola.blur.service.blur.ws.WSBase.doRequest(WSBase.java:1285)
06-30 08:37:02.950: ERROR/WSBase(220):     at com.motorola.blur.service.blur.ws.WSBase$WSTransaction.run(WSBase.java:439)
06-30 08:37:02.950: ERROR/WSBase(220):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1081)
06-30 08:37:02.950: ERROR/WSBase(220):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:574)
06-30 08:37:02.950: ERROR/WSBase(220):     at java.lang.Thread.run(Thread.java:1020)
06-30 08:37:02.950: ERROR/WSBase(220):     at com.motorola.blur.util.concurrent.BlurThreadFactory$BlurPooledThread.run(BlurThreadFactory.java:58)
06-30 08:37:03.310: ERROR/WSBase(220): doRequest(): got exception: com.motorola.blur.service.blur.BlurBadSignatureException: com.motorola.blur.chunking.io.ChunkedInputStream$BadSignatureException: The message signature in chunk with offset=60 does not match the calculated signature
06-30 08:37:03.310: ERROR/WSBase(220):     at com.motorola.blur.service.blur.ws.WSBase.doRequest(WSBase.java:1285)
06-30 08:37:03.310: ERROR/WSBase(220):     at com.motorola.blur.service.blur.ws.WSBase$WSTransaction.run(WSBase.java:439)
06-30 08:37:03.310: ERROR/WSBase(220):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1081)
06-30 08:37:03.310: ERROR/WSBase(220):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:574)
06-30 08:37:03.310: ERROR/WSBase(220):     at java.lang.Thread.run(Thread.java:1020)
06-30 08:37:03.310: ERROR/WSBase(220):     at com.motorola.blur.util.concurrent.BlurThreadFactory$BlurPooledThread.run(BlurThreadFactory.java:58)
06-30 08:40:50.990: ERROR/GTalkService(257): ??? addConnectionClosedEvent: mConnectionUptime=0
06-30 08:41:35.640: ERROR/vending(407): [29] SelfUpdateCheckReceiver.getMarketMetadataBlocking(): Error trying to GetMarketMetadata on login
06-30 08:42:02.990: ERROR/WSBase(220): doRequest(): got exception: com.motorola.blur.service.blur.BlurBadSignatureException: com.motorola.blur.chunking.io.ChunkedInputStream$BadSignatureException: The message signature in chunk with offset=60 does not match the calculated signature
06-30 08:42:02.990: ERROR/WSBase(220):     at com.motorola.blur.service.blur.ws.WSBase.doRequest(WSBase.java:1285)
06-30 08:42:02.990: ERROR/WSBase(220):     at com.motorola.blur.service.blur.ws.WSBase$WSTransaction.run(WSBase.java:439)
06-30 08:42:02.990: ERROR/WSBase(220):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1081)
06-30 08:42:02.990: ERROR/WSBase(220):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:574)
06-30 08:42:02.990: ERROR/WSBase(220):     at java.lang.Thread.run(Thread.java:1020)
06-30 08:42:02.990: ERROR/WSBase(220):     at com.motorola.blur.util.concurrent.BlurThreadFactory$BlurPooledThread.run(BlurThreadFactory.java:58)
06-30 08:42:03.330: ERROR/WSBase(220): doRequest(): got exception: com.motorola.blur.service.blur.BlurBadSignatureException: com.motorola.blur.chunking.io.ChunkedInputStream$BadSignatureException: The message signature in chunk with offset=60 does not match the calculated signature
06-30 08:42:03.330: ERROR/WSBase(220):     at com.motorola.blur.service.blur.ws.WSBase.doRequest(WSBase.java:1285)
06-30 08:42:03.330: ERROR/WSBase(220):     at com.motorola.blur.service.blur.ws.WSBase$WSTransaction.run(WSBase.java:439)
06-30 08:42:03.330: ERROR/WSBase(220):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1081)
06-30 08:42:03.330: ERROR/WSBase(220):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:574)
06-30 08:42:03.330: ERROR/WSBase(220):     at java.lang.Thread.run(Thread.java:1020)
06-30 08:42:03.330: ERROR/WSBase(220):     at com.motorola.blur.util.concurrent.BlurThreadFactory$BlurPooledThread.run(BlurThreadFactory.java:58)
06-30 08:42:03.770: ERROR/WSBase(220): doRequest(): got exception: com.motorola.blur.service.blur.BlurBadSignatureException: com.motorola.blur.chunking.io.ChunkedInputStream$BadSignatureException: The message signature in chunk with offset=60 does not match the calculated signature
06-30 08:42:03.770: ERROR/WSBase(220):     at com.motorola.blur.service.blur.ws.WSBase.doRequest(WSBase.java:1285)
06-30 08:42:03.770: ERROR/WSBase(220):     at com.motorola.blur.service.blur.ws.WSBase$WSTransaction.run(WSBase.java:439)
06-30 08:42:03.770: ERROR/WSBase(220):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1081)
06-30 08:42:03.770: ERROR/WSBase(220):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:574)
06-30 08:42:03.770: ERROR/WSBase(220):     at java.lang.Thread.run(Thread.java:1020)
06-30 08:42:03.770: ERROR/WSBase(220):     at com.motorola.blur.util.concurrent.BlurThreadFactory$BlurPooledThread.run(BlurThreadFactory.java:58)
06-30 08:42:04.100: ERROR/WSBase(220): doRequest(): got exception: com.motorola.blur.service.blur.BlurBadSignatureException: com.motorola.blur.chunking.io.ChunkedInputStream$BadSignatureException: The message signature in chunk with offset=60 does not match the calculated signature
06-30 08:42:04.100: ERROR/WSBase(220):     at com.motorola.blur.service.blur.ws.WSBase.doRequest(WSBase.java:1285)
06-30 08:42:04.100: ERROR/WSBase(220):     at com.motorola.blur.service.blur.ws.WSBase$WSTransaction.run(WSBase.java:439)
06-30 08:42:04.100: ERROR/WSBase(220):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1081)
06-30 08:42:04.100: ERROR/WSBase(220):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:574)
06-30 08:42:04.100: ERROR/WSBase(220):     at java.lang.Thread.run(Thread.java:1020)
06-30 08:42:04.100: ERROR/WSBase(220):     at com.motorola.blur.util.concurrent.BlurThreadFactory$BlurPooledThread.run(BlurThreadFactory.java:58)
06-30 08:42:13.900: ERROR/TelephonyManager(257): Hidden constructor called more than once per process!
06-30 08:42:13.900: ERROR/TelephonyManager(257): Original: com.google.android.location, new: com.google.android.gsf
06-30 08:42:14.110: ERROR/CheckinTask(257): SSL error, attempting time correction: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
06-30 08:42:14.230: ERROR/CheckinTask(257): Checkin failed: https://android.clients.google.com/checkin (request #0)
06-30 08:42:14.230: ERROR/CheckinTask(257): java.io.IOException: Rejected response from server: HTTP/1.1 302 OK
06-30 08:42:14.230: ERROR/CheckinTask(257):     at com.google.android.gsf.checkin.CheckinTask.parseResponse(CheckinTask.java:345)
06-30 08:42:14.230: ERROR/CheckinTask(257):     at com.google.android.gsf.checkin.CheckinTask.maybeSetTime(CheckinTask.java:306)
06-30 08:42:14.230: ERROR/CheckinTask(257):     at com.google.android.gsf.checkin.CheckinTask.sendRequest(CheckinTask.java:289)
06-30 08:42:14.230: ERROR/CheckinTask(257):     at com.google.android.gsf.checkin.CheckinTask.doInBackground(CheckinTask.java:155)
06-30 08:42:14.230: ERROR/CheckinTask(257):     at com.google.android.gsf.checkin.CheckinService$1.doInBackground(CheckinService.java:234)
06-30 08:42:14.230: ERROR/CheckinTask(257):     at com.google.android.gsf.checkin.CheckinService$1.doInBackground(CheckinService.java:224)
06-30 08:42:14.230: ERROR/CheckinTask(257):     at android.os.AsyncTask$2.call(AsyncTask.java:252)
06-30 08:42:14.230: ERROR/CheckinTask(257):     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
06-30 08:42:14.230: ERROR/CheckinTask(257):     at java.util.concurrent.FutureTask.run(FutureTask.java:137)
06-30 08:42:14.230: ERROR/CheckinTask(257):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1081)
06-30 08:42:14.230: ERROR/CheckinTask(257):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:574)
06-30 08:42:14.230: ERROR/CheckinTask(257):     at java.lang.Thread.run(Thread.java:1020)
06-30 08:45:24.950: ERROR/GTalkService(257): ??? addConnectionClosedEvent: mConnectionUptime=0

对帖子的长度表示道歉,但我没有第一个线索,为什么这不起作用。 任何帮助将不胜感激。

6 个答案:

答案 0 :(得分:1)

您必须设置内容视图...否则将如何检索该布局?并且还以更好的方式处理异常处理......

答案 1 :(得分:0)

您应首先在setContentView()中调用onCreate()方法注册您的布局,然后调用findViewById()方法。

答案 2 :(得分:0)

 super.onCreate(savedInstanceState);

this.setContentView(R.layout.your_layout)

答案 3 :(得分:0)

您只是不设置内容,在ImageButton之前需要setContentView(R.layout.your_lauyout)

答案 4 :(得分:0)

正如其他朋友所说,你将方法setContentView(R.layout.xxxxx)添加到你的项目中。我想说的一件重要的事情是,在可疑方法周围放置try-catch块。这可能有助于您跟踪异常(如果有)。

答案 5 :(得分:0)

您正在调用两次 setContentView(R.layout.main); 此方法。

plz 删除setContentView(R.layout.main);从底部