From bb67df074e65fda1ce36ada443f6b741f9aaacc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=8D=AB=E6=B0=91?= <1597935114@qq.com> Date: Sat, 2 Jun 2018 12:49:14 +0800 Subject: [PATCH] =?UTF-8?q?#5=20=E7=AC=AC=E4=BA=94=E6=AC=A1=E5=AE=9E?= =?UTF-8?q?=E9=AA=8C=E6=8A=A5=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../soft1614080902434/Second_Activity.java | 80 ++++++++++++------ .../src/main/res/layout/activity_second_.xml | 1 + soft1614080902434/5.1.png | Bin 0 -> 240520 bytes soft1614080902434/5.2.png | Bin 0 -> 71177 bytes soft1614080902434/report5.md | 26 ++++++ 5 files changed, 83 insertions(+), 24 deletions(-) create mode 100644 soft1614080902434/5.1.png create mode 100644 soft1614080902434/5.2.png create mode 100644 soft1614080902434/report5.md diff --git a/soft1614080902434/2.app/2.app/src/main/java/edu/hzupps/androidlabs/soft1614080902434/Second_Activity.java b/soft1614080902434/2.app/2.app/src/main/java/edu/hzupps/androidlabs/soft1614080902434/Second_Activity.java index ab0e6e7e4..738074e70 100644 --- a/soft1614080902434/2.app/2.app/src/main/java/edu/hzupps/androidlabs/soft1614080902434/Second_Activity.java +++ b/soft1614080902434/2.app/2.app/src/main/java/edu/hzupps/androidlabs/soft1614080902434/Second_Activity.java @@ -1,44 +1,76 @@ package soft1614080902434.androidlabs.hzuapps.edu.soft1614080902434; +import android.content.Context; +import android.support.annotation.RequiresPermission; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; import android.view.View; +import android.widget.Button; +import android.widget.EditText; import android.widget.TextView; +import java.io.BufferedWriter; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; + public class Second_Activity extends AppCompatActivity implements View.OnClickListener { - TextView t[] = new TextView[12]; + EditText ed; + Button send; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_second_); + this.RegisterEcent(); } public void RegisterEcent(){ - t[0]=(TextView) findViewById(R.id.n_0); - t[1]=(TextView) findViewById(R.id.n_1); - t[2]=(TextView) findViewById(R.id.n_2); - t[3]=(TextView) findViewById(R.id.n_3); - t[4]=(TextView) findViewById(R.id.n_4); - t[5]=(TextView) findViewById(R.id.n_5); - t[6]=(TextView) findViewById(R.id.n_6); - t[7]=(TextView) findViewById(R.id.n_7); - t[8]=(TextView) findViewById(R.id.n_8); - t[9]=(TextView) findViewById(R.id.n_9); - t[10]=(TextView) findViewById(R.id.n_10); - t[11]=(TextView) findViewById(R.id.n_11); - t[12]=(TextView) findViewById(R.id.n_12); - t[13]=(TextView) findViewById(R.id.n_13); - t[14]=(TextView) findViewById(R.id.n_14); - t[15]=(TextView) findViewById(R.id.n_15); - t[16]=(TextView) findViewById(R.id.n_16); - for(int i=0;i<17;i++){ - t[i].setOnClickListener(this); - } - + ed = (EditText)findViewById(R.id.edit_text); + send = (Button)findViewById(R.id.n_12); + send.setOnClickListener(this); + Log.d("dd","789"); } - @Override - public void onClick(View v) { + public void save(String str){ + String data=str; + FileOutputStream out=null; + BufferedWriter writer=null; + + try{ + out =openFileOutput("wechat", Context.MODE_PRIVATE); + writer=new BufferedWriter(new OutputStreamWriter(out)); + Log.d("dd","456"); + writer.write(data); + } catch(IOException e){ + e.printStackTrace(); + } finally { + if (writer !=null){ + try { + writer.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + @Override + public void onClick(View view){ + if(view==send){ + String str =ed.getText().toString(); + this.save(str); + Log.d("dd","123"); + } +// for(int i=0;i<17;i++){ +// String str =t[i].getText().toString(); +// this.save(str); +// String s=couting.getText().toString(); +// ed.setText(s); +// +// } +// if(t[i]==view){ +// String str =t[i].getText().toString(); +// counting.append(str); +// } } } diff --git a/soft1614080902434/2.app/2.app/src/main/res/layout/activity_second_.xml b/soft1614080902434/2.app/2.app/src/main/res/layout/activity_second_.xml index 0c1c6934c..d30949b21 100644 --- a/soft1614080902434/2.app/2.app/src/main/res/layout/activity_second_.xml +++ b/soft1614080902434/2.app/2.app/src/main/res/layout/activity_second_.xml @@ -142,6 +142,7 @@ android:layout_x="269dp" android:layout_y="262dp" android:text="发送" + android:clickable="true" tools:layout_editor_absoluteX="298dp" tools:layout_editor_absoluteY="538dp" /> diff --git a/soft1614080902434/5.1.png b/soft1614080902434/5.1.png new file mode 100644 index 0000000000000000000000000000000000000000..5b5541cd15eadf44a0c48891f1983de46fd2d200 GIT binary patch literal 240520 zcmbrmWmKHOvMwAWxP@TB0>Og2OK^wa?(PgWI7x7a3=V?^cXvpzK?ipW?hH2gz{fuO zyKC=#&bhztpIN=??XK?Ws<*o8d3q+|tFjCx+6S~3FJ55E$x5odc!6y5;>8
QhCoNkvoJ?WWYpF1w3I25Uq=X%_b3+{i@{62
z9!V#{vlW)_#;doDWs9%c_OtJotR4HJFI^*lm+aD(wXpRVVS{a# ^
z7_ac!Ycs4Uys^@2Cd@d(xY@HfRNJ)dV0X}TG?c9$F$Vf>T?apK+mVPHK*B|5qCSRe
zYMbgy=aFbtI_e~~WOQ2aX7n7(M^NC|R-Jf+BG?zF_eS#ip#J(AGu-GrnL}y&5IwW1
zxhV=}UlCQlXyLroTDTluIL&pn@w{aDcAxy^R+1o#U+3}NGGDbWoLNxNXc6P!7{cJ7
zB~_SoPmf~a>N@(iT14%}!%;cOy5)qVY1iT|R?<`DV0Jj5PTp=WGJ1a4Z2B<>IhaNM
z0aynGStYMcH=pnsR<*9Cjv>v0ae%E8Rsd}z+(p-3TReZpQ&os@`Zxi@H}V4v&n
zVvU4)r#Y2C)COALzNdc$Xo>#6Uf|N~LPSQ}mtG!ZJVjkV%jHC}-ItKe$%Nsu{%&xB
zw>baZbjUll&L7lN>&}i@jK>$Ke*Qn^4Xg6BRv+Gdc?lA``OF)i7;4i!6vtfSvL$z;
z^+E`VqOzgZne5J#B~e-`sHv!^Y;A>oI!4N$9QB)>KI5%7kZGlyO;zYMnSIhJ%L3lM
zM7}2R%uXBkCM_nM(S!k0Q&Z+_Cd!0RbzyG?^ph=P