馬上加入Android 台灣中文網,立即免費下載應用遊戲。
您需要 登錄 才可以下載或查看,沒有帳號?註冊
x
煩請大大幫忙,小弟是最近剛開始碰的超級新手,試著寫第一個程式,但是在ECLIPSE上DUBUG都沒有錯誤了,但是在模擬器上安裝完後,卻沒辦法開啟,開如何解決呢?是沒有正確呼叫到活動嗎?還是還有其他地方要注意的嗎?
APP project target: android 4.2.2 api17
使用的模擬器 : android 4.2.2 api17
LAYOUT 內容:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/textview1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/tv01" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/bt01" />
</LinearLayout>
JAVA程式內容:
package jeter.iza;
import com.Jeter.iza.*;
import android.os.Bundle;
import android.widget.Button;
import android.view.View;
import android.app.Activity;
import android.widget.TextView;
public class main_IZA extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final Button button1 = (Button)findViewById(R.id.button1);
final TextView textView1 = (TextView)findViewById(R.id.textview1);
button1.setOnClickListener(new Button.OnClickListener(){
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
textView1.setText("OK~!");
}
});
}
} |
|