Program: 15234
Project: 15234
Buggy source:
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  Bundle extras=getIntent().getExtras();
  if (WordPress.wpDB == null)   WordPress.wpDB=new WordPressDB(this);
  categories=new JSONArray();
  String action=getIntent().getAction();
  if (Intent.ACTION_SEND.equals(action) || Intent.ACTION_SEND_MULTIPLE.equals(action)) {
    isAction=true;
    isNew=true;
    Vector<?> accounts=WordPress.wpDB.getAccounts(this);
    if (accounts.size() > 0) {
      final String blogNames[]=new String[accounts.size()];
      final int accountIDs[]=new int[accounts.size()];
      for (int i=0; i < accounts.size(); i++) {
        HashMap<?,?> curHash=(HashMap<?,?>)accounts.get(i);
        try {
          blogNames[i]=EscapeUtils.unescapeHtml(curHash.get("String_Node_Str").toString());
        }
 catch (        Exception e) {
          blogNames[i]=curHash.get("String_Node_Str").toString();
        }
        accountIDs[i]=(Integer)curHash.get("String_Node_Str");
        blog=new Blog(accountIDs[i],EditPost.this);
      }
      if (accounts.size() != 1) {
        AlertDialog.Builder builder=new AlertDialog.Builder(this);
        builder.setTitle(getResources().getText(R.string.select_a_blog));
        builder.setItems(blogNames,new DialogInterface.OnClickListener(){
          public void onClick(          DialogInterface dialog,          int item){
            id=accountIDs[item];
            blog=new Blog(id,EditPost.this);
            accountName=blogNames[item];
            setTitle(accountName + "String_Node_Str" + getResources().getText((isPage) ? R.string.new_page : R.string.new_post));
            setContent();
            lbsCheck();
          }
        }
);
        AlertDialog alert=builder.create();
        alert.show();
      }
 else {
        id=accountIDs[0];
        blog=new Blog(id,EditPost.this);
        accountName=blogNames[0];
        setTitle(accountName + "String_Node_Str" + getResources().getText((isPage) ? R.string.new_page : R.string.new_post));
        setContent();
      }
    }
 else {
      Intent i=new Intent(this,Dashboard.class);
      Toast.makeText(getApplicationContext(),getResources().getText(R.string.no_account),Toast.LENGTH_LONG).show();
      startActivity(i);
      finish();
    }
  }
 else {
    if (extras != null) {
      id=WordPress.currentBlog.getId();
      blog=new Blog(id,this);
      accountName=EscapeUtils.unescapeHtml(extras.getString("String_Node_Str"));
      postID=extras.getLong("String_Node_Str");
      localDraft=extras.getBoolean("String_Node_Str",false);
      isPage=extras.getBoolean("String_Node_Str",false);
      isNew=extras.getBoolean("String_Node_Str",false);
      option=extras.getString("String_Node_Str");
      if (!isNew)       post=new Post(id,postID,isPage,this);
    }
  }
  Display display=((WindowManager)getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
  int width=display.getWidth();
  int height=display.getHeight();
  if (height > width) {
    width=height;
  }
  if (width > 480) {
    isLargeScreen=true;
  }
  if (isPage) {
    setContentView(R.layout.edit_page);
  }
 else {
    setContentView(R.layout.edit);
    if (blog.getPostFormats().equals("String_Node_Str")) {
      Vector<Object> args=new Vector<Object>();
      args.add(blog);
      args.add(this);
      new ApiHelper.getPostFormatsTask().execute(args);
      postFormatTitles=getResources().getStringArray(R.array.post_formats_array);
      String defaultPostFormatTitles[]={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
      postFormats=defaultPostFormatTitles;
    }
 else {
      try {
        JSONObject jsonPostFormats=new JSONObject(blog.getPostFormats());
        postFormats=new String[jsonPostFormats.length()];
        postFormatTitles=new String[jsonPostFormats.length()];
        Iterator<?> it=jsonPostFormats.keys();
        int i=0;
        while (it.hasNext()) {
          String key=(String)it.next();
          String val=(String)jsonPostFormats.get(key);
          postFormats[i]=key;
          postFormatTitles[i]=val;
          i++;
        }
        java.util.Arrays.sort(postFormats);
        java.util.Arrays.sort(postFormatTitles);
      }
 catch (      JSONException e) {
        e.printStackTrace();
      }
    }
    Spinner pfSpinner=(Spinner)findViewById(R.id.postFormat);
    ArrayAdapter<String> pfAdapter=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,postFormatTitles);
    pfAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    pfSpinner.setAdapter(pfAdapter);
    String activePostFormat="String_Node_Str";
    if (!isNew) {
      if (!post.getWP_post_format().equals("String_Node_Str"))       activePostFormat=post.getWP_post_format();
    }
    for (int i=0; i < postFormats.length; i++) {
      if (postFormats[i].equals(activePostFormat))       pfSpinner.setSelection(i);
    }
    lbsCheck();
  }
  String[] items=new String[]{getResources().getString(R.string.publish_post),getResources().getString(R.string.draft),getResources().getString(R.string.pending_review),getResources().getString(R.string.post_private),getResources().getString(R.string.local_draft)};
  Spinner spinner=(Spinner)findViewById(R.id.status);
  ArrayAdapter<String> adapter=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,items);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  spinner.setAdapter(adapter);
  if (isNew) {
    setTitle(accountName + "String_Node_Str" + getResources().getText((isPage) ? R.string.new_page : R.string.new_post));
  }
 else {
    setTitle(accountName + "String_Node_Str" + getResources().getText((isPage) ? R.string.edit_page : R.string.edit_post));
  }
  if (isNew) {
    if (!isAction) {
      if (!isPage) {
        enableLBSButtons();
      }
    }
    if (option != null) {
      Intent i=new Intent(EditPost.this,EditContent.class);
      i.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
      i.putExtra("String_Node_Str",option);
      startActivityForResult(i,0);
    }
  }
 else {
    EditText titleET=(EditText)findViewById(R.id.title);
    WPEditText contentET=(WPEditText)findViewById(R.id.postContent);
    EditText passwordET=(EditText)findViewById(R.id.post_password);
    titleET.setText(post.getTitle());
    if (post.isUploaded()) {
      items=new String[]{getResources().getString(R.string.publish_post),getResources().getString(R.string.draft),getResources().getString(R.string.pending_review),getResources().getString(R.string.post_private)};
      adapter=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,items);
      spinner.setAdapter(adapter);
    }
    String contentHTML;
    if (!post.getMt_text_more().equals("String_Node_Str")) {
      contentHTML=post.getDescription() + "String_Node_Str" + getResources().getText(R.string.more_tag)+ "String_Node_Str"+ post.getMt_text_more();
    }
 else {
      contentHTML=post.getDescription();
    }
    contentET.setText(WPHtml.fromHtml(contentHTML,EditPost.this,post));
    long pubDate=post.getDate_created_gmt();
    if (pubDate != 0) {
      try {
        Date date=new Date(pubDate);
        SimpleDateFormat sdf=new SimpleDateFormat("String_Node_Str");
        String sPubDate=sdf.format(date);
        TextView tvPubDate=(TextView)findViewById(R.id.pubDate);
        tvPubDate.setText(sPubDate);
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
    if (post.getWP_password() != null)     passwordET.setText(post.getWP_password());
    if (post.getPost_status() != null) {
      String status=post.getPost_status();
      if (status.equals("String_Node_Str")) {
        spinner.setSelection(0,true);
      }
 else       if (status.equals("String_Node_Str")) {
        spinner.setSelection(1,true);
      }
 else       if (status.equals("String_Node_Str")) {
        spinner.setSelection(2,true);
      }
 else       if (status.equals("String_Node_Str")) {
        spinner.setSelection(3,true);
      }
 else       if (status.equals("String_Node_Str")) {
        spinner.setSelection(4,true);
      }
    }
    if (!isPage) {
      if (post.getCategories() != null) {
        categories=post.getCategories();
        if (!categories.equals("String_Node_Str")) {
          for (int i=0; i < categories.length(); i++) {
            try {
              selectedCategories.add(categories.getString(i));
            }
 catch (            JSONException e) {
              e.printStackTrace();
            }
          }
          TextView tvCategories=(TextView)findViewById(R.id.selectedCategories);
          tvCategories.setText(getResources().getText(R.string.selected_categories) + "String_Node_Str" + getCategoriesCSV());
        }
      }
    }
    if (blog.isLocation()) {
      enableLBSButtons();
    }
    Double latitude=post.getLatitude();
    Double longitude=post.getLongitude();
    if (latitude != 0.0) {
      new getAddressTask().execute(latitude,longitude);
    }
    if (blog.isLocation() && latitude > 0) {
      Button updateLocation=(Button)findViewById(R.id.updateLocation);
      updateLocation.setOnClickListener(new Button.OnClickListener(){
        public void onClick(        View v){
          lm=(LocationManager)getSystemService(LOCATION_SERVICE);
          lm.requestLocationUpdates(LocationManager.GPS_PROVIDER,20000,0,EditPost.this);
          lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,20000,0,EditPost.this);
          locationActive=true;
        }
      }
);
      RelativeLayout locationSection=(RelativeLayout)findViewById(R.id.section4);
      locationSection.setVisibility(View.VISIBLE);
    }
 else     if (blog.isLocation()) {
      lm=(LocationManager)getSystemService(LOCATION_SERVICE);
      lm.requestLocationUpdates(LocationManager.GPS_PROVIDER,20000,0,EditPost.this);
      lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,20000,0,EditPost.this);
      locationActive=true;
      RelativeLayout locationSection=(RelativeLayout)findViewById(R.id.section4);
      locationSection.setVisibility(View.VISIBLE);
    }
    String tags=post.getMt_keywords();
    if (!tags.equals("String_Node_Str")) {
      EditText tagsET=(EditText)findViewById(R.id.tags);
      tagsET.setText(tags);
    }
  }
  if (!isPage) {
    Button selectCategories=(Button)findViewById(R.id.selectCategories);
    selectCategories.setOnClickListener(new Button.OnClickListener(){
      public void onClick(      View v){
        Bundle bundle=new Bundle();
        bundle.putInt("String_Node_Str",id);
        if (categories.length() > 0) {
          bundle.putString("String_Node_Str",getCategoriesCSV());
        }
        Intent i=new Intent(EditPost.this,SelectCategories.class);
        i.putExtras(bundle);
        startActivityForResult(i,1);
      }
    }
);
  }
  final WPEditText content=(WPEditText)findViewById(R.id.postContent);
  content.setOnFocusChangeListener(new View.OnFocusChangeListener(){
    @Override public void onFocusChange(    View view,    boolean hasFocus){
      if (hasFocus) {
        Intent i=new Intent(EditPost.this,EditContent.class);
        WordPress.richPostContent=content.getText();
        i.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        startActivityForResult(i,0);
      }
    }
  }
);
  final Button saveButton=(Button)findViewById(R.id.post);
  saveButton.setOnClickListener(new Button.OnClickListener(){
    public void onClick(    View v){
      boolean result=savePost();
      if (result) {
        if (post.isUploaded() || !post.getPost_status().equals("String_Node_Str"))         post.upload();
        finish();
      }
    }
  }
);
  Button pubDate=(Button)findViewById(R.id.pubDateButton);
  pubDate.setOnClickListener(new TextView.OnClickListener(){
    public void onClick(    View v){
      Calendar c=Calendar.getInstance();
      mYear=c.get(Calendar.YEAR);
      mMonth=c.get(Calendar.MONTH);
      mDay=c.get(Calendar.DAY_OF_MONTH);
      mHour=c.get(Calendar.HOUR_OF_DAY);
      mMinute=c.get(Calendar.MINUTE);
      showDialog(ID_DIALOG_DATE);
    }
  }
);
}

