Код: Выделить всё
<intent-filter>
<action android:name="intent1"></action>
<category android:name="android.intent.category.DEFAULT"></category>
</intent-filter>
Код: Выделить всё
package com.example.myapplication;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
// @Override
public void onReceive(final Context context, Intent intent) {
TextView valueView = (TextView) findViewById(R.id.valueView);
String action = intent.getAction();
if (action.equals("intent1")) {
if (intent.hasExtra("key") && intent.hasExtra("value")) {
String key = String.valueOf(intent.getExtras().get("key"));
String value = String.valueOf(intent.getExtras().get("value"));
valueView.setText(value);
}
}
}
}
Вопрос, куда копать?