晚上好,我將開始一個活動的主要佈局,第一次在智能手機上開始的應用程序,我該怎麼辦? 這是我的主要活動...當我的apo開始時,您可以看到我的activity_main選擇通知從firebase收回,當我設置通知時,應用程序將您重定向到另一個activity_mainweb當我放置webview時,我想看到只有在第一次第一activity_main佈局第一次開通智能手機應用程序的活動
公共類MainActivity擴展AppCompatActivity {
private static final String TAG = "MainActivity";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// If a notification message is tapped, any data accompanying the notification
// message is available in the intent extras. In this sample the launcher
// intent is fired when the notification is tapped, so any accompanying data would
// be handled here. If you want a different intent fired, set the click_action
// field of the notification message to the desired intent. The launcher intent
// is used when no click_action is specified.
//
// Handle possible data accompanying notification message.
// [START handle_data_extras]
if (getIntent().getExtras() != null) {
for (String key : getIntent().getExtras().keySet()) {
Object value = getIntent().getExtras().get(key);
Log.d(TAG, "Key: " + key + " Value: " + value);
}
}
// [END handle_data_extras]
Button subscribeButton = (Button) findViewById(R.id.subscribeButton0);
subscribeButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// [START subscribe_topics]
FirebaseMessaging.getInstance().subscribeToTopic("INTERIORDESIGN150H");
// [END subscribe_topics]
// Log and toast
String msg = getString(R.string.msg_subscribed);
Log.d(TAG, msg);
Toast.makeText(MainActivity.this, msg, Toast.LENGTH_SHORT).show();
}
});
Button subscribeButton1 = (Button) findViewById(R.id.subscribeButton1);
subscribeButton1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// [START subscribe_topics]
FirebaseMessaging.getInstance().subscribeToTopic("INTERIORDESIGN300H");
// [END subscribe_topics]
// Log and toast
String msg = getString(R.string.msg_subscribed);
Log.d(TAG, msg);
Toast.makeText(MainActivity.this, msg, Toast.LENGTH_SHORT).show();
}
});
Button subscribeButton2= (Button) findViewById(R.id.subscribeButton2);
subscribeButton2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// [START subscribe_topics]
FirebaseMessaging.getInstance().subscribeToTopic("GARDENDESIGN150H");
// [END subscribe_topics]
// Log and toast
String msg = getString(R.string.msg_subscribed);
Log.d(TAG, msg);
Toast.makeText(MainActivity.this, msg, Toast.LENGTH_SHORT).show();
}
});
Button subscribeButton3 = (Button) findViewById(R.id.subscribeButton3);
subscribeButton3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// [START subscribe_topics]
FirebaseMessaging.getInstance().subscribeToTopic("GARDENDESIGN300H");
// [END subscribe_topics]
// Log and toast
String msg = getString(R.string.msg_subscribed);
Log.d(TAG, msg);
Toast.makeText(MainActivity.this, msg, Toast.LENGTH_SHORT).show();
}
});
Button subscribeButton4 = (Button) findViewById(R.id.subscribeButton4);
subscribeButton4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// [START subscribe_topics]
FirebaseMessaging.getInstance().subscribeToTopic("VISUALDESIGN150H");
// [END subscribe_topics]
// Log and toast
String msg = getString(R.string.msg_subscribed);
Log.d(TAG, msg);
Toast.makeText(MainActivity.this, msg, Toast.LENGTH_SHORT).show();
}
});
Button subscribeButton5 = (Button) findViewById(R.id.subscribeButton5);
subscribeButton5.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// [START subscribe_topics]
FirebaseMessaging.getInstance().subscribeToTopic("PRODUCTDESIGN150H");
// [END subscribe_topics]
// Log and toast
String msg = getString(R.string.msg_subscribed);
Log.d(TAG, msg);
Toast.makeText(MainActivity.this, msg, Toast.LENGTH_SHORT).show();
}
});
Button subscribeButton6 = (Button) findViewById(R.id.subscribeButton6);
subscribeButton6.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// [START subscribe_topics]
FirebaseMessaging.getInstance().subscribeToTopic("MOTIONDESIGN150H");
// [END subscribe_topics]
// Log and toast
String msg = getString(R.string.msg_subscribed);
Log.d(TAG, msg);
Toast.makeText(MainActivity.this, msg, Toast.LENGTH_SHORT).show();
}
});
Button subscribeButton7 = (Button) findViewById(R.id.subscribeButton7);
subscribeButton7.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// [START subscribe_topics]
FirebaseMessaging.getInstance().subscribeToTopic("GRAPHICDESIGN150H");
// [END subscribe_topics]
// Log and toast
String msg = getString(R.string.msg_subscribed);
Log.d(TAG, msg);
Toast.makeText(MainActivity.this, msg, Toast.LENGTH_SHORT).show();
}
});
Button Button = (Button) findViewById(R.id.subscribeButton0);
Button.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
startActivity(new Intent(MainActivity.this, MainActivityweb.class));
}
});
Button Button1 = (Button) findViewById(R.id.subscribeButton1);
Button1.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
startActivity(new Intent(MainActivity.this, MainActivityweb.class));
}
});
Button Button2 = (Button) findViewById(R.id.subscribeButton2);
Button2.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
startActivity(new Intent(MainActivity.this, MainActivityweb.class));
}
});
Button Button3 = (Button) findViewById(R.id.subscribeButton3);
Button3.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
startActivity(new Intent(MainActivity.this, MainActivityweb.class));
}
});
Button Button4 = (Button) findViewById(R.id.subscribeButton4);
Button4.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
startActivity(new Intent(MainActivity.this, MainActivityweb.class));
}
});
Button Button5 = (Button) findViewById(R.id.subscribeButton5);
Button5.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
startActivity(new Intent(MainActivity.this, MainActivityweb.class));
}
});
Button Button6 = (Button) findViewById(R.id.subscribeButton6);
Button6.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
startActivity(new Intent(MainActivity.this, MainActivityweb.class));
}
});
Button Button7 = (Button) findViewById(R.id.subscribeButton7);
Button7.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
startActivity(new Intent(MainActivity.this, MainActivityweb.class));
}
});
}
}
非常不清楚你在問什麼。 – Kuffs
爲什麼?這是一個簡單的問題,只有當應用程序第一次在智能手機上啓動時,我必須打開我的一個佈局活動。 –
爲什麼?因爲這個問題看起來像是由一個糟糕的翻譯應用程序處理,沒有任何意義。 – Kuffs