<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.test1"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!--
<activity android:name="F1_TC"></activity>
-->
<activity android:name="com.example.test1.F1_TC"
android:label="@string/title_activity_f1__tc"
android:parentActivityName="android.support.v4.app.FragmentActivity">
<meta-data android:name="android.support.PARENT_ACTIVITY"
android:value="android.support.v4.app.FragmentActivity" />
</activity>
</application>
</manifest>
/////////////////////////////////////////////////////////////////////////////
package com.example.test1;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
////////////////////
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import android.os.Environment;
import android.widget.ArrayAdapter;
import android.support.v4.app.NavUtils;
import android.app.ListActivity;
////////////////////
public class F1_TC extends ActionBarActivity {
////////////////////
private List<String> items = null;
////////////////////
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//setContentView(R.layout.activity_f1__tc);
setContentView(R.layout.activity_f1__tc);
////////////////////
// Show the Up button in the action bar.
//getActionBar().setDisplayHomeAsUpEnabled(true);
//getFiles(new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/").listFiles());
////////////////////
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
//getMenuInflater().inflate(R.menu.f1__tc, menu);
getMenuInflater().inflate(R.menu.f1__tc, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
/////////////////////////////////////////////////////////////////////////////
package com.example.test1;
import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
////////////////////
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import android.content.Intent;
////////////////////
public class MainActivity extends ActionBarActivity {
////////////////////
private Button myButton;
private EditText myText;
private Button myButton01;
////////////////////
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//////////1/////////
myButton = (Button)findViewById(R.id.button1);
myText = (EditText)findViewById(R.id.editText1);
myButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
myText.setText("弄明白监听!");
}
});
////////////////////
/////////2//////////
myButton01 = (Button)findViewById(R.id.Button01);
myButton01.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
////显示文本------- 测试通过
//myText.setText("弄明白监听2!");
////intent负责程序跳转和传递数据
//Intent intent = new Intent(this,F1_TC.class);
//startActivity(intent);
//Toast.makeText(this, "Toast", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(MainActivity.this, F1_TC.class);
startActivity(intent);
////打开一个伪窗口------- 测试通过
//Toast.makeText(getApplicationContext(), "提示:点击窗口外部关闭窗口!",
//Toast.LENGTH_SHORT).show();
}
});
////////////////////
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}