Activity转发
来源:互联网 发布:黑猫微圈源码 编辑:程序博客网 时间:2024/06/02 06:33
实现类似于J2EE web开发中的servlet转发效果,用于往他人程序中嵌入插件。做法为
package com.flrsdk.activity;import com.flrsdk.service.FloatService;import android.app.Activity;import android.content.Intent;import android.os.Bundle;public class PreActivity extends Activity {@Overrideprotected void onCreate(Bundle savedInstanceState) {// TODO Auto-generated method stubsuper.onCreate(savedInstanceState);//setContentView(R.layout.main);System.out.println("Pre启动");Intent service = new Intent();service.setClass(this, FloatService.class);startService(service);Intent intent=new Intent();intent.setAction("com.mh.sdk.demo.MainActivity");startActivity(intent);}@Overrideprotected void onDestroy() {// TODO Auto-generated method stubsuper.onDestroy();Intent serviceStop = new Intent();serviceStop.setClass(this, FloatService.class);stopService(serviceStop);}@Overrideprotected void onRestart() {// TODO Auto-generated method stubsuper.onRestart();//第二次进入的时候说明有戏退出了,立马结束掉当前activityfinish();}}
将该activity配置为对话框形式,
android:theme="@android:style/Theme.Dialog"
否则很容易看出来activity经过了一次跳转。
- Activity转发
- 转发
- 转发
- 转发
- 转发
- 转发
- 转发
- 转发
- 转发
- 转发
- 转发
- Activity
- Activity
- Activity。。。
- Activity
- Activity
- Activity
- Activity
- qt creator编译报错:parse error
- 浅谈 Linux 内核开发之网络设备驱动
- 第一次失败的面试(豌豆荚)
- 利用GridView控件实现数据添加
- 为什么最后你哪也没去?
- Activity转发
- 遍历list或map时删除元素(较巧妙)
- sicily 1007.To and Fro
- IT English Collection(29)of Preferences
- sicily 1198.Substring
- Houdini DOP精华笔记
- Ubuntu环境下SSH的安装及使用
- 破解
- java提高篇(五)-----使用序列化实现对象的拷贝