Android Open Source - ArchPad C Note Create Activity






From Project

Back to project page ArchPad.

License

The source code is released under:

GNU General Public License

If you think the Android project ArchPad 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.Andryyo.ArchPad.note;
//ww w .  jav  a 2 s.  c om
import android.app.AlertDialog;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Gravity;
import android.widget.EditText;
import com.Andryyo.ArchPad.R;
import com.Andryyo.ArchPad.database.CSQLiteOpenHelper;

import java.util.Calendar;

/**
 * Created with IntelliJ IDEA.
 * User: ???????
 * Date: 20.06.13
 * Time: 17:36
 * To change this template use File | Settings | File Templates.
 */
public class CNoteCreateActivity extends FragmentActivity{

    EditText text;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        text = new EditText(this);
        text.setGravity(Gravity.TOP|Gravity.LEFT);
        if (savedInstanceState!=null)
            text.setText(savedInstanceState.getString("text"));
        setContentView(text);
    }

    @Override
    public void onSaveInstanceState(Bundle out)   {
        out.putString("text",text.getText().toString());
        super.onSaveInstanceState(out);
    }

    @Override
    public void onBackPressed() {
        String string = text.getText().toString();
        if (!string.equals("")) {
            if (string.indexOf("\n")!=-1)
                CSQLiteOpenHelper.getHelper(this).addNote(
                    string.substring(0, string.indexOf("\n")),
                    text.getText().toString(),
                    Calendar.getInstance().getTimeInMillis()
                );
            else
                CSQLiteOpenHelper.getHelper(this).addNote(
                        text.getText().toString(),
                        text.getText().toString(),
                        Calendar.getInstance().getTimeInMillis()
                );
        }
        super.onBackPressed();
    }
}




Java Source Code List

com.Andryyo.ArchPad.CArrow.java
com.Andryyo.ArchPad.CShot.java
com.Andryyo.ArchPad.MainActivity.java
com.Andryyo.ArchPad.archeryFragment.CArcheryFragment.java
com.Andryyo.ArchPad.archeryFragment.CCurrentEndView.java
com.Andryyo.ArchPad.archeryFragment.CDistanceTemplate.java
com.Andryyo.ArchPad.archeryFragment.CDistance.java
com.Andryyo.ArchPad.archeryFragment.CRoundTemplate.java
com.Andryyo.ArchPad.archeryFragment.CRound.java
com.Andryyo.ArchPad.archeryFragment.IOnShotAddListener.java
com.Andryyo.ArchPad.archeryFragment.?EndsCounterView.java
com.Andryyo.ArchPad.database.CSQLiteOpenHelper.java
com.Andryyo.ArchPad.note.CNoteCreateActivity.java
com.Andryyo.ArchPad.note.CNotesFragment.java
com.Andryyo.ArchPad.sight.CSightSelectFragment.java
com.Andryyo.ArchPad.sight.?SightPropertiesFragment.java
com.Andryyo.ArchPad.start.CArrowSelectView.java
com.Andryyo.ArchPad.start.CColorSelectView.java
com.Andryyo.ArchPad.start.CRoundSelectView.java
com.Andryyo.ArchPad.start.CStartFragment.java
com.Andryyo.ArchPad.start.CTargetSelectView.java
com.Andryyo.ArchPad.start.IOnFragmentSwapRequiredListener.java
com.Andryyo.ArchPad.statistics.CBorderedTextView.java
com.Andryyo.ArchPad.statistics.CRecordViewFragment.java
com.Andryyo.ArchPad.statistics.CStatisticsFragment.java
com.Andryyo.ArchPad.statistics.IOnUpdateListener.java
com.Andryyo.ArchPad.target.CEditableTargetView.java
com.Andryyo.ArchPad.target.CRing.java
com.Andryyo.ArchPad.target.CTargetView.java
com.Andryyo.ArchPad.target.CTarget.java
com.Andryyo.ArchPad.target.CZoomableTargetView.java