Back to project page sugar.
The source code is released under:
Copyright (C) 2012 by Satya Narayan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the S...
If you think the Android project sugar listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.example; //from w ww .java 2 s . co m import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.LinearLayout; import android.widget.TextView; import static com.orm.SugarRecord.save; public class AddNoteActivity extends Activity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); LinearLayout view = (LinearLayout) findViewById(R.id.layout); TextView titleText = new TextView(this); titleText.setText("Title"); TextView descText = new TextView(this); descText.setText("Description"); TextView tagText = new TextView(this); tagText.setText("Tag"); final EditText titleBox = new EditText(this); final EditText descBox = new EditText(this); final EditText tagBox = new EditText(this); Button save = new Button(this); save.setText("Save"); view.addView(titleText); view.addView(titleBox); view.addView(descText); view.addView(descBox); view.addView(tagText); view.addView(tagBox); view.addView(save); save.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { Tag tag = new Tag(tagBox.getText().toString()); save(tag); save(new Note(10 + (int) (10 * Math.random()), titleBox.getText().toString(), descBox.getText().toString(), tag)); Intent intent = new Intent(AddNoteActivity.this, NoteListActivity.class); startActivity(intent); } }); } }