F
floflo1
Neues Mitglied
- 0
Hi
Ich habe habe angefangen mich in die Programmierung von Android Apps einzuarbeiten. Ich habe nun eine winzige App programmiert und auf meinem Nexus 5 installiert. Wenn ich sie nun starten möchte kommt diese Meldung:
"Hello World" wurde beendet
Die App habe ich mit diesem Bundle programmiert:
Android SDK | Android Developers
Die HelloWorld.java:
Die fragment_hello_world.xml:
Hier das HelloWorld Manifest:
Wie kann ich das fixen?
Ich habe habe angefangen mich in die Programmierung von Android Apps einzuarbeiten. Ich habe nun eine winzige App programmiert und auf meinem Nexus 5 installiert. Wenn ich sie nun starten möchte kommt diese Meldung:
"Hello World" wurde beendet
Die App habe ich mit diesem Bundle programmiert:
Android SDK | Android Developers
Die HelloWorld.java:
Code:
package ch.meinname.helloworld;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.ActionBar;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import android.os.Build;
public class HelloWorld extends ActionBarActivity implements OnClickListener {
public Button btn;
public TextView tw;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_hello_world);
btn = (Button)findViewById(R.id.BtnKlick);
tw = (TextView)findViewById(R.id.Text);
btn.setOnClickListener(this);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.hello_world, menu);
return true;
}
@Override
public void onClick(View arg0) {
tw.setText("Du hast mich gecklickt.");
}
}
Die fragment_hello_world.xml:
Code:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="ch.meinname.helloworld.HelloWorld$PlaceholderFragment" >
<Button
android:id="@+id/BtnKlick"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="41dp"
android:layout_marginTop="38dp"
android:text="Button" />
<TextView
android:id="@+id/Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/BtnKlick"
android:layout_below="@+id/BtnKlick"
android:layout_marginTop="26dp" />
</RelativeLayout>
Hier das HelloWorld Manifest:
Code:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ch.meinname.helloworld"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="ch.meinname.helloworld.HelloWorld"
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>
</manifest>
Wie kann ich das fixen?