私のアプリケーションは動作しませんが、開発にエラーメッセージは表示されません。 私のページを別のページにリンクする方法を学んでいます。Android eclipse。アプリケーションを実行しているときにエラーが発生しました
TMactivityページ1
public class TmActivity extends Activity {
private ImageButton NewPage;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.setContentView(R.layout.main);
this.NewPage = (ImageButton)this.findViewById(R.id.widget38);
this.NewPage.setOnClickListener(new OnClickListener() {
public void onClick(View WebView) {
Intent i = new Intent(TmActivity.this, New.class);
startActivity(i);
}
});
}
}
// 2ページ:
public class WebView extends Activity {
public class New extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.web);
}
}
}
//最初のxml:
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout
android:id="@+id/widget0"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android">
<ImageButton
android:id="@+id/widget37"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#FFFFFF"
android:layout_x="4dp"
android:layout_y="387dp" />
<ImageButton
android:id="@+id/widget38"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="69dp"
android:layout_y="386dp" />
<ImageButton
android:id="@+id/widget39"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="151dp"
android:layout_y="386dp" />
<ImageButton
android:id="@+id/widget40"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="242dp"
android:layout_y="383dp" />
<TextView
android:id="@+id/widget43"
android:layout_width="wrap_content"
android:layout_height="47px"
android:background="#FF0000"
android:text="Teknikmagasinet"
android:textSize="20sp"
android:typeface="sans"
android:textStyle="bold"
android:textColor="#FFFF00"
android:layout_x="74dp"
android:layout_y="11dp" />
<TextView
android:id="@+id/widget44"
android:layout_width="203px"
android:layout_height="30px"
android:text="nyheter"
android:textColor="#FFFF00"
android:layout_x="34dp"
android:layout_y="77dp" />
<ImageView
android:id="@+id/widget45"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#ff33cc00"
android:layout_x="44dp"
android:layout_y="143dp" />
<TextView
android:id="@+id/widget46"
android:layout_width="wrap_content"
android:layout_height="47px"
android:background="#ffcc6600"
android:text=" emil bergstrlm han är kung "
android:hint="phuong"
android:layout_x="13dp"
android:layout_y="255dp" />
</AbsoluteLayout>
// 2番目のxml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
package="tm.com"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
/>
<ImageButton
android:id="@+id/widget38"
android:layout_width="150dp"
android:layout_height="wrap_content" />
<Button
android:text="Second Page"
android:id="@+id/close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"></Button>
</LinearLayout>
sting xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="hello">Hello World, TmActivity!</string>
<string name="app_name">Tm.com</string>
<string name="main_title">My Main Title</string>
</resources>
ありがとうございました!
コードの代わりに、エラーログを送信する必要があります。 –
あなたの活動をあなたのmanifest.xmlファイルに登録するのを忘れたと思います。 –
open terminalに 'adb locat'と入力してエラーを見つけてください(エラーは" E/"で始まります)。ターミナルを開いて 'adb logcat'と入力して、アプリケーションを起動しようとすると(ターミナルが開いている)、エラーの発生場所を見ることができます。 –