Activity to Fragment Call in Android
Saturday, 25 February 2017
Sunday, 19 February 2017
How to call one Fragment to another Fragment in Android
Fragment to Fragment call
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(R.id.root_frame, new ProductFragment());
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
transaction.addToBackStack(null);
transaction.commit();
How to show Toast message in Android
This is how you can show an Android
Toast.makeText(getActivity(), "Click!", Toast.LENGTH_SHORT).show();
This is how you can show an Android
Toast message from a FragmentToast.makeText(getActivity(), "Click!", Toast.LENGTH_SHORT).show();
This is how you can show an Android
Toast message from a ActivityToast.makeText(getApplicationContext(),"This is an Android Toast Message", Toast.LENGTH_LONG).show();How to call one Activity to another Activity in Android
How to call one Activity to another Activity in Android
Intent intent = new Intent(getApplicationContext(), HomeActivity.class);
startActivity(intent);
startActivity(intent);
OR
Intent intent = new Intent(this, HomeActivity.class);
startActivity(intent);
startActivity(intent);
OR
Intent intent = new Intent(LoginActivity.this,HomeActivity.class);
startActivity(intent);
startActivity(intent);
OR
startActivity(new Intent(getApplicationContext(), HomeActivity.class));