If Else not working in JFrame - jframe

if (!(tf_category_mt.getText().trim().equals("")
&& tf_cat_desc_mt.getText().trim().equals(""))) {
JOptionPane.showMessageDialog(null, "Success");
}
else {
JOptionPane.showMessageDialog(null, "Fail");
}
Here if and else are not working.
tf_category_mt and tf_cat_desc are two text fields.

Related

In socket programming exe file memory increasing gradually and also socket remain open

When received sting from multiple client at time some socket remain open so created mis file size increasing gradually so at time exe file become 2 GB from 35 kb so how can i reduce open sockect
private void Server_Load(object sender, EventArgs e)
{
try
{
this.tcpListener = new TcpListener(IPAddress.Any, port);
this.listenThread = new Thread(new ThreadStart(ListenForClients));
this.listenThread.Start();
}
catch (Exception ex)
{ }
finally
{
if (this.tcpListener != null)
{
this.tcpListener.Stop();
}
}
}
Mangae Client request by server continuously from load method
private void ListenForClients()
{
TcpClient client = null;
try
{
this.tcpListener.Start();
while (true)
{
client = this.tcpListener.AcceptTcpClient();
ThreadPool.QueueUserWorkItem(new WaitCallback(HandleClientComm),
client);
}
}
catch (Exception ex)
{
LogHelperISPL.Logger.Info("ListenForClients: " + ex.Message);
this.tcpListener.Stop();
}
finally
{
if(this.tcpListener != null)
{
this.tcpListener.Stop();
}
if (client != null)
{
client.Close();
}
}
}
Take data from client and insert into table and mange pass tcpclient and networkstream with close connection
private void HandleClientComm(object client)
{
TcpClient tcpClient = null;
NetworkStream clientStream = null;
try
{
tcpClient = (TcpClient)client;
clientStream = tcpClient.GetStream();
string InsertedRecord = string.Empty;
byte[] messageBytes = new byte[4096];
int bytesRead;
bool end = false;
while (!end)
{
bytesRead = 0;
try
{
if (clientStream != null)
{
bytesRead = clientStream.Read(messageBytes, 0,
messageBytes.Length);
}
}
catch (SocketException ex)
{
if (clientStream != null)
{
clientStream.Flush();
clientStream.Close();
}
if (tcpClient != null)
{
tcpClient.Close();
}
break;
}
catch (Exception ex)
{
if (clientStream != null)
{
clientStream.Flush();
clientStream.Close();
}
if (tcpClient != null)
{
tcpClient.Close();
}
break;
}
if (bytesRead <= 0)
{
break;
}
ASCIIEncoding encoder = new ASCIIEncoding();
string Datareceived = encoder.GetString(messageBytes, 0, bytesRead);
if (!string.IsNullOrEmpty(Datareceived))
{
string[] Multistrings = Datareceived.Split('!');
for (int i = 0; i < Multistrings.Length; i++)
{
if (!string.IsNullOrEmpty(Multistrings[i]))
{
if (Multistrings[i].Length >= 90)
{
InsertedRecord = InsertRawData(Multistrings[i]);
}
else
{
InsertedRecord =
InsertRawDataGarbage(Multistrings[i]);
}
}
}
}
}
}
catch (Exception ex)
{
LogHelperISPL.Logger.Info("While loop: " + ex.Message);
}
finally
{
if (clientStream != null)
{
clientStream.Flush();
clientStream.Close();
}
if (tcpClient != null)
{
tcpClient.Close();
}
}
}

AutoCompleteTextField list does not always scroll to top?

