gpt4 book ai didi

java - Android SDK public void 获取错误

转载 作者:行者123 更新时间:2023-11-29 05:15:48 25 4
gpt4 key购买 nike

我在遵循制作应用程序的教程时遇到问题。但是现在我通过添加响应得到了一个错误一个按钮。它在 public void sendMessage 处给出错误,但我看不出有什么问题。

 package com.example.myfirstapp;

import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.content.Intent;




/** Called when the user clicks the Send button */

public void sendMessage(View view){

Intent intent = new Intent(this, DisplayMessageActivity.class);
}


public class MainActivity extends ActionBarActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}


@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}

最佳答案

那些线

/** Called when the user clicks the Send button */

public void sendMessage(View view){
Intent intent = new Intent(this, DisplayMessageActivity.class);
}

进入你的类,之后

public class MainActivity extends ActionBarActivity {

关于java - Android SDK public void 获取错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26603943/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com