我正在寻找能让我改变意图目的地的东西。这就是为什么:
我(在班级def unpack(unpackIt):
tmp = array.array('B', unpackIt[:])
obj = pickle.loads(tmp.tostring())
return obj
)收到其中一项活动(tmp = unpack(singleton)
pack = tmp.getOnlyWhatThisClientCanSee()
try:
package = pickle.dumps(pack)
socket.send(package)
except (BrokenPipeError, IOError):
#client disconnected, save position in database
)的意图,我想将同一意图发送到其他活动(MyActivity
):
Starter
我知道现在它会将我带回Result
,所以:如何将目的地从Intent intent = getIntent();
//do some stuff here
startActivity(intent);
更改为MyAcitivity
?我遇到了MyActivity
功能,但除了拨打电话功能外,我找不到任何其他功能,例如拨打电话。
答案 0 :(得分:2)
通过这种方式,您可以将您的额外内容发送到ClassA的其他活动:
Intent intent = new Intent(ClassA.this, ClassB.class);
intent.putExtra("A", "A");
startActivity(intent);
在ClassB收到它:
Intent intent = getIntent();
Bundle extras = intent.getExtras();
if (extras != null) {
if (extras.containsKey("A")) {
//do your stuff
}
}
答案 1 :(得分:0)
import { Component, OnInit } from '@angular/core';
import {HttpClient} from '@angular/common/http';
declare var $ :any;
@Component({
selector: 'app-vendors',
templateUrl: './vendors.component.html',
styleUrls: ['./vendors.component.css']
})
export class VendorsComponent implements OnInit {
vendors: any;
constructor(private http: HttpClient) { }
ngOnInit() {
this.http.get('backendgetLINK').subscribe(data => {
// Read the result field from the JSON response.
this.vendors = data['vendors'];
$("#vendors-datatable").DataTable({});
console.log(this.vendors);
});
}
}
方法可以帮助您设置不同的目的地