1、======================================================

调用的AAactivity.java代码如下:

Intent intent = new Intent(AAActivity.this, BBActivity.class);
   startActivity(intent);

2、======================================================

新建BBActivity.java,代码入下:

package com.weiny;


import android.app.Activity;
import android.app.AlertDialog;
import android.content.ContentValues;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;

import com.hh.radio.activity.HHRadioActivity;
import com.hh.radio.activity.R;
import com.hh.radio.util.ExitApplication;
import com.hh.radio.util.InternetRadioHelper;

public class UserAddChannelActivity extends Activity {
 
 private Button saveButton , cancelButton ;
 private EditText channel_name , channel_address ;
  
 public void onCreate(Bundle paramBundle) {
  super.onCreate(paramBundle);
  setContentView(R.layout.addchannel);
  ExitApplication.getInstance().addActivity(this);
  initView() ;
  saveButton.setOnClickListener(new ButtonListener()) ;
  cancelButton.setOnClickListener(new ButtonListener()) ;
 }

 /**
  * @description 初始化所有view
  */
 private void initView(){
  this.saveButton = (Button)findViewById(R.id.savebutton) ;
  this.cancelButton = (Button)findViewById(R.id.cancelbutton) ;
  this.channel_name = (EditText)findViewById(R.id.channel_name) ;
  this.channel_address = (EditText)findViewById(R.id.channel_address) ;
 }
 
 /**
  * @description 选择按钮后的事件
  */
 private void clickControllerBar(View v) {
  switch (v.getId()) {
  case R.id.savebutton: {
   String editChannelNameStr = ((EditText)findViewById(R.id.channel_name)).getText()+"" ;
   String editChannelURLStr = ((EditText)findViewById(R.id.channel_address)).getText()+"" ;
   finish() ;
   Intent intent = new Intent(BBActivity.this, AAActivity.class);
   startActivity(intent);
   break;
  }
  case R.id.cancelbutton: {
   finish() ;
   break;
  }
  default:
   break;
  }
 }
 
 class ButtonListener implements OnClickListener {
  @Override
  public void onClick(View v) {
   clickControllerBar(v);
  }
 }
 
}

3、====================================================

BBActivity的.xml文件,代码如下:android:text自己在strings.xml配吧

    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >
       android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     >
        android:id="@+id/nameLable"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:textSize="20px"
      android:text="@string/channelname"
      />
        android:id="@+id/channel_name"
      android:layout_width="400px"
      android:layout_height="wrap_content"
      android:layout_toRightOf="@id/nameLable"
      android:layout_alignTop="@id/nameLable"
      />
 

       android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     >
        android:id="@+id/ageLable"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:textSize="20px"
      android:text="@string/channeladdress"
      />
        android:id="@+id/channel_address"
      android:layout_width="400px"
      android:layout_height="wrap_content"
      android:layout_toRightOf="@id/ageLable"
      android:layout_alignTop="@id/ageLable"
      />
 

       android:layout_width="fill_parent"
     android:layout_height="wrap_content"
     >
         android:id="@+id/savebutton"
    android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:text="@string/sure"
   />
         android:id="@+id/cancelbutton"
    android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:text="@string/cancel"
       android:layout_toRightOf="@id/savebutton"
   />
 

 

4、=========================================================================

android的AndroidManifest.xml文件配置activity,代码如下:

              android:theme="@android:style/Theme.Dialog"
            android:label="@string/app_name" >
           
               
               
           

       

更多相关文章

  1. android surfaceView参考
  2. 改变android 选项卡的背景色
  3. android notification 事件
  4. TextView 在xml文件中的解释
  5. Android监听WebView滑动到底部
  6. Android往SD卡上存储文件
  7. android p 充拔电提示音
  8. android notification 事件
  9. NPM 和webpack 的基础使用

随机推荐

  1. Error Installing APK
  2. 一个java android 时钟 非常精致!android
  3. android adb 控制手机
  4. android字体闪烁动画(线程)
  5. Android设置拍照或者上传本地图片
  6. Android:textView加载Html,只加载文字
  7. Android消息处理机制4——Looper
  8. Android Gradle Plugin指南(三)----依赖关
  9. Android按键事件发布流程
  10. Android 系统永不休眠