Hallo ChampS,
nee ich hab das Filter nachher eingesetzt. Das funktioniert auch nicht ohne das. Der Witz ist ich poste mal einen anderen Versuch von mir. Da klappt es auf einmal ohne Fehlermeldung. Und ehrlich gesagt, fällt mir da kein unterschied zum anderen Code auf.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.svwinnenden"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".SecActivity"
android:label="@string/title_activity_sec" >
</activity>
<activity
android:name=".ThirdActivity"
android:label="@string/title_activity_third" >
</activity>
</application>
</manifest>
package com.example.svwinnenden;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class MainActivity extends Activity
{
EditText _user;
EditText _pwd;
Button _signIn;
EditText _msg;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
_user = (EditText)findViewById(R.id.user);
_pwd = (EditText)findViewById(R.id.pwd);
_signIn = (Button)findViewById(R.id.sign_in);
_msg = (EditText)findViewById(R.id.editText1);
}
public void onClickButton(View view)
{
String user = _user.getText().toString().toLowerCase();
String passwd = _pwd.getText().toString().toLowerCase();
if((user.equals("alex")) && (passwd.equals("alex")))
{
Intent intent = new Intent(this, SecActivity.class);
startActivity(intent);
}
else
{
if (!user.equals("alex"))
_msg.setText("Username is not correct !!!");
if (!passwd.equals("alex"))
_msg.setText("Password is not correct !!!");
}
}
public void onClickUser(View v)
{
if(v == _user)
{
_user.setText("");
}
}
public void onClickPwd(View v)
{
if(v == _pwd)
{
_pwd.setText("");
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
Alles anzeigen
Aufruf von meiner Main auf die zweite Activity tut.
package com.example.svwinnenden;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;
public class SecActivity extends Activity
{
public void btnClick(View v)
{
Intent intent = new Intent(this, ThirdActivity.class);
startActivity(intent);
}
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_sec);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.sec, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
Alles anzeigen
Aufruf von meiner secActivity auf die ThirdActivity tut auch.
Das Problem ist, ich kann mein anderes Programm so nicht fortsetzen