Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid: how to get spinner value and check the condition
    primarykey
    data
    text
    <p>In my app i have a spinner with two items ..i have to choose the item an do action accordingly</p> <pre><code> dialogButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { String Comment = edittext.getText().toString(); String choose = spinner.getSelectedItem() .toString(); if (Comment != null &amp;&amp; Comment.equalsIgnoreCase("")){ post(Comment,choose); getActivity().finish(); }else{ showToast("Please enter you comment!"); } } }); dialog.show(); dialog.getWindow().setAttributes(lp); } catch (Exception e) { e.printStackTrace(); getActivity().finish(); } } private void post(String comments, String choose) throws Exception{ StringBuffer finalMessage = new StringBuffer("\nRecomends " + Data.getfName()); if(Data.getAddress() != null &amp;&amp; !Data.getAddress().isEmpty()){ finalMessage.append("\n" + Data.getAddress()); } -----------------&gt; if(spinner.getSelectedItem().toString().equals("Post to personal directory &amp;#38; FB")){ Bundle params = new Bundle(); params.putString("message",finalMessage.toString() ); publishStory(params,comments); }else { try { new FBUtils(activity).sharePlaces(attractionData, comments, null); } catch (Exception e) { Log.e(TAG,"sharePlaces error ",e); } } } private void publishStory(Bundle postParams,final String comments,final String choose) { Session session = Session.getActiveSession(); if (session != null){ List&lt;String&gt; permissions = session.getPermissions(); if (!isSubsetOf(PERMISSIONS, permissions)) { Session.NewPermissionsRequest newPermissionsRequest = new Session .NewPermissionsRequest(this, PERMISSIONS); session.requestNewPublishPermissions(newPermissionsRequest); } Request.Callback callbackRequest= new Request.Callback() { public void onCompleted(Response response) { if (response == null || response.equals("") || response.equals("false")) { showToast("Blank response."); } else new fbUtils(activity).share(Data, comments, response.getError(),choose); } catch (Exception e) { Log.e(TAG,"sharePlaces error ",e); } } }; Request request = new Request(session, Constants.fb.fbId + "/comments", postParams, HttpMethod.POST, callbackRequest); RequestAsyncTask task = new RequestAsyncTask(request); task.execute(); } </code></pre> <p>the issue is the <code>post()</code> is not executing when clicking the dailogbutton its going into else part, i want to execute the if condition in <code>post()</code> method, Any help is appreciated</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload