No Activity found to handle Intent { act=com.application.activity.MainActivity }
boolean didItWork=true;
String editid = id.getText().toString();
String editpass = pass.getText().toString();
didItWork = Verif(editid,editpass);//Verif is a method to compare the entry text in the editText with the value found in the database
if (didItWork)
{
Intent i = new Intent("com.application.activity.MainActivity");
startActivity(i);
}
else {
Dialog d = new Dialog(this);
d.setTitle("Error!");
TextView tv = new TextView(this);
tv.setText("Error ");
d.setContentView(tv);
d.show();
}
break;
case R.id.bcancel:
break;
}
}
public boolean Verif(String editid,String editpass){
boolean verif = false ;
double id =Double.parseDouble(editid);
double pass =Double.parseDouble(editpass);
for(int i=0; i<tabid.size(); i++)
{
if ((id == tabid.get(i)) &&(pass == tabpass.get(i)))
{
verif = true;
break;
}
}
return verif;
}
}
package com.application.login;
import java.util.ArrayList;
import android.app.Activity;
import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import com.application.activity.R;
public class Login extends Activity implements View.OnClickListener{
ArrayList<Integer> tabid = new ArrayList <Integer>();
ArrayList <Double> tabpass = new ArrayList <Double>();
Button login;
Button cancel;
EditText id;
EditText pass;
int n= tabid.size();
int m= tabpass.size();
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.login);
DatabaseLogin db = new DatabaseLogin(this);
db.open();
tabid = db.getIdentifiant();//tableau contient tout les identifiant
tabpass = db.getPassword();//tableau contient tout les mot de passe
initialize();
login.setOnClickListener(this);
cancel.setOnClickListener(this);
db.close();
}
private void initialize() {
// TODO Auto-generated method stub
login =(Button) findViewById(R.id.blogin);
cancel =(Button) findViewById(R.id.bcancel);
id = (EditText) findViewById(R.id.edtid);
pass = (EditText) findViewById(R.id.edtpassword);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch(v.getId())
{
case R.id.blogin:
boolean didItWork=true;
String editid = id.getText().toString();
String editpass = pass.getText().toString();
didItWork = Verif(editid,editpass);//Verif is a method to compare the entry text in the editText with the value found in the database
if (didItWork)
{
Intent i = new Intent("com.application.activity.MainActivity");
startActivity(i);
}
else {
Dialog d = new Dialog(this);
d.setTitle("Error!");
TextView tv = new TextView(this);
tv.setText("Error ");
d.setContentView(tv);
d.show();
}
break;
case R.id.bcancel:
break;
}
}
public boolean Verif(String editid,String editpass){
boolean verif = false ;
double id =Double.parseDouble(editid);
double pass =Double.parseDouble(editpass);
for(int i=0; i<tabid.size(); i++)
{
if ((id == tabid.get(i)) &&(pass == tabpass.get(i)))
{
verif = true;
break;
}
}
return verif;
}
}
The Logcat display :
07-24 12:26:29.783: E/AndroidRuntime(716): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.application.activity.MainActivity } µÚ2Ò³
<activity
android:name="com.application.activity.MainActivity"
android:label="@string/app_name"
>
<intent-filter>
<action android:name="com.application.activity.MainActivity" />
&nb