diff --git a/com1614080901245/51.jpg b/com1614080901245/51.jpg new file mode 100644 index 000000000..72b67c911 Binary files /dev/null and b/com1614080901245/51.jpg differ diff --git a/com1614080901245/52.PNG b/com1614080901245/52.PNG new file mode 100644 index 000000000..8529c46af Binary files /dev/null and b/com1614080901245/52.PNG differ diff --git a/com1614080901245/main/java/edu/hzuapps/androidlabs/com1614080901245/com1614080901245Activity.java b/com1614080901245/main/java/edu/hzuapps/androidlabs/com1614080901245/com1614080901245Activity.java index 070f031bc..ca3518889 100644 --- a/com1614080901245/main/java/edu/hzuapps/androidlabs/com1614080901245/com1614080901245Activity.java +++ b/com1614080901245/main/java/edu/hzuapps/androidlabs/com1614080901245/com1614080901245Activity.java @@ -1,39 +1,77 @@ package edu.hzuapps.androidlabs.com1614080901245; -import android.content.Intent; - -import android.support.v7.app.AppCompatActivity; - +import android.content.ContextWrapper; import android.os.Bundle; - +import android.support.design.widget.FloatingActionButton; +import android.support.design.widget.Snackbar; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.Toolbar; import android.view.View; - -import android.widget.TextView; - -import org.w3c.dom.Text; - -public class com1614080901245Activity extends AppCompatActivity { - private TextView textView; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.activity_com1614080901245); - textView=(TextView)findViewById(R.id.textview_01); - - - textView.setOnClickListener(new View.OnClickListener() { - - @Override - - public void onClick(View v) { - - Intent intent=new Intent(com1614080901245Activity.this,SecondActivity.class); - - startActivity(intent); - - } - - }); - } -} +import android.widget.EditText; +import android.widget.Button; + + public class com1614080901245Activity extends AppCompatActivity { + import java.io.BufferedWriter; + import java.io.FileOutputStream; + import java.io.IOException; + import java.io.OutputStreamWriter; + + @Override + public class com1614080901245Activity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_com1614080901245); + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_com1614080901245); + Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + setSupportActionBar(toolbar); + + FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); + fab.setOnClickListener(new View.OnClickListener() { + FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); + fab.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) + .setAction("Action", null).show(); + } + public void onClick(View view) { + Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) + .setAction("Action", null).show(); + } + }); + } + + } + ((Button) findViewById(R.id.button_save)).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + String text = ((EditText) findViewById(R.id.editText)).getText().toString(); + save(text); + } + }); + } + public void save(String text){ + FileOutputStream out=null; + BufferedWriter writer=null; + try{ + out=openFileOutput("save", ContextWrapper.MODE_APPEND); + writer=new BufferedWriter(new OutputStreamWriter(out)); + writer.write(text); + }catch (IOException e){ + e.printStackTrace(); + }finally { + try { + if(writer!=null){ + writer.close(); + } + }catch (IOException e){ + e.printStackTrace(); + } + } + } + } \ No newline at end of file diff --git a/com1614080901245/main/res/layout/activity_com1614080901245.xml b/com1614080901245/main/res/layout/activity_com1614080901245.xml index 9f17e569d..26ac1fbbd 100644 --- a/com1614080901245/main/res/layout/activity_com1614080901245.xml +++ b/com1614080901245/main/res/layout/activity_com1614080901245.xml @@ -25,4 +25,16 @@ android:drawableTop="@drawable/tongxun" android:text=" 点击查看详情" /> +