Пример #1
0
  private boolean displayDiscussionInfo() {

    final AlertDialog.Builder builder = new AlertDialog.Builder(DiscussionActivity.this);
    LayoutInflater inflater = DiscussionActivity.this.getLayoutInflater();
    final View v = inflater.inflate(R.layout.about_discussion, null);

    final ProgressDialog dia =
        ProgressDialog.show(DiscussionActivity.this, null, getString(R.string.alert_loading));
    dia.setCanceledOnTouchOutside(false);
    ParseQuery<Discussion> discussionQuery = Discussion.getDiscussionQuery();
    discussionQuery.getInBackground(
        discussionTableName,
        new GetCallback<Discussion>() {
          public void done(Discussion currentDiscussion, ParseException e) {
            if ((e == null) && (currentDiscussion != null)) {
              fetchDiscussionInformation(v, currentDiscussion);
            }

            dia.dismiss();
          }
        });

    builder
        .setView(v)
        .setTitle(discussionTopic + " (" + messagesList.size() + " messages)")
        .setPositiveButton(R.string.ok, null)
        .create()
        .show();

    return true;
  }
Пример #2
0
 private void saveDiscussionObject() {
   if (discussionTableName != null) {
     ParseQuery<Discussion> discussionQuery = Discussion.getDiscussionQuery();
     discussionQuery.getInBackground(
         discussionTableName,
         new GetCallback<Discussion>() {
           public void done(Discussion returnedDiscussion, ParseException e) {
             if (e == null) {
               discussionObject = returnedDiscussion;
             }
           }
         });
   }
 }