I am trying to do that when user is successfully login then it go to firstActivity.class and show message("Welcome"). But if User is failed to login then Toast message Show in Another secondActivity?
BlankFragment:
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View v = inflater.inflate(R.layout.fragment_blank, container, false);
button = (Button)v.findViewById(R.id.btn);
textview1 = (TextView)v.findViewById(R.id.tv1);
textView2 = (TextView)v.findViewById(R.id.tv2);
editText1 = (EditText)v.findViewById(R.id.ed1);
editText2 = (EditText)v.findViewById(R.id.ed2);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(editText1.getText().toString().equalsIgnoreCase(editText2.getText().toString())){
Intent intent = new Intent(getContext(),FirstActivity.class);
startActivity(intent);
}else{
Note->(How to show this toast message in secondActivity??)
Toast toast = Toast.makeText(getContext() , "UserName or Password invalid" , Toast.LENGTH_SHORT);
toast.show();
}
}
});
return v;
}
}
SecondActivity:
?????