I want to call Intent in a static parameterized method and wants to start new activity from there. I'm using a mathod call named as zodiacSign in my MainActivity with two parameters, it works and throw a call to another activity HoroscopeFinder. During its working I want to open a new activity form HoroscopeFinder. If someone knows please help. my code is given below:
MainActivity Code
dateSetListener=new DatePickerDialog.OnDateSetListener(){ @Override public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) { //code month=month+1; String date= dayOfMonth+"/"+month+"/"+year; datePicker.setText(date); //from here we can get day and month String getDay= String.valueOf(dayOfMonth); getDayInt=Integer.parseInt(getDay); String getMonth= String.valueOf(month); getMonthInt=Integer.parseInt(getMonth); //method call for deduct sign using DOB zodiacSign(getDayInt, getMonthInt);} HoroscopeFinder class code
public class HoroscopeFinder { static String astroSign=""; public static void zodiacSign(int day, int month) { //Toast.makeText(, "here done", Toast.LENGTH_LONG).show(); //Log.i("check", "done here...!"); if ((month == 12 && day >= 22 && day <= 31) || (month == 1 && day >= 1 && day <= 19)) { astroSign="Capricorn"; } else if ((month == 1 && day >= 20 && day <= 31) || (month == 2 && day >= 1 && day <= 17)) { astroSign="Aquarius"; //astro_sign="Aquarius"; } else if ((month == 2 && day >= 18 && day <= 29) || (month == 3 && day >= 1 && day <= 19)) { astroSign="Pisces"; } else ((month == 3 && day >= 20 && day <= 31) || (month == 4 && day >= 1 && day <= 19)) { astroSign="Aries"; Intent intent=new Intent(this, AriesActivity.class); startActivity(intent); }