Java Code Examples for com.google.firebase.database.Query#addListenerForSingleValueEvent()
The following examples show how to use
com.google.firebase.database.Query#addListenerForSingleValueEvent() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PostInteractor.java From social-app-android with Apache License 2.0 | 6 votes |
public void getPostListByUser(final OnDataChangedListener<Post> onDataChangedListener, String userId) { DatabaseReference databaseReference = databaseHelper.getDatabaseReference().child(DatabaseHelper.POSTS_DB_KEY); Query postsQuery; postsQuery = databaseReference.orderByChild("authorId").equalTo(userId); postsQuery.keepSynced(true); postsQuery.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { PostListResult result = parsePostList((Map<String, Object>) dataSnapshot.getValue()); onDataChangedListener.onListChanged(result.getPosts()); } @Override public void onCancelled(DatabaseError databaseError) { LogUtil.logError(TAG, "getPostListByUser(), onCancelled", new Exception(databaseError.getMessage())); } }); }
Example 2
Source File: GeoQuery.java From geofire-android with Apache License 2.0 | 6 votes |
private void addValueToReadyListener(final Query firebase, final GeoHashQuery query) { firebase.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { synchronized (GeoQuery.this) { GeoQuery.this.outstandingQueries.remove(query); GeoQuery.this.checkAndFireReady(); } } @Override public void onCancelled(@NonNull final DatabaseError databaseError) { synchronized (GeoQuery.this) { for (final GeoQueryDataEventListener listener : GeoQuery.this.eventListeners) { GeoQuery.this.geoFire.raiseEvent(new Runnable() { @Override public void run() { listener.onGeoQueryError(databaseError); } }); } } } }); }
Example 3
Source File: GeoQuery.java From geofire-java with MIT License | 6 votes |
private void addValueToReadyListener(final Query firebase, final GeoHashQuery query) { firebase.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { synchronized (GeoQuery.this) { GeoQuery.this.outstandingQueries.remove(query); GeoQuery.this.checkAndFireReady(); } } @Override public void onCancelled(final DatabaseError databaseError) { synchronized (GeoQuery.this) { for (final GeoQueryDataEventListener listener : GeoQuery.this.eventListeners) { GeoQuery.this.geoFire.raiseEvent(new Runnable() { @Override public void run() { listener.onGeoQueryError(databaseError); } }); } } } }); }
Example 4
Source File: patientsFragment.java From Doctorave with MIT License | 6 votes |
@Override public void onLoadFinished(Loader<Cursor> loader, final Cursor data) { adapter.swapCursor(data); if(data.getCount() == 0){ Query hekkQuery = mDatabaseReference; hekkQuery.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { if(doctorPreference.getWantToRestoreData(getActivity())){ if(dataSnapshot.getChildrenCount() == 0){ }else { showAlertToRestoreData(dataSnapshot.getChildrenCount()); } } } @Override public void onCancelled(DatabaseError databaseError) { } }); } }
Example 5
Source File: PostInteractor.java From social-app-android with Apache License 2.0 | 6 votes |
public void getPostListByUser(final OnDataChangedListener<Post> onDataChangedListener, String userId) { DatabaseReference databaseReference = databaseHelper.getDatabaseReference().child(DatabaseHelper.POSTS_DB_KEY); Query postsQuery; postsQuery = databaseReference.orderByChild("authorId").equalTo(userId); postsQuery.keepSynced(true); postsQuery.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { PostListResult result = parsePostList((Map<String, Object>) dataSnapshot.getValue()); onDataChangedListener.onListChanged(result.getPosts()); } @Override public void onCancelled(DatabaseError databaseError) { LogUtil.logError(TAG, "getPostListByUser(), onCancelled", new Exception(databaseError.getMessage())); } }); }
Example 6
Source File: RestorePresenter.java From FastAccess with GNU General Public License v3.0 | 6 votes |
@Override public void onRestore(@NonNull DatabaseReference databaseReference, @Nullable String userId) { this.userId = userId; FirebaseUser user = getView().user(); if (InputHelper.isEmpty(userId)) { if (user != null) userId = user.getUid(); } if (InputHelper.isEmpty(userId)) { getView().onShowMessage(R.string.login_first_msg); getView().finishOnError(); } else { getView().onShowProgress(); Query query = databaseReference .child(userId); query.keepSynced(true); query.addListenerForSingleValueEvent(this); } }
Example 7
Source File: FirestackDatabase.java From react-native-firestack with MIT License | 6 votes |
public void addOnceValueEventListener(final ReadableArray modifiers, final Callback callback) { final FirestackDBReference self = this; mOnceValueListener = new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { WritableMap data = FirestackUtils.dataSnapshotToMap("value", mPath, dataSnapshot); callback.invoke(null, data); } @Override public void onCancelled(DatabaseError error) { WritableMap err = Arguments.createMap(); err.putInt("errorCode", error.getCode()); err.putString("errorDetails", error.getDetails()); err.putString("description", error.getMessage()); callback.invoke(err); } }; Query ref = this.getDatabaseQueryAtPathAndModifiers(modifiers); ref.addListenerForSingleValueEvent(mOnceValueListener); }
Example 8
Source File: HomeView.java From BloodBank with GNU General Public License v3.0 | 5 votes |
private void AddPosts() { Query allposts = donor_ref.child("posts"); pd.show(); allposts.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { if(dataSnapshot.exists()) { for (DataSnapshot singlepost : dataSnapshot.getChildren()) { CustomUserData customUserData = singlepost.getValue(CustomUserData.class); postLists.add(customUserData); restAdapter.notifyDataSetChanged(); } pd.dismiss(); } else { Toast.makeText(getActivity(), "Database is empty now!", Toast.LENGTH_LONG).show(); } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { Log.d("User", databaseError.getMessage()); } }); }
Example 9
Source File: PostInteractor.java From social-app-android with Apache License 2.0 | 5 votes |
public void getPostList(final OnPostListChangedListener<Post> onDataChangedListener, long date) { DatabaseReference databaseReference = databaseHelper.getDatabaseReference().child(DatabaseHelper.POSTS_DB_KEY); Query postsQuery; if (date == 0) { postsQuery = databaseReference.limitToLast(Constants.Post.POST_AMOUNT_ON_PAGE).orderByChild("createdDate"); } else { postsQuery = databaseReference.limitToLast(Constants.Post.POST_AMOUNT_ON_PAGE).endAt(date).orderByChild("createdDate"); } postsQuery.keepSynced(true); postsQuery.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { Map<String, Object> objectMap = (Map<String, Object>) dataSnapshot.getValue(); PostListResult result = parsePostList(objectMap); if (result.getPosts().isEmpty() && result.isMoreDataAvailable()) { getPostList(onDataChangedListener, result.getLastItemCreatedDate() - 1); } else { onDataChangedListener.onListChanged(parsePostList(objectMap)); } } @Override public void onCancelled(DatabaseError databaseError) { LogUtil.logError(TAG, "getPostList(), onCancelled", new Exception(databaseError.getMessage())); onDataChangedListener.onCanceled(context.getString(R.string.permission_denied_error)); } }); }
Example 10
Source File: verifyPatient2.java From Doctorave with MIT License | 5 votes |
private void putInformationInFb(final Context context) { // TODO: Send messages on click FirebaseDatabase mFirebaseDatabase = FirebaseDatabase.getInstance(); final DatabaseReference mDatabaseReference = mFirebaseDatabase.getReference(); Query hekkQuery = mDatabaseReference; hekkQuery.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { boolean alreadyHas = false; for (DataSnapshot snapshot: dataSnapshot.getChildren()) { if (snapshot.getKey().equals(phone)){ alreadyHas = true; saveUserInSP(context); } } if(!alreadyHas){ mDatabaseReference.child(phone).setValue("").addOnSuccessListener(new OnSuccessListener<Void>() { @Override public void onSuccess(Void aVoid) { saveUserInSP(context); } }) .addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { } }); } } @Override public void onCancelled(DatabaseError databaseError) { } }); }
Example 11
Source File: PostInteractor.java From social-app-android with Apache License 2.0 | 5 votes |
public void getPostList(final OnPostListChangedListener<Post> onDataChangedListener, long date) { DatabaseReference databaseReference = databaseHelper.getDatabaseReference().child(DatabaseHelper.POSTS_DB_KEY); Query postsQuery; if (date == 0) { postsQuery = databaseReference.limitToLast(Constants.Post.POST_AMOUNT_ON_PAGE).orderByChild("createdDate"); } else { postsQuery = databaseReference.limitToLast(Constants.Post.POST_AMOUNT_ON_PAGE).endAt(date).orderByChild("createdDate"); } postsQuery.keepSynced(true); postsQuery.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { Map<String, Object> objectMap = (Map<String, Object>) dataSnapshot.getValue(); PostListResult result = parsePostList(objectMap); if (result.getPosts().isEmpty() && result.isMoreDataAvailable()) { getPostList(onDataChangedListener, result.getLastItemCreatedDate() - 1); } else { onDataChangedListener.onListChanged(parsePostList(objectMap)); } } @Override public void onCancelled(DatabaseError databaseError) { LogUtil.logError(TAG, "getPostList(), onCancelled", new Exception(databaseError.getMessage())); onDataChangedListener.onCanceled(context.getString(R.string.permission_denied_error)); } }); }
Example 12
Source File: PlaceDetailActivity.java From protrip with MIT License | 5 votes |
private void isFavourite(Context context, final String placeId) { /*String URL = PlacesProvider.URL; Uri places = Uri.parse(URL); Cursor cursor = null; cursor = context.getContentResolver().query(places, null, PlacesSQLiteHelper.ID +" = '"+ placeId +"'", null, PlacesSQLiteHelper.ROW_ID); if (cursor != null&&cursor.moveToNext()) { return true; } else { return false; }*/ isFavPlace = false; Query placeQuery = mFavsDbRef.orderByChild(Constants.title_node_place_id).equalTo(placeId); placeQuery.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { for (DataSnapshot snapshot : dataSnapshot.getChildren()) { if (snapshot.exists()) { isFavPlace = true; fabFav.setImageResource(R.drawable.ic_favorite_white_24px); } } } @Override public void onCancelled(DatabaseError databaseError) { Log.e(TAG, "onCancelled " + databaseError.toException()); } }); }
Example 13
Source File: HomeBaseFragment.java From kute with Apache License 2.0 | 5 votes |
private void getFirstFriendProfile() { DatabaseReference users=FirebaseDatabase.getInstance().getReference("Users"); if(friend_list.size()>0) { String first_friend_key = friend_list.get(0); Query get_top_friend=users.orderByKey().equalTo(first_friend_key); get_top_friend.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { Person p=dataSnapshot.getChildren().iterator().next().getValue(Person.class); Log.d(TAG,"First Friend:"+p.name); person_detail_list.add(p); sendMessageFriendTab(Action_FRIENDS_READY,friend_list,person_detail_list); //Now Loading First Ten friends //TODO cancel the asynctask on fragment's onDestroy Log.i(TAG,"Starting to load top 10 friends"); load_friends_async=new LoadFirebaseFriends(friend_list,HomeBaseFragment.this); load_friends_async.execute(2,9); //Just Loading details of some random number of people in order } @Override public void onCancelled(DatabaseError databaseError) { } }); } }
Example 14
Source File: FirebaseDataSource.java From FirebaseUI-Android with Apache License 2.0 | 4 votes |
@Override public void loadAfter(@NonNull final LoadParams<String> params, @NonNull final LoadCallback<String, DataSnapshot> callback) { // Set loading state mLoadingState.postValue(LoadingState.LOADING_MORE); //Load params.requestedLoadSize+1 because, first data item is getting ignored. Query mNewQuery = mQuery.startAt(null, params.key).limitToFirst(params.requestedLoadSize + 1); mNewQuery.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { if (dataSnapshot.exists()) { //Make List of DataSnapshot List<DataSnapshot> data = new ArrayList<>(); String lastKey = null; Iterator<DataSnapshot> iterator = dataSnapshot.getChildren().iterator(); //Skip First Item if (iterator.hasNext()) { iterator.next(); } while (iterator.hasNext()) { DataSnapshot snapshot = iterator.next(); data.add(snapshot); } //Update State mLoadingState.postValue(LoadingState.LOADED); mRetryRunnable = null; //Detect End of Data if (data.isEmpty()) mLoadingState.postValue(LoadingState.FINISHED); else { //Get Last Key lastKey = getLastPageKey(data); } callback.onResult(data, lastKey); } else { mRetryRunnable = getRetryLoadAfter(params, callback); setDatabaseNotFoundError(); } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { mRetryRunnable = getRetryLoadAfter(params, callback); setError(databaseError); } }); }
Example 15
Source File: FirebaseDataSource.java From FirebaseUI-Android with Apache License 2.0 | 4 votes |
@Override public void loadInitial(@NonNull final LoadInitialParams<String> params, @NonNull final LoadInitialCallback<String, DataSnapshot> callback) { // Set initial loading state mLoadingState.postValue(LoadingState.LOADING_INITIAL); Query mInitQuery = mQuery.limitToFirst(params.requestedLoadSize); mInitQuery.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { if (dataSnapshot.exists()) { //Make List of DataSnapshot List<DataSnapshot> data = new ArrayList<>(); for (DataSnapshot snapshot : dataSnapshot.getChildren()){ data.add(snapshot); } //Get Last Key String lastKey = getLastPageKey(data); //Update State mLoadingState.postValue(LoadingState.LOADED); mRetryRunnable = null; callback.onResult(data, lastKey, lastKey); } else { mRetryRunnable = getRetryLoadInitial(params, callback); setDatabaseNotFoundError(); } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { mRetryRunnable = getRetryLoadInitial(params, callback); setError(databaseError); } }); }
Example 16
Source File: FirebaseProgressBar.java From TwrpBuilder with GNU General Public License v3.0 | 4 votes |
private void start(final ProgressBar progressBar, @NonNull final TextView textView, @NonNull FirebaseRecyclerAdapter adapter, @NonNull final String refId, final boolean filter, @NonNull String from, String equalto) { FirebaseDatabase mFirebaseInstance = FirebaseDatabase.getInstance(); progressBar.setVisibility(View.VISIBLE); Query query; if (filter) { query = mFirebaseInstance.getReference(refId).orderByChild(from).equalTo(equalto); } else { query = mFirebaseInstance.getReference(refId); } query.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { progressBar.setVisibility(View.GONE); if (!dataSnapshot.exists()) { if (filter) { textView.setText(R.string.no_builds_found); } else { switch (refId) { case "RunningBuild": textView.setText(R.string.no_running_builds); break; case "Builds": textView.setText(R.string.no_builds_found); break; case "Rejected": textView.setText(R.string.no_rejected); break; } } textView.setVisibility(View.VISIBLE); } else { textView.setVisibility(View.GONE); } } @Override public void onCancelled(@NonNull DatabaseError firebaseError) { progressBar.setVisibility(View.GONE); } }); adapter.registerAdapterDataObserver(new RecyclerView.AdapterDataObserver() { @Override public void onChanged() { super.onChanged(); progressBar.setVisibility(View.GONE); } }); }
Example 17
Source File: LoadFirebaseFriends.java From kute with Apache License 2.0 | 4 votes |
@Override protected Void doInBackground(Integer... params) { //Through params we can pass the indices for which data is required Log.v(TAG,"The indices received here are "+Integer.toString(params[0])+"and "+Integer.toString(params[1])); final ArrayList<Person>person_detail_list=new ArrayList<Person>(); DatabaseReference users= FirebaseDatabase.getInstance().getReference("Users"); final AsyncTaskListener taskListener=async_task_listener.get(); taskListener.onTaskStarted(params[0],params[1]); for(int i=params[0];i<=params[1];++i) { Log.v(TAG,"The size in asynctask is"+Integer.toString(friend_list.size())); if (i<friend_list.size()) { Log.v(TAG,"Status:entered"); String first_friend_key = friend_list.get(i); Query get_friend = users.orderByKey().equalTo(first_friend_key); get_friend.keepSynced(true); get_friend.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { try { //Added a a try except just to prevent finding those friends who does not exist now Person p = dataSnapshot.getChildren().iterator().next().getValue(Person.class); if (async_task_listener != null) { //Check if the weak reference still exists Log.v(TAG, "Retrieved Friend " + p.name); taskListener.onTaskCompleted(p); } }catch (Exception e){ Log.i(TAG,"Error Receiving particular person details from firebase Person Might not Exist"); } } @Override public void onCancelled(DatabaseError databaseError) { } }); } else { Log.v(TAG,"All Friends Already Downloaded"); break; } } return null; }
Example 18
Source File: ItemMasterIntentService.java From stockita-point-of-sale with MIT License | 4 votes |
/** * Helper method to perform delete one item master from the realtime database and from the realtime storage * @param userUid The user login UID * @param itemMasterKey The item master push() key * @param itemImageKey The item image push() key */ private void deleteOneItemImage(final String userUid, final String itemMasterKey, String itemImageKey) { /** * Do the delete here... */ // Instantiate the server database object for itemImage DatabaseReference locationItemImage = FirebaseDatabase.getInstance().getReference() .child(userUid) .child(Constants.FIREBASE_ITEM_MASTER_IMAGE_LOCATION) .child(itemMasterKey); // Query to this specific image that the user chose to delete Query queryOneImage = locationItemImage.orderByKey().equalTo(itemImageKey); // Get the image file name then delete the image from the storage queryOneImage.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { // Container ArrayList<ItemImageModel> list = new ArrayList<>(); // Iterate to pack the list with itemImageModel for (DataSnapshot snap : dataSnapshot.getChildren()) { // Instantiate the item image ItemImageModel itemImageModel = snap.getValue(ItemImageModel.class); // Pack the itemImageModel into the list list.add(itemImageModel); } // Iterate to delete each file from the storage for (ItemImageModel image : list) { // Get the imageUrl String imageName = image.getImageUrl(); // Get the file Uri Uri file = Uri.fromFile(new File(imageName)); // Initialize storage StorageReference imageStorageRef = FirebaseStorage.getInstance().getReference() .child(userUid) .child(Constants.FIREBASE_ITEM_MASTER_IMAGE_LOCATION) .child(itemMasterKey); // Delete the image from the storage imageStorageRef.child(file.getLastPathSegment()).delete(); } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { Log.e(TAG_LOG, databaseError.getMessage()); } }); // Get to the location /userUid/itemImage + itemKey + imageKey +then pass null to delete locationItemImage.child(itemImageKey).setValue(null); }
Example 19
Source File: PlaceDetailActivity.java From protrip with MIT License | 4 votes |
public int toggleFavourite() { Uri.Builder uriBuilder = PlacesProvider.CONTENT_URI.buildUpon(); if (isFavPlace) { isFavPlace = false; fabFav.setImageResource(R.drawable.ic_favorite_border_white_24px); Snackbar.make(coordinatorLayout, getString(R.string.notify_unfavorite), Snackbar.LENGTH_SHORT) .show(); //Delete on Firebase and db //this.getContentResolver().delete(uriBuilder.build(), placeDetail.getPlace_detail_id(), null); Query placeQuery = mFavsDbRef.orderByChild(Constants.title_node_place_id).equalTo(placeDetail.getPlace_detail_id()); placeQuery.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { for (DataSnapshot snapshot : dataSnapshot.getChildren()) { snapshot.getRef().removeValue(); } } @Override public void onCancelled(DatabaseError databaseError) { Log.e(TAG, "onCancelled " + databaseError.toException()); } }); } else { isFavPlace = true; fabFav.setImageResource(R.drawable.ic_favorite_white_24px); ContentValues contentValues = new ContentValues(); contentValues.put(PlacesSQLiteHelper.ID, placeDetail.getPlace_detail_id()); contentValues.put(PlacesSQLiteHelper.TITLE, placeDetail.getPlace_detail_name()); contentValues.put(PlacesSQLiteHelper.POSTERPATH_WIDE, image_URL); // contentValues.put(MoviesSQLiteHelper.FILEPATH_WIDE_CACHE, backdropFilePath); // contentValues.put(MoviesSQLiteHelper.FILEPATH_SQUARE_CACHE, getResources().getString(R.string.cache_thumbnails_path)+"Fav"+movie.mPosterId+".jpg"); contentValues.put(PlacesSQLiteHelper.RATING_AVG, placeDetail.getPlace_detail_rating()); contentValues.put(PlacesSQLiteHelper.ADDRESS_PHONE, placeDetail.getPlace_detail_phone()); contentValues.put(PlacesSQLiteHelper.ADDRESS_URL, placeDetail.getPlace_detail_url()); contentValues.put(PlacesSQLiteHelper.ADDRESS_WEB, placeDetail.getPlace_detail_website()); contentValues.put(PlacesSQLiteHelper.ADDRESS_FULL, placeDetail.getPlace_detail_address()); //this.getContentResolver().insert(PlacesProvider.CONTENT_URI, contentValues); mFavsDbRef.push().setValue(placeDetail); Snackbar.make(coordinatorLayout, getString(R.string.notify_favorite), Snackbar.LENGTH_SHORT) .show(); } return 0; }
Example 20
Source File: loginActivity.java From Doctorave with MIT License | 4 votes |
private void loginSuccessfull(String doctorUsername, String pushId) { if(firebaseAuth.getCurrentUser().isEmailVerified()){ final Boolean[] i = new Boolean[1]; Query hekkQuery = mDatabaseReference.child(pushId).child(charUtility.filterString(doctorUsername)); hekkQuery.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { i[0] = (Boolean) dataSnapshot.child("doctorInfo").child("isVerified").getValue(); if(i[0]){ }else { progressDialog.dismiss(); dataSnapshot.child("doctorInfo").child("isVerified").getRef().setValue(true); } } @Override public void onCancelled(DatabaseError databaseError) { progressDialog.dismiss(); } }); doctorPreference.saveIsTapTargetShown(this, false); doctorPreference.saveUserPushId(this, null); doctorPreference.saveUsernameInSP(this, null); doctorPreference.saveBooleanInSP(this, false); doctorPreference.saveUsernameInSP(this, doctorUsername); doctorPreference.saveUserPushId(this, pushId); doctorPreference.saveBooleanInSP(this, true); progressDialog.dismiss(); Toast.makeText(this, "Login Successfull", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(this, patientsListActivity.class); finish(); startActivity(intent); }else { progressDialog.dismiss(); Toast.makeText(this, "Please Verify Your Account", Toast.LENGTH_LONG).show(); finishTheActivity(); } }