The AutoCompleteTextField seems to work exactly as intended until I start backspacing in the TextField. I am not sure what the difference is, but if I type in something like "123 M" then I get values that start with "123 M". If I backspace and delete the M leaving "123 " in the field, the list changes, but it does not scroll to the top of the list.
I should note that everything works fine on the simulator and that I am experiencing this behavior when running a debug build on my iPhone.
EDIT: So this does not only seem to happen when backspacing. This image shows the results I have when typing in an address key by key. In any of the pictures where the list isn't viewable or is clipped, I am able to drag down on the list to get it to then display properly. I have not tried this on an Android device.
EDIT2:
public class CodenameOneTest {
private Form current;
private Resources theme;
private WaitingClass w;
private String[] properties = {"1 MAIN STREET", "123 E MAIN STREET", "12 EASTER ROAD", "24 MAIN STREET"};
public void init(Object context) {
theme = UIManager.initFirstTheme("/theme");
// Enable Toolbar on all Forms by default
Toolbar.setGlobalToolbar(true);
}
public void start() {
if(current != null) {
current.show();
return;
}
Form form = new Form("AutoCompleteTextField");
form.setLayout(new BorderLayout());
final DefaultListModel<String> options = new DefaultListModel<>();
AutoCompleteTextField ac = new AutoCompleteTextField(options) {
protected boolean filter(String text) {
if(text.length() == 0) {
options.removeAll();
return false;
}
String[] l = searchLocations(text);
if(l == null || l.length == 0) {
return false;
}
options.removeAll();
for(String s : l) {
options.addItem(s);
}
return true;
};
};
Container container = new Container(BoxLayout.y());
container.setScrollableY(true); // If you comment this out then the field works fine
container.add(ac);
form.addComponent(BorderLayout.CENTER, container);
form.show();
}
String[] searchLocations(String text) {
try {
if(text.length() > 0) {
if(w != null) {
w.actionPerformed(null);
}
w = new WaitingClass();
String[] properties = getProperties(text);
if(Display.getInstance().isEdt()) {
Display.getInstance().invokeAndBlock(w);
}
else {
w.run();
}
return properties;
}
}
catch(Exception e) {
Log.e(e);
}
return null;
}
private String[] getProperties(String text) {
List<String> returnList = new ArrayList<>();
List<String> propertyList = Arrays.asList(properties);
for(String property : propertyList) {
if(property.startsWith(text)) {
returnList.add(property);
}
}
w.actionPerformed(null);
return returnList.toArray(new String[returnList.size()]);
}
class WaitingClass implements Runnable, ActionListener<ActionEvent> {
private boolean finishedWaiting;
public void run() {
while(!finishedWaiting) {
try {
Thread.sleep(30);
}
catch(InterruptedException ex) {
ex.printStackTrace();
}
}
}
public void actionPerformed(ActionEvent e) {
finishedWaiting = true;
return;
}
}
public void stop() {
current = Display.getInstance().getCurrent();
if(current instanceof Dialog) {
((Dialog)current).dispose();
current = Display.getInstance().getCurrent();
}
}
public void destroy() {
}
}
I used this code on an iPhone 4s:
public void start() {
if(current != null){
current.show();
return;
}
Form hi = new Form("AutoComplete", new BorderLayout());
if(apiKey == null) {
hi.add(new SpanLabel("This demo requires a valid google API key to be set in the constant apiKey, "
+ "you can get this key for the webservice (not the native key) by following the instructions here: "
+ "https://developers.google.com/places/web-service/get-api-key"));
hi.getToolbar().addCommandToRightBar("Get Key", null, e -> Display.getInstance().execute("https://developers.google.com/places/web-service/get-api-key"));
hi.show();
return;
}
Container box = new Container(new BoxLayout(BoxLayout.Y_AXIS));
box.setScrollableY(true);
for(int iter = 0 ; iter < 30 ; iter++) {
box.add(createAutoComplete());
}
hi.add(BorderLayout.CENTER, box);
hi.show();
}
private AutoCompleteTextField createAutoComplete() {
final DefaultListModel<String> options = new DefaultListModel<>();
AutoCompleteTextField ac = new AutoCompleteTextField(options) {
#Override
protected boolean filter(String text) {
if(text.length() == 0) {
return false;
}
String[] l = searchLocations(text);
if(l == null || l.length == 0) {
return false;
}
options.removeAll();
for(String s : l) {
options.addItem(s);
}
return true;
}
};
ac.setMinimumElementsShownInPopup(5);
return ac;
}
String[] searchLocations(String text) {
try {
if(text.length() > 0) {
ConnectionRequest r = new ConnectionRequest();
r.setPost(false);
r.setUrl("https://maps.googleapis.com/maps/api/place/autocomplete/json");
r.addArgument("key", apiKey);
r.addArgument("input", text);
NetworkManager.getInstance().addToQueueAndWait(r);
Map<String,Object> result = new JSONParser().parseJSON(new InputStreamReader(new ByteArrayInputStream(r.getResponseData()), "UTF-8"));
String[] res = Result.fromContent(result).getAsStringArray("//description");
return res;
}
} catch(Exception err) {
Log.e(err);
}
return null;
}
I was able to create this issue but not the issue you describe.