Fixed version (ground truth):
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  Bundle extras=getIntent().getExtras();
  if (WordPress.wpDB == null)   WordPress.wpDB=new WordPressDB(this);
  categories=new JSONArray();
  String action=getIntent().getAction();
  if (Intent.ACTION_SEND.equals(action) || Intent.ACTION_SEND_MULTIPLE.equals(action)) {
    isAction=true;
    isNew=true;
    Vector<?> accounts=WordPress.wpDB.getAccounts(this);
    if (accounts.size() > 0) {
      final String blogNames[]=new String[accounts.size()];
      final int accountIDs[]=new int[accounts.size()];
      for (int i=0; i < accounts.size(); i++) {
        HashMap<?,?> curHash=(HashMap<?,?>)accounts.get(i);
        try {
          blogNames[i]=EscapeUtils.unescapeHtml(curHash.get("String_Node_Str").toString());
        }
 catch (        Exception e) {
          blogNames[i]=curHash.get("String_Node_Str").toString();
        }
        accountIDs[i]=(Integer)curHash.get("String_Node_Str");
        blog=new Blog(accountIDs[i],EditPost.this);
      }
      if (accounts.size() != 1) {
        AlertDialog.Builder builder=new AlertDialog.Builder(this);
        builder.setTitle(getResources().getText(R.string.select_a_blog));
        builder.setItems(blogNames,new DialogInterface.OnClickListener(){
          public void onClick(          DialogInterface dialog,          int item){
            id=accountIDs[item];
            blog=new Blog(id,EditPost.this);
            accountName=blogNames[item];
            setTitle(accountName + "String_Node_Str" + getResources().getText((isPage) ? R.string.new_page : R.string.new_post));
            setContent();
            lbsCheck();
          }
        }
);
        AlertDialog alert=builder.create();
        alert.show();
      }
 else {
        id=accountIDs[0];
        blog=new Blog(id,EditPost.this);
        accountName=blogNames[0];
        setTitle(accountName + "String_Node_Str" + getResources().getText((isPage) ? R.string.new_page : R.string.new_post));
        setContent();
      }
    }
 else {
      Intent i=new Intent(this,Dashboard.class);
      Toast.makeText(getApplicationContext(),getResources().getText(R.string.no_account),Toast.LENGTH_LONG).show();
      startActivity(i);
      finish();
    }
  }
 else {
    if (extras != null) {
      id=WordPress.currentBlog.getId();
      blog=new Blog(id,this);
      accountName=EscapeUtils.unescapeHtml(extras.getString("String_Node_Str"));
      postID=extras.getLong("String_Node_Str");
      localDraft=extras.getBoolean("String_Node_Str",false);
      isPage=extras.getBoolean("String_Node_Str",false);
      isNew=extras.getBoolean("String_Node_Str",false);
      option=extras.getString("String_Node_Str");
      if (!isNew)       post=new Post(id,postID,isPage,this);
    }
  }
  Display display=((WindowManager)getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay();
  int width=display.getWidth();
  int height=display.getHeight();
  if (height > width) {
    width=height;
  }
  if (width > 480) {
    isLargeScreen=true;
  }
  if (isPage) {
    setContentView(R.layout.edit_page);
  }
 else {
    setContentView(R.layout.edit);
    if (blog.getPostFormats().equals("String_Node_Str")) {
      Vector<Object> args=new Vector<Object>();
      args.add(blog);
      args.add(this);
      new ApiHelper.getPostFormatsTask().execute(args);
      postFormatTitles=getResources().getStringArray(R.array.post_formats_array);
      String defaultPostFormatTitles[]={"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"};
      postFormats=defaultPostFormatTitles;
    }
 else {
      try {
        JSONObject jsonPostFormats=new JSONObject(blog.getPostFormats());
        postFormats=new String[jsonPostFormats.length()];
        postFormatTitles=new String[jsonPostFormats.length()];
        Iterator<?> it=jsonPostFormats.keys();
        int i=0;
        while (it.hasNext()) {
          String key=(String)it.next();
          String val=(String)jsonPostFormats.get(key);
          postFormats[i]=key;
          postFormatTitles[i]=val;
          i++;
        }
        java.util.Arrays.sort(postFormats);
        java.util.Arrays.sort(postFormatTitles);
      }
 catch (      JSONException e) {
        e.printStackTrace();
      }
    }
    Spinner pfSpinner=(Spinner)findViewById(R.id.postFormat);
    ArrayAdapter<String> pfAdapter=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,postFormatTitles);
    pfAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    pfSpinner.setAdapter(pfAdapter);
    String activePostFormat="String_Node_Str";
    if (!isNew) {
      if (!post.getWP_post_format().equals("String_Node_Str"))       activePostFormat=post.getWP_post_format();
    }
    for (int i=0; i < postFormats.length; i++) {
      if (postFormats[i].equals(activePostFormat))       pfSpinner.setSelection(i);
    }
    lbsCheck();
  }
  String[] items=new String[]{getResources().getString(R.string.publish_post),getResources().getString(R.string.draft),getResources().getString(R.string.pending_review),getResources().getString(R.string.post_private),getResources().getString(R.string.local_draft)};
  Spinner spinner=(Spinner)findViewById(R.id.status);
  ArrayAdapter<String> adapter=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,items);
  adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  spinner.setAdapter(adapter);
  if (isNew) {
    setTitle(accountName + "String_Node_Str" + getResources().getText((isPage) ? R.string.new_page : R.string.new_post));
  }
 else {
    setTitle(accountName + "String_Node_Str" + getResources().getText((isPage) ? R.string.edit_page : R.string.edit_post));
  }
  if (isNew) {
    if (!isAction) {
      if (!isPage) {
        enableLBSButtons();
      }
    }
    if (option != null) {
      Intent i=new Intent(EditPost.this,EditContent.class);
      i.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
      i.putExtra("String_Node_Str",option);
      startActivityForResult(i,0);
    }
  }
 else {
    EditText titleET=(EditText)findViewById(R.id.title);
    WPEditText contentET=(WPEditText)findViewById(R.id.postContent);
    EditText passwordET=(EditText)findViewById(R.id.post_password);
    titleET.setText(post.getTitle());
    if (post.isUploaded()) {
      items=new String[]{getResources().getString(R.string.publish_post),getResources().getString(R.string.draft),getResources().getString(R.string.pending_review),getResources().getString(R.string.post_private)};
      adapter=new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,items);
      spinner.setAdapter(adapter);
    }
    String contentHTML;
    if (!post.getMt_text_more().equals("String_Node_Str")) {
      contentHTML=post.getDescription() + "String_Node_Str" + getResources().getText(R.string.more_tag)+ "String_Node_Str"+ post.getMt_text_more();
    }
 else {
      contentHTML=post.getDescription();
    }
    contentET.setText(WPHtml.fromHtml(StringHelper.addPTags(contentHTML),EditPost.this,post));
    long pubDate=post.getDate_created_gmt();
    if (pubDate != 0) {
      try {
        Date date=new Date(pubDate);
        SimpleDateFormat sdf=new SimpleDateFormat("String_Node_Str");
        String sPubDate=sdf.format(date);
        TextView tvPubDate=(TextView)findViewById(R.id.pubDate);
        tvPubDate.setText(sPubDate);
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
    if (post.getWP_password() != null)     passwordET.setText(post.getWP_password());
    if (post.getPost_status() != null) {
      String status=post.getPost_status();
      if (status.equals("String_Node_Str")) {
        spinner.setSelection(0,true);
      }
 else       if (status.equals("String_Node_Str")) {
        spinner.setSelection(1,true);
      }
 else       if (status.equals("String_Node_Str")) {
        spinner.setSelection(2,true);
      }
 else       if (status.equals("String_Node_Str")) {
        spinner.setSelection(3,true);
      }
 else       if (status.equals("String_Node_Str")) {
        spinner.setSelection(4,true);
      }
    }
    if (!isPage) {
      if (post.getCategories() != null) {
        categories=post.getCategories();
        if (!categories.equals("String_Node_Str")) {
          for (int i=0; i < categories.length(); i++) {
            try {
              selectedCategories.add(categories.getString(i));
            }
 catch (            JSONException e) {
              e.printStackTrace();
            }
          }
          TextView tvCategories=(TextView)findViewById(R.id.selectedCategories);
          tvCategories.setText(getResources().getText(R.string.selected_categories) + "String_Node_Str" + getCategoriesCSV());
        }
      }
    }
    if (blog.isLocation()) {
      enableLBSButtons();
    }
    Double latitude=post.getLatitude();
    Double longitude=post.getLongitude();
    if (latitude != 0.0) {
      new getAddressTask().execute(latitude,longitude);
    }
    if (blog.isLocation() && latitude > 0) {
      Button updateLocation=(Button)findViewById(R.id.updateLocation);
      updateLocation.setOnClickListener(new Button.OnClickListener(){
        public void onClick(        View v){
          lm=(LocationManager)getSystemService(LOCATION_SERVICE);
          lm.requestLocationUpdates(LocationManager.GPS_PROVIDER,20000,0,EditPost.this);
          lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,20000,0,EditPost.this);
          locationActive=true;
        }
      }
);
      RelativeLayout locationSection=(RelativeLayout)findViewById(R.id.section4);
      locationSection.setVisibility(View.VISIBLE);
    }
 else     if (blog.isLocation()) {
      lm=(LocationManager)getSystemService(LOCATION_SERVICE);
      lm.requestLocationUpdates(LocationManager.GPS_PROVIDER,20000,0,EditPost.this);
      lm.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,20000,0,EditPost.this);
      locationActive=true;
      RelativeLayout locationSection=(RelativeLayout)findViewById(R.id.section4);
      locationSection.setVisibility(View.VISIBLE);
    }
    String tags=post.getMt_keywords();
    if (!tags.equals("String_Node_Str")) {
      EditText tagsET=(EditText)findViewById(R.id.tags);
      tagsET.setText(tags);
    }
  }
  if (!isPage) {
    Button selectCategories=(Button)findViewById(R.id.selectCategories);
    selectCategories.setOnClickListener(new Button.OnClickListener(){
      public void onClick(      View v){
        Bundle bundle=new Bundle();
        bundle.putInt("String_Node_Str",id);
        if (categories.length() > 0) {
          bundle.putString("String_Node_Str",getCategoriesCSV());
        }
        Intent i=new Intent(EditPost.this,SelectCategories.class);
        i.putExtras(bundle);
        startActivityForResult(i,1);
      }
    }
);
  }
  final WPEditText content=(WPEditText)findViewById(R.id.postContent);
  content.setOnFocusChangeListener(new View.OnFocusChangeListener(){
    @Override public void onFocusChange(    View view,    boolean hasFocus){
      if (hasFocus) {
        Intent i=new Intent(EditPost.this,EditContent.class);
        WordPress.richPostContent=content.getText();
        i.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
        startActivityForResult(i,0);
      }
    }
  }
);
  final Button saveButton=(Button)findViewById(R.id.post);
  saveButton.setOnClickListener(new Button.OnClickListener(){
    public void onClick(    View v){
      boolean result=savePost();
      if (result) {
        if (post.isUploaded() || !post.getPost_status().equals("String_Node_Str"))         post.upload();
        finish();
      }
    }
  }
);
  Button pubDate=(Button)findViewById(R.id.pubDateButton);
  pubDate.setOnClickListener(new TextView.OnClickListener(){
    public void onClick(    View v){
      Calendar c=Calendar.getInstance();
      mYear=c.get(Calendar.YEAR);
      mMonth=c.get(Calendar.MONTH);
      mDay=c.get(Calendar.DAY_OF_MONTH);
      mHour=c.get(Calendar.HOUR_OF_DAY);
      mMinute=c.get(Calendar.MINUTE);
      showDialog(ID_DIALOG_DATE);
    }
  }
);
}