搜尋此網誌

2013年6月5日

Launch Android activity by am and passing values

Way1:
1. PC site to launch Android activity by am command:
    adb shell am start -n Packet_Name/Activity_Name -d "parameter"
2. Android site to get the value:
    intentData = getIntent().getDataString();

Way2: (Easy to send multiple parameters)
1. PC site to launch Android activity by am command:
    adb shell am start -n Packet_Name/Activity_Name --es str "parameter "
2. Android site to get the value:
    Intent intent = getIntent();
    String str = intent.getStringExtra("str");

沒有留言:

張貼留言