Android Bus Service Project.
Download Source Code of Android Bus Service Project
LoginActivity.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
package com.booking.nirbhay.testapp2; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Typeface; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.RadioButton; import android.widget.TextView; import android.widget.Toast; import org.json.JSONException; import org.json.JSONObject; public class LoginActivity extends AppCompatActivity { Button loginbtn; TextView signupbtn; EditText mobile,password; AppController gObject; SessionManager session; SessionManagerLogin session1; SharedPreferences mpreferences; SharedPreferences.Editor settingDataPrefe; TextView logotext; Typeface fontCustome; String loginTypeUser="student"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.login); gObject =(AppController)getApplicationContext(); mpreferences = getSharedPreferences(String.format("%s_preferences", getPackageName()), Context.MODE_PRIVATE); settingDataPrefe = mpreferences.edit(); // session = new SessionManagerLogin(getApplicationContext()); session1 = new SessionManagerLogin(getApplicationContext()); fontCustome= Typeface.createFromAsset(getAssets(),"Raleway_Regular.ttf"); //TextView headername=(TextView)findViewById(R.id.headername); // headername.setText("Login"); mobile=(EditText)findViewById(R.id.EditText_email); password=(EditText)findViewById(R.id.EditText_password); loginbtn=(Button)findViewById(R.id.loginbtn); signupbtn=(TextView)findViewById(R.id.signupbtn); logotext=(TextView)findViewById(R.id.logotext); logotext.setTypeface(fontCustome); signupbtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { startActivity(new Intent(LoginActivity.this,SignupActivity.class)); } }); loginbtn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub if (v.getId() == R.id.loginbtn) { if (mobile.getText().toString().equalsIgnoreCase("")) { alertDisplay("Please enter your mobile number"); } else if (password.getText().toString().equalsIgnoreCase("")) { alertDisplay("Please enter password"); } else { // startActivity(new Intent(LoginActivity.this,StudentActivity.class)); // finish(); new LoginAsy(mobile.getText().toString(), password.getText().toString()).execute(); } } } }); /*if (session1.isLoggedIn()) { // Toast.makeText(getApplicationContext(), "User Login Status: " + session.isLoggedIn(), Toast.LENGTH_LONG).show(); HashMap<String, String> user = session1.getUserDetails(); String Mob = user.get(SessionManagerLogin.MOBILE); String Pas = user.get(SessionManagerLogin.PASS); mobile.setText(Mob); password.setText(Pas); new LoginAsy(mobile.getText().toString(), password.getText().toString()).execute(); }*/ } class LoginAsy extends AsyncTask<String, String, String> { String respo; ProgressDialog pd; String number, pass; // String ostype="ANDROID"; String token; LoginAsy(String mob, String pas) { number = mob; pass = pas; //token=regiToken; } @Override protected void onPreExecute() { pd = new ProgressDialog(LoginActivity.this); pd.setMessage("Please wait..."); pd.show(); } @Override protected String doInBackground(String... arg0) { //String url=AppController.baseURL+AppController.loginUserURL+"user_email=" + userName + "&user_password=" + password + "&token="+regiToken+""; String url = AppController.baseURL + AppController.loginUserURL + "mail="+number+ "&password="+pass+""; try { respo = CustomHttpClient.urlincoding(url); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } return respo; } @Override protected void onPostExecute(String result) { try { pd.dismiss(); JSONObject jObje = new JSONObject(result); JSONObject namObj = jObje.getJSONObject("response"); String st = namObj.getString("status"); String st1 = namObj.getString("message"); if (st.equals("1")) { String userID = namObj.getString("id"); String username = namObj.getString("name"); String useraddress = namObj.getString("aadress"); String mobile = namObj.getString("mobile"); String pass = namObj.getString("pass"); String mailStr = namObj.getString("email"); settingDataPrefe.putString("id", userID); settingDataPrefe.putString("name", username); settingDataPrefe.putString("aadress", useraddress); settingDataPrefe.putString("mobile", mobile); settingDataPrefe.putString("email", mailStr); settingDataPrefe.commit(); gObject.setUID(userID); gObject.setLoginSessionFlg(true); session1.createLoginSession(number, pass, true, userID); Intent i = new Intent(LoginActivity.this, MainActivity.class); startActivity(i); finish(); } else{ Toast.makeText(LoginActivity.this,"incorrect credentials ",Toast.LENGTH_LONG).show(); } } catch (JSONException e1) { } } } public void alertDisplay(String msg) { final Intent poke = new Intent(); poke.setClassName("com.android.settings", "com.android.settings.widget.SettingsAppWidgetProvider"); poke.addCategory(Intent.CATEGORY_ALTERNATIVE); poke.setData(Uri.parse("3")); sendBroadcast(poke); if (!isFinishing()) { new android.app.AlertDialog.Builder(LoginActivity.this) //.setTitle("KartBuddy") .setMessage(msg) .setCancelable(false) .setPositiveButton("ok", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }).show(); } } } |
MainActivity.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
package com.booking.nirbhay.testapp2; import android.app.Fragment; import android.app.FragmentManager; import android.app.FragmentTransaction; import android.graphics.Color; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.LinearLayout; import com.booking.nirbhay.testapp2.frgmsnts.ListOfBus; import com.booking.nirbhay.testapp2.frgmsnts.PakegTour; import com.booking.nirbhay.testapp2.frgmsnts.Profile; public class MainActivity extends AppCompatActivity { LinearLayout home,profile,busList; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); home=(LinearLayout)findViewById(R.id.home); profile=(LinearLayout)findViewById(R.id.profile); busList=(LinearLayout)findViewById(R.id.busList); home.setBackgroundColor(Color.parseColor("#aeaeae")); home.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { home.setBackgroundColor(Color.parseColor("#aeaeae")); profile.setBackgroundColor(Color.parseColor("#dddddd")); busList.setBackgroundColor(Color.parseColor("#dddddd")); Fragment fObje=new ListOfBus(); callFragment(fObje); } }); profile.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { home.setBackgroundColor(Color.parseColor("#dddddd")); profile.setBackgroundColor(Color.parseColor("#aeaeae")); busList.setBackgroundColor(Color.parseColor("#dddddd")); Fragment fObje=new Profile(); callFragmentWithBack(fObje,"pro"); } }); busList.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { home.setBackgroundColor(Color.parseColor("#dddddd")); profile.setBackgroundColor(Color.parseColor("#dddddd")); busList.setBackgroundColor(Color.parseColor("#aeaeae")); Fragment fObje=new PakegTour(); callFragmentWithBack(fObje,"pk"); } }); Fragment fObje=new ListOfBus(); callFragment(fObje); } public void callFragment(Fragment callFrag) { FragmentManager req_mnt=getFragmentManager(); FragmentTransaction req_transion=req_mnt.beginTransaction(); req_transion.replace(R.id.content_frame, callFrag); req_transion.commit(); } public void callFragmentWithBack(Fragment callFrag,String bk) { FragmentManager req_mnt=getFragmentManager(); FragmentTransaction req_transion=req_mnt.beginTransaction().addToBackStack(bk); req_transion.replace(R.id.content_frame, callFrag); req_transion.commit(); } } |
SearchBusActivity.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
package com.booking.nirbhay.testapp2; import android.app.ProgressDialog; import android.os.AsyncTask; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.View; import android.widget.TextView; import org.json.JSONArray; import org.json.JSONObject; import java.util.ArrayList; public class SearchBusActivity extends AppCompatActivity { private RecyclerView mRecyclerView; private RecyclerView.Adapter mAdapter; private RecyclerView.LayoutManager mLayoutManager; AppController obj; ArrayList results; ArrayList<String> vIDList=new ArrayList<String>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.myoderhitorylist); obj = (AppController) getApplicationContext(); TextView headername=(TextView)findViewById(R.id.headername); headername.setText("Bus List"); mRecyclerView = (RecyclerView)findViewById(R.id.orderhtry); mRecyclerView.setHasFixedSize(true); mLayoutManager = new LinearLayoutManager(SearchBusActivity.this); mRecyclerView.setLayoutManager(mLayoutManager); new MyOderList().execute(); } class MyOderList extends AsyncTask<String,String,String> { String req; ProgressDialog pd; String _sid; @Override protected void onPreExecute() { pd=new ProgressDialog(SearchBusActivity.this); pd.setMessage("Please wait...."); pd.show(); } @Override protected String doInBackground(String... params) { String cateUrl= AppController.baseURL+AppController.getBusDeatils; try { req= CustomHttpClient.urlincoding(cateUrl); } catch (Exception e) { e.printStackTrace(); } return req; } @Override protected void onPostExecute(String s) { try { pd.dismiss(); JSONObject jObjetc = new JSONObject(s); JSONObject jsonObjectSub = jObjetc.getJSONObject("response"); String flg = jsonObjectSub.getString("status"); results = new ArrayList<BusModel>(); // String flag=jObjetc.getString("status"); if (flg.equals("1")) { JSONArray jArrObject = jsonObjectSub.getJSONArray("data"); for (int i = 0; i < jArrObject.length(); i++) { // item2 = new RowItems_Banner(); JSONObject jIndexObject = jArrObject.getJSONObject(i); vIDList.add(jIndexObject.getString("bus_id")); BusModel obj = new BusModel( jIndexObject.getString("bus_id"), jIndexObject.getString("bus_name"), jIndexObject.getString("bus_number"), jIndexObject.getString("totalSeats"), jIndexObject.getString("route_id"), jIndexObject.getString("bus_source"), jIndexObject.getString("bus_dest"), jIndexObject.getString("bus_pickup"), jIndexObject.getString("source_time"), jIndexObject.getString("des_time")); results.add(i, obj); } mAdapter = new BusListRowAdapter(SearchBusActivity.this,results,getFragmentManager()); mRecyclerView.setAdapter(mAdapter); ((BusListRowAdapter) mAdapter).setOnItemClickListener(new BusListRowAdapter .MyClickListener() { @Override public void onItemClick(int position, View v) { Log.i("tags Greens", " Clicked on Item " + position); // String vID=vIDList.get(position); // gObject.setvID(vID); // // gObject.setVendorName("Vendor List"); // Fragment vendorFrgObject=new ProdcutsFragment(); // oprnList(vendorFrgObject); // Toast.makeText(getActivity(),"click----"+position,Toast.LENGTH_LONG).show(); } }); } } catch (Exception e) { e.printStackTrace(); } } } } |
SessionManager.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
package com.booking.nirbhay.testapp2; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import java.util.HashMap; public class SessionManager { // Shared Preferences SharedPreferences pref; // Editor for Shared preferences Editor editor; // Context Context _context; // Shared pref mode int PRIVATE_MODE = 0; // Sharedpref file name private static final String PREF_NAME = "ikarsession"; // All Shared Preferences Keys private static final String IS_LOGIN = "IsLoggedIn"; // User name (make variable public to access from outside) public static final String MOBILE = "mobile"; // Email address (make variable public to access from outside) public static final String PASS = "pass"; // Constructor public SessionManager(Context context){ this._context = context; pref = _context.getSharedPreferences(PREF_NAME, PRIVATE_MODE); editor = pref.edit(); } /** * Create login session * */ public void createLoginSession(String name, String email, boolean fl, String Uid){ // Storing login value as TRUE editor.putBoolean(IS_LOGIN, fl); // Storing name in pref editor.putString(MOBILE, name); editor.putString("UID",Uid); // Storing email in pref editor.putString(PASS, email); // commit changes editor.commit(); } /** * Check login method wil check user login status * If false it will redirect user to login page * Else won't do anything * */ public void checkLogin(){ // Check login status if(!this.isLoggedIn()){ // user is not logged in redirect him to Login Activity Intent i = new Intent(_context, LoginActivity.class); // Closing all the Activities i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); // Add new Flag to start new Activity i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // Staring Login Activity _context.startActivity(i); } } public String getU() { String strUid=pref.getString("UID","0"); return strUid; } /** * Get stored session data * */ public HashMap<String, String> getUserDetails(){ HashMap<String, String> user = new HashMap<String, String>(); // user name user.put(MOBILE, pref.getString(MOBILE, null)); // user email id user.put(PASS, pref.getString(PASS, null)); // return user return user; } /** * Clear session details * */ public void logoutUser(){ // Clearing all data from Shared Preferences editor.clear(); editor.commit(); /*// After logout redirect user to Loing Activity Intent i = new Intent(_context, LoginActivity.class); // Closing all the Activities i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); // Add new Flag to start new Activity i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // Staring Login Activity _context.startActivity(i);*/ Intent intent = new Intent(_context, LoginActivity.class); intent.putExtra("finish", true); // if you are checking for this in your other Activities intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); _context. startActivity(intent); // _context.finish(); } /** * Quick check for login * **/ // Get Login State public boolean isLoggedIn(){ return pref.getBoolean(IS_LOGIN, false); } } |
SessionManagerLogin.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
package com.booking.nirbhay.testapp2; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import java.util.HashMap; public class SessionManagerLogin { // Shared Preferences SharedPreferences pref; // Editor for Shared preferences Editor editor; // Context Context _context; // Shared pref mode int PRIVATE_MODE = 0; // Sharedpref file name private static final String PREF_NAME = "ikarsession"; // All Shared Preferences Keys private static final String IS_LOGIN = "IsLoggedIn"; // User name (make variable public to access from outside) public static final String MOBILE = "mobile"; // Email address (make variable public to access from outside) public static final String PASS = "pass"; // Constructor public SessionManagerLogin(Context context){ this._context = context; pref = _context.getSharedPreferences(PREF_NAME, PRIVATE_MODE); editor = pref.edit(); } /** * Create login session * */ public void createLoginSession(String name, String email, boolean fl, String Uid){ // Storing login value as TRUE editor.putBoolean(IS_LOGIN, fl); // Storing name in pref editor.putString(MOBILE, name); editor.putString("UID",Uid); // Storing email in pref editor.putString(PASS, email); // commit changes editor.commit(); } /** * Check login method wil check user login status * If false it will redirect user to login page * Else won't do anything * */ public void checkLogin(){ // Check login status if(!this.isLoggedIn()){ // user is not logged in redirect him to Login Activity Intent i = new Intent(_context, LoginActivity.class); // Closing all the Activities i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); // Add new Flag to start new Activity i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // Staring Login Activity _context.startActivity(i); } } public String getU() { String strUid=pref.getString("UID","0"); return strUid; } /** * Get stored session data * */ public HashMap<String, String> getUserDetails(){ HashMap<String, String> user = new HashMap<String, String>(); // user name user.put(MOBILE, pref.getString(MOBILE, null)); // user email id user.put(PASS, pref.getString(PASS, null)); // return user return user; } /** * Clear session details * */ public void logoutUser(){ // Clearing all data from Shared Preferences editor.clear(); editor.commit(); /*// After logout redirect user to Loing Activity Intent i = new Intent(_context, LoginActivity.class); // Closing all the Activities i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); // Add new Flag to start new Activity i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); // Staring Login Activity _context.startActivity(i);*/ Intent intent = new Intent(_context, LoginActivity.class); intent.putExtra("finish", true); // if you are checking for this in your other Activities intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); _context. startActivity(intent); // _context.finish(); } /** * Quick check for login * **/ // Get Login State public boolean isLoggedIn(){ return pref.getBoolean(IS_LOGIN, false); } } |
SignupActivity.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
package com.booking.nirbhay.testapp2; import android.app.ProgressDialog; import android.content.Intent; import android.graphics.Typeface; import android.os.AsyncTask; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import org.json.JSONObject; import java.util.ArrayList; public class SignupActivity extends AppCompatActivity { EditText name,number,pass,address,mailId; Button submit; ProgressDialog pd; String jRespons; TextView logotext; Typeface fontCustome; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.signup); /*TextView headername=(TextView)findViewById(R.id.headername); headername.setText("Signup"); */ fontCustome= Typeface.createFromAsset(getAssets(),"Raleway_Regular.ttf"); logotext=(TextView)findViewById(R.id.logotext); logotext.setTypeface(fontCustome); name=(EditText)findViewById(R.id.name); number=(EditText)findViewById(R.id.number); pass=(EditText)findViewById(R.id.pass); address=(EditText)findViewById(R.id.address); mailId=(EditText)findViewById(R.id.mailId); submit=(Button)findViewById(R.id.submit); submit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (name.getText().toString().equalsIgnoreCase("")) { name.setError("Please Enter name"); } else if (number.getText().toString().equalsIgnoreCase("")) { number.setError("Please enter Mobile Number"); } else if (pass.getText().toString().equalsIgnoreCase("")) { pass.setError("Please enter password"); } else if (address.getText().toString().equalsIgnoreCase("")) { address.setError("Please enter Address"); } else if (mailId.getText().toString().equalsIgnoreCase("")) { address.setError("Please enter Mail Id"); } else { new SignUp(name.getText().toString(),number.getText().toString(), pass.getText().toString(),address.getText().toString(),mailId.getText().toString()).execute(); } } }); } class SignUp extends AsyncTask<String,String,String> { String tempName; String tempnumber; String tempPass; String tempaddress; String tempMail; SignUp(String nam, String mob, String pas, String addr,String mail) { tempName=nam; tempnumber=mob; tempPass=pas; tempaddress=addr; tempMail=mail; } @Override protected void onPreExecute() { super.onPreExecute(); pd=new ProgressDialog(SignupActivity.this); pd.setMessage("Please wait..."); pd.show(); } @Override protected String doInBackground(String... params) { try { ArrayList<NameValuePair> nameValuePair = new ArrayList<NameValuePair>(); nameValuePair.add(new BasicNameValuePair("name", tempName)); nameValuePair.add(new BasicNameValuePair("mobile", tempnumber)); nameValuePair.add(new BasicNameValuePair("pass", tempPass)); nameValuePair.add(new BasicNameValuePair("address", tempaddress)); nameValuePair.add(new BasicNameValuePair("mail", tempMail)); jRespons = CustomHttpClient.executeHttpPost(AppController.baseURL +AppController.singupUserURL, nameValuePair); }catch (Exception e) { e.printStackTrace(); } return jRespons; } @Override protected void onPostExecute(String s) { super.onPostExecute(s); pd.dismiss(); try{ JSONObject jobj=new JSONObject(s); JSONObject jName=jobj.getJSONObject("response"); String flg=jName.getString("status"); String msg=jName.getString("message"); if(flg.equals("1")) { //alertDisplay("Registration successful"); Toast.makeText(SignupActivity.this,""+msg,Toast.LENGTH_SHORT).show(); Intent i = new Intent(SignupActivity.this, LoginActivity.class); startActivity(i); finish(); } else { // alertDisplay("Registration not successful"); Toast.makeText(SignupActivity.this,""+msg,Toast.LENGTH_SHORT).show(); } }catch (Exception e) { e.printStackTrace(); } } } } |
SplsActivity.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
package com.booking.nirbhay.testapp2; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.support.v7.app.AppCompatActivity; public class SplsActivity extends AppCompatActivity { private final int SPLASH_DISPLAY_LENGHT = 3000; Handler myHandler; Runnable myRunnable; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.spl); myHandler = new Handler(); myRunnable = new Runnable() { public void run() { //Some interesting task Intent mainIntent = new Intent(SplsActivity.this, LoginActivity.class); startActivity(mainIntent); finish(); } }; myHandler.postDelayed(myRunnable, SPLASH_DISPLAY_LENGHT); } } |
bus pass android project, College bus management system project in android,
bus ticket reservation system project in android,
bus pass system project in android, school bus management system project in android, University students and employee bus management system project in android