首先简述问题 的情况 先看第一个界面
package com.example.android_intentwithinformations;
import android.support.v7.app.ActionBarActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.Toast;
public class MainActivity extends ActionBarActivity {
Button btn_call,btn_email;
static final int CALL_REQUEST=0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
btn_call=(Button)findViewById(R.id.call);
btn_email=(Button)findViewById(R.id.email);
btn_call.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
Intent call_intent=new Intent(MainActivity.this,Input_numActivity.class);
//有返回结果的跳转
startActivity(call_intent);
// startActivityForResult(call_intent,CALL_REQUEST);
}
});
}
@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);
}
}
这是首先的界面 要跳向第二个界面input_numActivity
package com.example.android_intentwithinformations;
import java.util.regex.Pattern;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class Input_numActivity extends Activity {
Button btn_call, btn_previous;
EditText edt_num;
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.call_phone);
btn_call=(Button)findViewById(R.id.call);
btn_previous=(Button)findViewById(R.id.previous);
edt_num=(EditText)findViewById(R.id.edt_call_num);
}
}
但是一旦我在第二个界面input_numActivity中加入一个单击监听事件,跳转就直接中断了 这是为什么呢