Back to project page LearnByHeart.
The source code is released under:
Apache License
If you think the Android project LearnByHeart 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.mps.learn.pb.ui.activities; /*from ww w . j a va2 s. c om*/ import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import com.mps.learn.pb.PhraseManager; import com.mps.learn.pb.R; import com.mps.learn.pb.model.PhraseModel; public class AddPhraseActivity extends Activity implements OnClickListener{ @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_phrase); initView(); } private EditText mEditTextTitle, mEditTextUsagePb, mEditTextUsageEng, mEditTextAddPhraseImgUrl; private Button mBtnSave; private void initView(){ mEditTextTitle = (EditText)findViewById(R.id.et_title); mEditTextUsagePb = (EditText)findViewById(R.id.et_usage_pb); mEditTextUsageEng = (EditText)findViewById(R.id.et_usage_eng); mEditTextAddPhraseImgUrl = (EditText)findViewById(R.id.et_add_url); mBtnSave = (Button)findViewById(R.id.btnSave); mBtnSave.setOnClickListener(this); } @Override public void onClick(View v) { // TODO Auto-generated method stub switch(v.getId()){ case R.id.btnSave :{ PhraseModel modelInstance = PhraseManager.getInstance().createAndSavePhraseModel( mEditTextTitle.getText().toString().trim(), mEditTextUsagePb.getText().toString().trim(), mEditTextUsageEng.getText().toString().trim(), mEditTextAddPhraseImgUrl.getText().toString().trim()); if(modelInstance != null){ PhraseManager.getInstance().addPhrase(0, modelInstance); } }break; } } }