孤冰独狼 发表于 2013-1-14 18:11:35

Android笔记——不同apk之间传递参数与数据

android编程的时候,有时候需要在不同的apk之间传递参数或数据,下面是一个简单的例子:
APK(1)的程序代码:
IntentSend.java:
package com.is;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class IntentSend extends Activity {
Channel channel = new Channel();
Button szws;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        szws = (Button)findViewById(R.id.szws);
        szws.setOnClickListener(new Button.OnClickListener(){
public void onClick(View v) {
Intent intent = new Intent();
Bundle bundle = new Bundle();
bundle.putString("channel", channel.channels);
intent.setClassName("com.bget", "com.bget.BinderGET");
intent.putExtras(bundle);
startActivity(intent);
}
        });
    }
}

Channel.java:
 package com.is;
public class Channel {
 String channels[] = {
  "深圳卫视",
  "深圳电视剧",
  "深圳都市"
 };
}
 

<span style="" class="Apple-style-span">APK(2)的程序代码:
页: [1]
查看完整版本: Android笔记——不同apk之间传递参数与数据