`
SimpleDateFormat curFormater = new SimpleDateFormat("yyyyMMdd");
Date c = Calendar.getInstance().getTime();
String formattedDate=curFormater.format(c);
Log.d("tag","formate: " + formattedDate);
imageDate=dataSnapshot.getValue(String.class);
Log.d("date","date: " + imageDate);
if (imageDate==formattedDate) {
Toast.makeText(accountantFunctions.this, "only 1 image upload is allowed per day", Toast.LENGTH_LONG).show();
cameraBtn.setEnabled(false);
}else{
askCameraPermissions();
}
`
The logcat is showing this:
D/ColorViewRootUtil: nav gesture mode swipeFromBottom ignore false downY 1564 mScreenHeight 2340 mScreenWidth 1080 mStatusBarHeight 54 globalScale 1.125 nav mode 3 event MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=407.0, y[0]=1564.0, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=260828295, downTime=260828295, deviceId=4, source=0x1002, displayId=0 } rotation 0
D/tag: key: vikashbhushan189@gmail.com
D/date: date: https://accounting-book-5401b.firebaseio.com/Accountantuser/vikashbhushan189%40gmail%2Ccom/timestamp
D/tag: formate: 20200229
D/date: date: 20200228
Here I am getting imageDate from firebase realtime database.
Whenever i run if condition always remains false, and askCameraPermissions();
is called up ever time.