このサイトを使用して、Android/Eclipse の問題を修正しています。しかし、この瞬間、私は非常に立ち往生しており、この問題に関するほぼすべてのスレッドを検索しましたが、解決策が見つかりませんでした.
検証が成功した後、あるアクティビティから別のアクティビティに移動したいのは簡単です.Android saripaarを使用して、logcatでランタイムエラーが発生するまですべてがうまくいきました.エラーは
07-20 23:10:59.312: E/AndroidRuntime(2562): android.content.ActivityNotFoundException: 明示的なアクティビティ クラス {com.example.projectcandy/android.view.Menu} が見つかりません。AndroidManifest.xml でこのアクティビティを宣言しましたか?
特別にご確認ください
{com.example.projectcandy/android.view.Menu}
com.example.projectcandy は私のパッケージで、私のクラスはメニューです。しかし、ログの猫が「Android.view」を表示するのはなぜですか?
私はこれまでに何をしてきましたか?
1) マニフェストにフィルター行を挿入する 2) プロジェクトをクリーンアップする 3) マニフェストからアクティビティを削除し、アプリケーション ノード > 追加などを使用して再度追加します。 4) インテントの作成方法を変更します。本当に私は何をすべきかわからない
マニフェスト、MainActivity.java、および「Menu.class」をここに投稿しています
マニフェスト
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.projectcandy"
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="com.example.projectcandy.MainActivity"
android:label="@string/app_name" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".Menu">
<intent-filter>
<action android:name="com.example.projectcandy.Menu" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
mainactivity.java からのメソッドの作成時
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
validator = new Validator(this);
validator.setValidationListener(this);
usernamereg=(EditText)findViewById(R.id.usernamereg);
password=(EditText)findViewById(R.id.password);
Loginb=(Button)findViewById(R.id.Loginb);
Loginb.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
validator.validate();
}
});
onValidationSucceeded メソッド (android saripaar ライブラリから)
@Override
public void onValidationSucceeded() {
// TODO Auto-generated method stub
Toast.makeText(this, "Iniciando sesion...", Toast.LENGTH_SHORT).show();
String user= usernamereg.getText().toString();
String psw= password.getText().toString();
if (user.equals("admin") && psw.equals("1234")){
Intent i = new Intent(this, Menu.class );
startActivity(i);
}
else {
Toast t= Toast.makeText(this,"Usuario o contraseña incorrectos", Toast.LENGTH_SHORT);
t.show();
}
}
たぶん、オンクリッククラスのパラメーターに何か問題があります。みんな、ありがとう