首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >程序ab的问题

程序ab的问题
EN

Stack Overflow用户
提问于 2014-03-27 23:54:07
回答 1查看 721关注 0票数 0

在eclipse中使用ab.jar时,我在尝试运行机器人时遇到以下错误。“找不到从方法…引用的类‘org.alicebot.ab.Bot’”。正在导入chat类,但无法导入bot类。

下面是我的代码:

代码语言:javascript
复制
 import org.alicebot.ab.Bot;
 import org.alicebot.ab.Chat;

 import android.annotation.SuppressLint;
 import android.app.ActionBar.LayoutParams;
 import android.app.Activity;
 import android.os.Bundle;
 import android.view.View;
 import android.view.ViewTreeObserver;
 import android.widget.Button;
 import android.widget.EditText;
 import android.widget.LinearLayout;
 import android.widget.ScrollView;
 import android.widget.TextView;

 public class MainActivity extends Activity {


 String usertext; String response;
 String botname="MAVIS";
 Bot mavis=new Bot(botname);
 Chat chat= new Chat(mavis);

 @Override
 protected void onCreate(Bundle savedInstanceState) {
 // TODO Auto-generated method stub
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main); 
 final LinearLayout ll1 = (LinearLayout) findViewById(R.id.ll1);
 final LinearLayout ll2 = (LinearLayout) findViewById(R.id.ll2);
 final ScrollView scv = (ScrollView) findViewById(R.id.sv);
 final Button btn = (Button) findViewById(R.id.button1);
 final EditText medit = (EditText) findViewById(R.id.editText1);

 btn.setOnClickListener(new View.OnClickListener() {

 @SuppressLint("NewApi")
 @Override
 public void onClick(View v) { 

 TextView tvu=new TextView(v.getContext());
 TextView tvb=new TextView(v.getContext());

 TextView tvut=new TextView(v.getContext());
 TextView tvbt=new TextView(v.getContext());

 TextView tvdivider1=new TextView(v.getContext());
 TextView tvdivider2=new TextView(v.getContext());  

 final LayoutParams lparams = new LayoutParams(LayoutParams.WRAP_CONTENT,  LayoutParams.WRAP_CONTENT);

 tvu.setLayoutParams(lparams);
 tvb.setLayoutParams(lparams);

 tvut.setLayoutParams(lparams);
 tvbt.setLayoutParams(lparams);

 tvdivider1.setLayoutParams(lparams);
 tvdivider2.setLayoutParams(lparams);

 usertext = medit.getText().toString();
 if(usertext.trim().length() != 0){

 ll1.addView(tvu);
 ll1.addView(tvb);
 ll2.addView(tvut);
 ll2.addView(tvbt);
 ll1.addView(tvdivider1);
 ll2.addView(tvdivider2);

 response=chat.multisentenceRespond(usertext);

 tvu.setText("User");
 tvb.setText(botname);

 tvbt.setText(" : "+ response);
 tvut.setText(" : "+ usertext);
 medit.setText(" ");

 tvdivider1.setText("   ");
 tvdivider2.setText("   --------------------");
 }
  else{
   //do nothing
      }
  }
  });

scv.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        public void onGlobalLayout() {
            scv.post(new Runnable() {
                public void run() {
                    scv.fullScroll(View.FOCUS_DOWN);
                }
            });
        }
    });
   }

   }  

我已经导入了外部库并为其定义了类路径。我还复制了项目文件夹中的ab.jar,甚至为其定义了类路径。但似乎什么都不起作用。这是我做错了吗,还是需要更多的库才能正常工作。谁有办法解决我的问题?

EN

回答 1

Stack Overflow用户

发布于 2015-11-13 23:52:49

您的机器人名称在这里是MAVIS..did,您可以从bots.zip???else change it..or中更改文件夹名称,只需使用预定义的机器人名称(alice2等)即可。谢谢

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22692813

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档