2019-03-13 16:12:57.628 1285-1285/com.example.tt E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.tt, PID: 1285 android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.tt/com.example.tt.RegisterActivity}; have you declared this activity in your AndroidManifest.xml? at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:2005) at android.app.Instrumentation.execStartActivity(Instrumentation.java:1673) at android.app.Activity.startActivityForResult(Activity.java:4586) at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:767) at android.app.Activity.startActivityForResult(Activity.java:4544) at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:754) at android.app.Activity.startActivity(Activity.java:4905) at android.app.Activity.startActivity(Activity.java:4873) at com.example.tt.MainActivity$1.onClick(MainActivity.java:54) at android.view.View.performClick(View.java:6597) at android.view.View.performClickInternal(View.java:6574) at android.view.View.access$3100(View.java:778) at android.view.View$PerformClick.run(View.java:25885) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
public class MainActivity extends AppCompatActivity implements View.OnClickListener { TextView tv1, edit3; Typeface s1, ed1, ed2; EditText edt1, edt2; Button btn; final String TAG = "MainActivity"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tv1 = (TextView) findViewById(R.id.kirov_state); edt1 = (EditText) findViewById(R.id.edtt1); edt2 = (EditText) findViewById(R.id.edtt2); btn = (Button) findViewById(R.id.Login); btn.setOnClickListener(this); ed1 = Typeface.createFromAsset(getAssets(), "Raleway-Thin.ttf"); ed2 = Typeface.createFromAsset(getAssets(), "Raleway-Thin.ttf"); s1 = Typeface.createFromAsset(getAssets(), "Raleway-Regular.ttf"); tv1.setTypeface(s1); edt1.setTypeface(ed1); edt2.setTypeface(ed2); Typeface btn1 = Typeface.createFromAsset(getAssets(), "Raleway-Thin.ttf"); btn.setTypeface(btn1); edit3 = (TextView) findViewById(R.id.registt); edit3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent in = new Intent(getApplicationContext(), RegisterActivity.class); startActivity(in); } }); } private boolean emptyValidate(EditText edt2, EditText edt1){ String user = edt2.getText().toString(); String password = edt1.getText().toString(); return (user.isEmpty() && password.isEmpty()); } String password = ""; public void onClick(View v) { final String user = edt2.getText().toString(); password = MD5.encrypt(edt1.getText().toString()); HashMap<String, String> loginData = new HashMap<>(); loginData.put("user", user); loginData.put("password", password); PostResponseAsyncTask loginTask = new PostResponseAsyncTask(this, loginData, new AsyncResponse() { @Override public void processFinish(String s) { Log.d(TAG, s); if(s.contains("LoginSuccess")){ SharedPreferences pref = getSharedPreferences("loginData", MODE_PRIVATE); SharedPreferences.Editor editor = pref.edit(); editor.putString("user", user); editor.putString("password", password); editor.commit(); Intent in = new Intent(getApplicationContext(),Main2Activity.class); startActivity(in); } else{ Toast.makeText(getApplicationContext(), "Something went wrong. Cannot login.", Toast.LENGTH_LONG).show(); } } }); loginTask.setExceptionHandler(new ExceptionHandler() { @Override public void handleException(Exception e) { if(e != null && e.getMessage() != null){ Log.d(TAG, e.getMessage()); } } }); loginTask.execute("http://recognized-vessel.000webhostapp.com/login.php"); } }