Eclipse Plugin Creating a IJavaLineBreakpoint programmatically does not show method info in Breakpoints view

I'm creating a Eclipse plugin and I'm trying to create JavaLineBreakpoint using JDIDebugModel.
However, when a line breakpoint is created from the Java editor, it displays the Class name, the line number and the method name as the following image:
When the line breakpoint is created in the plugin the method name is replaced by the class name as follows:
The following is the code used to create the breakpoint.
Thank you.
IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints();
if (breakpoints.length == 0) {
return null;
}
IJavaLineBreakpoint oldBreakpoint = null;
for (int i = 0; i < breakpoints.length; i++) {
IBreakpoint breakpoint = breakpoints[i];
if (breakpoint instanceof IJavaLineBreakpoint) {
oldBreakpoint = (IJavaLineBreakpoint)breakpoint;
break;
}
}
if (oldBreakpoint != null) {
Map newAttrMap = null;
IResource resource = null;
try {
IMarker marker = oldBreakpoint.getMarker();
if (marker != null && marker.exists()) {
newAttrMap = marker.getAttributes();
resource = marker.getResource();
}
} catch (CoreException ce) {
Activator.logError("SinfoniaCloudBreakpointItem - Contructor - Marker attributes not found", ce);
}
int lineNumber = -1;
try {
lineNumber = (Integer)newAttrMap.get(IMarker.LINE_NUMBER);
} catch (ClassCastException cce) {
} catch (NullPointerException ne) {
}
try {
JDIDebugModel.createLineBreakpoint(
resource,
oldBreakpoint.getTypeName(),
lineNumber, -1, -1, 0, true, newAttrMap);
oldBreakpoint.delete();
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

How to show Custom Message in Place of Null Date of Birth

I am writing an app in which i am fetching List of Facebook friends with their profile picture, name and dob
but some of my friends have not given their Birthday Dates, so in place of Birthday i am getting null by default, but now in place of null i want to show: Birthday Not Mentioned.
see below screen shot of my existing app:
Like: Vikas Rana has given DOB on facebook and AJay November has not given DOB on Facebook
> VikY
January 1
> AJamber
Null
Here, in place Null i want to show : Birthday Not Mentioned
FriendsList.java:
public View getView(int position, View convertView, ViewGroup parent) {
JSONObject jsonObject = null;
try {
jsonObject = jsonArray.getJSONObject(position);
} catch (JSONException e) {
}
FriendItem friendItem;
if (convertView == null) {
convertView = mInflater.inflate(R.layout.listfb_friends, null);
friendItem = new FriendItem();
convertView.setTag(friendItem);
} else {
friendItem = (FriendItem) convertView.getTag();
}
friendItem.friendPicture = (ImageView) convertView
.findViewById(R.id.picture);
friendItem.friendName = (TextView) convertView
.findViewById(R.id.name);
friendItem.friendDob = (TextView) convertView
.findViewById(R.id.dob);
friendItem.friendLayout = (RelativeLayout) convertView
.findViewById(R.id.friend_item);
try {
String uid = jsonObject.getString("uid");
String url = jsonObject.getString("pic_square");
friendItem.friendPicture.setImageBitmap(picturesGatherer
.getPicture(uid, url));
} catch (JSONException e) {
friendItem.friendName.setText("");
friendItem.friendDob.setText("");
}
try {
friendItem.friendName.setText(jsonObject.getString("name"));
if(!friendItem.friendDob.equals(""))
{
friendItem.friendDob.setText(jsonObject.getString("birthday"));
}
else
{
friendItem.friendDob.setText("Birthday Not Mentioned");
}
} catch (JSONException e) {
friendItem.friendName.setText("");
friendItem.friendDob.setText("");
}
listofshit.put(position, friendItem);
return convertView;
}
and if i am writing code something like this:
try {
friendItem.friendName.setText(jsonObject.getString("name"));
friendItem.friendDob.setText(jsonObject.getString("birthday"));
} catch (JSONException e) {
friendItem.friendName.setText("");
friendItem.friendDob.setText("");
}
finally
{
friendItem.friendDob.setText("Birthday Not Mentioned");
}
so i am getting Birthday Not Mentioned for all facebook friends Birthdays, even for them also those have mentioned.
try this one.
try{
if(jsonObject.getString("birthday")!= null && !jsonObject.getString("birthday").equals("")){
friendItem.friendDob.setText(jsonObject.getString("birthday"));
}else{
friendItem.friendDob.setText("Birthday Not Mentioned");
}
}catch(JSONException e){
e.printStackTrace();
}
Where you are getting NullPointerException use try-catch over it.
You might have done it I think. Now just set the text "Birthday Not Mentioned" over the textview/edittext (whatever you are using to show d.o.b) by writing code in catch block.
Just use:-
try {
friendItem.friendName.setText(jsonObject.getString("name"));
friendItem.friendDob.setText(jsonObject.getString("birthday"));
}
catch (Exception e) {
friendItem.friendName.setText("Name"); // try it for now.
friendItem.friendDob.setText("Birthday Not Mentioned"); // Have to be here.
}
Just try with this code:
try
{
friendItem.friendName.setText(jsonObject.getString("name"));
friendItem.friendDob.setText(jsonObject.getString("birthday"));
if(!(jsonObject.getString("birthday").equalsIgnoreCase("null")))
{
friendItem.friendDob.setText(jsonObject.getString("birthday"));
}
else
{
friendItem.friendDob.setText("Birthday Not Mentioned");
}
} catch (JSONException e)
{
friendItem.friendName.setText("");
friendItem.friendDob.setText("");
}
listofshit.put(position, friendItem);
return convertView;
}

No login screen in Facebook integration in blackberry

I am working on an blackberry application in which I am using 3rd party application Facebook.
Now, my problem is when i post the message first time i will be redirected to facebook login screen and message posted .But once i logout from my application and login again to post message to facebook it posts message directly without asking for cerdential information.
The below code to login to facebook:
public class FacebookMain implements ActionListener{// extends MainScreen implements ActionListener {
// Constants
public final static String NEXT_URL = "http://www.facebook.com/connect/login_success.html";
public final static String APPLICATION_ID ="261890490596037";
private final static long persistentObjectId = 0x854d1b7fa43e3577L;
//APPLICATION SECRET ID="f7e096af696ef81e72268f49a6381a8d"
static final String ACTION_ENTER = "updateStatus";
static final String ACTION_SUCCESS = "statusUpdated";
static final String ACTION_ERROR = "error";
private ActionScreen actionScreen;
private PersistentObject store;
private LoginScreen loginScreen;
private LogoutScreen logoutScreen;
private HomeScreen homeScreen;
private UpdateStatusScreen updateStatusScreen;
private RecentUpdatesScreen recentUpdatesScreen;
private UploadPhotoScreen uploadPhotoScreen;
private FriendsListScreen friendsListScreen;
private PokeFriendScreen pokeFriendScreen;
private PostWallScreen postWallScreen;
private SendMessageScreen sendMessageScreen;
private String postMessage;
private FacebookContext fbc;
public static boolean isWallPosted=false;
public FacebookMain(String postMessge) {
this.postMessage=postMessge;
checkPermissions();
init();
if ((fbc != null) && fbc.hasValidAccessToken()) {
/*homeScreen = new HomeScreen(fbc);
homeScreen.addActionListener(this);
UiApplication.getUiApplication().pushScreen(homeScreen);*/
try {
new FBUser("me", fbc.getAccessToken()).setStatus(postMessage);
actionScreen=new ActionScreen();
actionScreen.fireAction(ACTION_SUCCESS);
Dialog.alert("Wall Posted ");
isWallPosted=true;
//UiApplication.getUiApplication().popScreen(loginScreen);
} catch (Exception e) {
actionScreen.fireAction(ACTION_ERROR, e.getMessage());
//UiApplication.getUiApplication().popScreen(loginScreen);
}
} else {
loginScreen = new LoginScreen(fbc,postMessge);
loginScreen.addActionListener(this);
UiApplication.getUiApplication().pushScreen(loginScreen);
}
}
private void init() {
store = PersistentStore.getPersistentObject(persistentObjectId);
synchronized (store) {
if (store.getContents() == null) {
store.setContents(new FacebookContext(NEXT_URL, APPLICATION_ID));
store.commit();
}
}
fbc = (FacebookContext) store.getContents();
}
private void checkPermissions() {
ApplicationPermissionsManager apm = ApplicationPermissionsManager.getInstance();
ApplicationPermissions original = apm.getApplicationPermissions();
if ((original.getPermission(ApplicationPermissions.PERMISSION_INPUT_SIMULATION) == ApplicationPermissions.VALUE_ALLOW) && (original.getPermission(ApplicationPermissions.PERMISSION_DEVICE_SETTINGS) == ApplicationPermissions.VALUE_ALLOW) && (original.getPermission(ApplicationPermissions.PERMISSION_CROSS_APPLICATION_COMMUNICATION) == ApplicationPermissions.VALUE_ALLOW) && (original.getPermission(ApplicationPermissions.PERMISSION_INTERNET) == ApplicationPermissions.VALUE_ALLOW) && (original.getPermission(ApplicationPermissions.PERMISSION_SERVER_NETWORK) == ApplicationPermissions.VALUE_ALLOW) && (original.getPermission(ApplicationPermissions.PERMISSION_EMAIL) == ApplicationPermissions.VALUE_ALLOW)) {
return;
}
ApplicationPermissions permRequest = new ApplicationPermissions();
permRequest.addPermission(ApplicationPermissions.PERMISSION_INPUT_SIMULATION);
permRequest.addPermission(ApplicationPermissions.PERMISSION_DEVICE_SETTINGS);
permRequest.addPermission(ApplicationPermissions.PERMISSION_CROSS_APPLICATION_COMMUNICATION);
permRequest.addPermission(ApplicationPermissions.PERMISSION_INTERNET);
permRequest.addPermission(ApplicationPermissions.PERMISSION_SERVER_NETWORK);
permRequest.addPermission(ApplicationPermissions.PERMISSION_EMAIL);
permRequest.addPermission(ApplicationPermissions.PERMISSION_INTERNET);
permRequest.addPermission(ApplicationPermissions.PERMISSION_AUTHENTICATOR_API);
permRequest.addPermission(ApplicationPermissions.PERMISSION_SERVER_NETWORK);
permRequest.addPermission(ApplicationPermissions.PERMISSION_WIFI);
boolean acceptance = ApplicationPermissionsManager.getInstance().invokePermissionsRequest(permRequest);
if (acceptance) {
// User has accepted all of the permissions.
return;
} else {
}
}
public void saveContext(FacebookContext pfbc) {
synchronized (store) {
store.setContents(pfbc);
System.out.println(pfbc);
store.commit();
}
}
public void logoutAndExit() {
saveContext(null);
logoutScreen = new LogoutScreen(fbc);
logoutScreen.addActionListener(this);
}
public void saveAndExit() {
saveContext(fbc);
exit();
}
private void exit() {
AppenderFactory.close();
System.exit(0);
}
public void onAction(Action event) {/*
if (event.getSource() == loginScreen) {
if (event.getAction().equals(LoginScreen.ACTION_LOGGED_IN)) {
try {
fbc.setAccessToken((String) event.getData());
try {
new FBUser("me", fbc.getAccessToken()).setStatus(postMessage);
actionScreen=new ActionScreen();
actionScreen.fireAction(ACTION_SUCCESS);
Dialog.alert("Wall Posted ");
} catch (Exception e) {
actionScreen.fireAction(ACTION_ERROR, e.getMessage());
}
try {
if (homeScreen == null) {
homeScreen = new HomeScreen(fbc);
homeScreen.addActionListener(this);
}
UiApplication.getUiApplication().pushScreen(homeScreen);
} catch (Exception e) {
e.printStackTrace();
Dialog.alert("Error: " + e.getMessage());
}
} catch (Throwable t) {
t.printStackTrace();
Dialog.alert("Error: " + t.getMessage());
}
} else if (event.getAction().equals(LoginScreen.ACTION_ERROR)) {
Dialog.alert("Error: " + event.getData());
}
} else if (event.getSource() == logoutScreen) {
if (event.getAction().equals(LogoutScreen.ACTION_LOGGED_OUT)) {
exit();
}
} else if (event.getSource() == homeScreen) {
if (event.getAction().equals(UpdateStatusScreen.ACTION_ENTER)) {
if (updateStatusScreen == null) {
updateStatusScreen = new UpdateStatusScreen(fbc);
updateStatusScreen.addActionListener(this);
}
UiApplication.getUiApplication().pushScreen(updateStatusScreen);
try {
new FBUser("me", fbc.getAccessToken()).setStatus("");
actionScreen=new ActionScreen();
actionScreen.fireAction(ACTION_SUCCESS);
} catch (Exception e) {
actionScreen.fireAction(ACTION_ERROR, e.getMessage());
}
} else if (event.getAction().equals(RecentUpdatesScreen.ACTION_ENTER)) {
if (recentUpdatesScreen == null) {
recentUpdatesScreen = new RecentUpdatesScreen(fbc);
recentUpdatesScreen.addActionListener(this);
}
recentUpdatesScreen.loadList();
UiApplication.getUiApplication().pushScreen(recentUpdatesScreen);
} else if (event.getAction().equals(UploadPhotoScreen.ACTION_ENTER)) {
if (uploadPhotoScreen == null) {
uploadPhotoScreen = new UploadPhotoScreen(fbc);
uploadPhotoScreen.addActionListener(this);
}
UiApplication.getUiApplication().pushScreen(uploadPhotoScreen);
} else if (event.getAction().equals(FriendsListScreen.ACTION_ENTER)) {
if (friendsListScreen == null) {
friendsListScreen = new FriendsListScreen(fbc);
friendsListScreen.addActionListener(this);
}
friendsListScreen.loadList();
UiApplication.getUiApplication().pushScreen(friendsListScreen);
} else if (event.getAction().equals(PokeFriendScreen.ACTION_ENTER)) {
if (pokeFriendScreen == null) {
pokeFriendScreen = new PokeFriendScreen(fbc);
pokeFriendScreen.addActionListener(this);
}
UiApplication.getUiApplication().pushScreen(pokeFriendScreen);
} else if (event.getAction().equals(PostWallScreen.ACTION_ENTER)) {
if (postWallScreen == null) {
postWallScreen = new PostWallScreen(fbc);
postWallScreen.addActionListener(this);
}
postWallScreen.loadList();
UiApplication.getUiApplication().pushScreen(postWallScreen);
} else if (event.getAction().equals(SendMessageScreen.ACTION_ENTER)) {
if (sendMessageScreen == null) {
sendMessageScreen = new SendMessageScreen(fbc);
sendMessageScreen.addActionListener(this);
}
UiApplication.getUiApplication().pushScreen(sendMessageScreen);
}
} else if (event.getSource() == updateStatusScreen) {
if (event.getAction().equals(UpdateStatusScreen.ACTION_SUCCESS)) {
Dialog.inform("Status updated");
try {
UiApplication.getUiApplication().popScreen(updateStatusScreen);
} catch (IllegalArgumentException e) {
}
} else if (event.getAction().equals(UpdateStatusScreen.ACTION_SUCCESS)) {
Dialog.alert("Error: " + event.getData());
}
} else if (event.getSource() == recentUpdatesScreen) {
if (event.getAction().equals(RecentUpdatesScreen.ACTION_SUCCESS)) {
try {
UiApplication.getUiApplication().popScreen(recentUpdatesScreen);
} catch (IllegalArgumentException e) {
}
} else if (event.getAction().equals(RecentUpdatesScreen.ACTION_ERROR)) {
Dialog.alert("Error: " + event.getData());
}
} else if (event.getSource() == uploadPhotoScreen) {
if (event.getAction().equals(UploadPhotoScreen.ACTION_SUCCESS)) {
try {
UiApplication.getUiApplication().popScreen(uploadPhotoScreen);
} catch (IllegalArgumentException e) {
}
} else if (event.getAction().equals(UploadPhotoScreen.ACTION_ERROR)) {
Dialog.alert("Error: " + event.getData());
}
} else if (event.getSource() == friendsListScreen) {
if (event.getAction().equals(FriendsListScreen.ACTION_SUCCESS)) {
try {
UiApplication.getUiApplication().popScreen(friendsListScreen);
} catch (IllegalArgumentException e) {
}
} else if (event.getAction().equals(FriendsListScreen.ACTION_ERROR)) {
Dialog.alert("Error: " + event.getData());
}
} else if (event.getSource() == pokeFriendScreen) {
if (event.getAction().equals(PokeFriendScreen.ACTION_SUCCESS)) {
try {
UiApplication.getUiApplication().popScreen(pokeFriendScreen);
} catch (IllegalArgumentException e) {
}
} else if (event.getAction().equals(PokeFriendScreen.ACTION_ERROR)) {
Dialog.alert("Error: " + event.getData());
}
} else if (event.getSource() == postWallScreen) {
if (event.getAction().equals(PostWallScreen.ACTION_SUCCESS)) {
Dialog.inform("Wall posted");
try {
UiApplication.getUiApplication().popScreen(postWallScreen);
} catch (IllegalArgumentException e) {
}
} else if (event.getAction().equals(PostWallScreen.ACTION_ERROR)) {
Dialog.alert("Error: " + event.getData());
}
} else if (event.getSource() == sendMessageScreen) {
if (event.getAction().equals(SendMessageScreen.ACTION_SUCCESS)) {
try {
UiApplication.getUiApplication().popScreen(sendMessageScreen);
} catch (IllegalArgumentException e) {
}
} else if (event.getAction().equals(SendMessageScreen.ACTION_ERROR)) {
Dialog.alert("Error: " + event.getData());
}
}
*/}
}
and the below code to clear credential
public void logoutAndExit() {
saveContext(null);
logoutScreen = new LogoutScreen(fbc);
logoutScreen.addActionListener(this);
}