-4
我是新的android應用程序開發...我所做的是創建一個應用程序,添加一個計數器文本添加按鈕被點擊和子文本subb按鈕是點擊。請指出我的錯誤線程退出與未捕獲的異常(組= 0x4001d800)
startingpoint.java`
package vignesh.pandian.app;
import android.os.Bundle;
import android.app.Activity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
public class Startingpoint extends Activity {
int counter;
Button add, subb;
TextView displ;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_startingpoint);
counter=0;
add = (Button) findViewById(R.id.add);
subb =(Button) findViewById(R.id.bSub);
displ =(Button) findViewById(R.id.tex);
add.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
counter++;
displ.setText("value is "+counter);
}
});
subb.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
counter--;
displ.setText("value is"+counter);
}
});
}
}
activity_startingpoint.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<Button
android:id="@+id/add"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:text="Add one " />
<TextView
android:id="@+id/My"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="15dp"
android:text="Vignesh's app !!!!"
tools:context=".Startingpoint" />
<TextView
android:id="@+id/tex"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_marginTop="35dp"
android:text="Value is"
android:textSize="35dp"
tools:context=".Startingpoint" />
<Button
android:id="@+id/bSub"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/add"
android:layout_marginTop="37dp"
android:text="Subract one " />
</RelativeLayout>
請給我們例外的完整堆棧跟蹤 – 2013-03-27 06:04:38
發佈您的logcat – 2013-03-27 06:06:05
您的問題解決了嗎? – rajeshwaran 2013-03-27 06:44:49