Android Open Source - get-it-done Edit Item Activity






From Project

Back to project page get-it-done.

License

The source code is released under:

MIT License

If you think the Android project get-it-done listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.codepath.example.getitdone;
//from w w  w  .  ja  v  a 2s. com
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

public class EditItemActivity extends Activity {

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_edit_item);
    String taskText = getIntent().getStringExtra("taskText");
    EditText etEditItem = (EditText) findViewById(R.id.etEditItem);
    etEditItem.setText(taskText);
    etEditItem.setSelection(etEditItem.length());
    etEditItem.requestFocus();
  }
  
  public void saveItem(View v) {
    EditText editedItem = (EditText) findViewById(R.id.etEditItem);
    Intent data = new Intent();
    data.putExtra("editedText", editedItem.getText().toString());
    data.putExtra("itemNum", getIntent().getIntExtra("taskNum", 0));
    setResult(RESULT_OK, data);
    finish();
  }
}




Java Source Code List

com.codepath.example.getitdone.EditItemActivity.java
com.codepath.example.getitdone.TodoActivity.java