How can I put validation on logout button in an android app, If I am using SocialAuthAdapter in my app for sharing with social media. Code is as follows which I have write to validate my logout button but it dosent work:
public void onClick(View v) {
// TODO Auto-generated method stub
switch (v.getId()) {
case R.id.back:
Route_stops.this.finish();
break;
case R.id.update:
edit = (EditText) findViewById(R.id.editTxt);
String msg=edit.getText().toString();
Log.v("update1", "update1"+msg);
if(msg.equals(""))
{
Toast.makeText(Route_stops.this, "You have to write something for updation", 100).show();
}
break;
case R.id.logoutbutton:
/*Intent logout = new Intent(Route_stops.this,Logout.class);
startActivity(logout);*/
if(adapter==null)
{
Toast.makeText(Route_stops.this, "You have to sign in first", 100).show();
}
else{
try{
/*CookieSyncManager.createInstance(this);
CookieManager cookieManager = CookieManager.getInstance();
cookieManager.removeAllCookie();*/
adapter.signOut(Route_stops.this,Provider.FACEBOOK.toString());
adapter.signOut(Route_stops.this,Provider.TWITTER.toString());
adapter.signOut(Route_stops.this,Provider.LINKEDIN.toString());
adapter.signOut(Route_stops.this,Provider.MYSPACE.toString());
if(Provider.FACEBOOK==null && Provider.TWITTER==null && Provider.LINKEDIN==null && Provider.MYSPACE==null)
Toast.makeText(Route_stops.this, "You have Logged In First in any Social media", Toast.LENGTH_LONG).show();
else
Toast.makeText(Route_stops.this, "You have Logged Out", Toast.LENGTH_LONG).show();
}
catch(Exception E)
{
System.out.println(E.toString());
}
}
break;
case R.id.option:
Toast.makeText(Route_stops.this, "Map", 100).show();
}
Change with this:
OR