作者cloudfly (王妃)
看板java
标题[问题] android adb shell指令
时间Thu Oct 7 17:22:39 2010
请问如果我要用adb指令广播去触发intent然後传123给模拟器
目前查到是在shell下用am broadcast intent
但请问我程式该怎麽撰写去接收adb指令发出的广播,
然後接收处理完,让主程式的BroadcastReceiver接收,
并印出接收到的字串讯息。
目前会写自订的广播讯息让主程式接收
如public class mServiceReceiver extends BroadcastReceiver
{
public void onReceive(Context context, Intent intent)
{
try
{
/* 取回来自背景服务所Broadcast的参数 */
Bundle bunde = intent.getExtras();
String strParam1 = bunde.getString("STR_PARAM1");
/* 将从Service里传来的广播讯息显示於TextView */
mTextView01.setText(strParam1);
//Intent i = new Intent( ReceiveAP.this, mService1.class );
}
catch(Exception e)
{
mTextView01.setText(e.toString());
e.getStackTrace();
}
}
}
但就卡在不晓得要怎麽撰写从adb指令传过来的字串相关程式码,
请问各位前辈有人使用过adb相关广播的指令吗?
拜托大家了。
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 219.87.71.10
※ 编辑: cloudfly 来自: 219.87.71.10 (10/07 17:23)
1F:推 ogamenewbie:请先去google BroadcastReceiver 看一下相关文章 10/07 18:46