安卓button设置监听页面跳转没保错但不能运行,求大神赐教

public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.login); EditText username = (EditText) findViewById(R.id.username); String user = username.getText().toString(); EditText password = (EditText) findViewById(R.id.password); String pwd = password.getText().toString(); Button exit = (Button) findViewById(R.id.exit); MyButton listener = new MyButton(); exit.setOnClickListener(listener); if ((user == "hxc" && pwd == "19960208") || (user == "lsj" && pwd == "19961205")) { Intent intent = new Intent(); intent.setClass(MainActivity.this, Main.class); startActivity(intent); } else { Toast tot = Toast.makeText( MainActivity.this, "用户名与密码不匹配", Toast.LENGTH_LONG); tot.show(); } } class MyButton implements View.OnClickListener { @Override public void onClick(View v) { } }}

2个回答

public class MainActivity extends AppCompatActivity { @Override
protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState); setContentView(R.layout.login);

EditText username = (EditText)findViewById(R.id.username);

String user = username.getText().toString(); EditText password = (EditText) findViewById(R.id.password);

String pwd = password.getText().toString();

Button exit = (Button) findViewById(R.id.exit); MyButton listener = new MyButton(); exit.setOnClickListener(listener);

if ((user == "hxc" && pwd == "19960208") || (user == "lsj" && pwd == "19961205")) {

Intent intent = new Intent(); intent.setClass(MainActivity.this, Main.class); startActivity(intent);

}

else {

Toast tot = Toast.makeText( MainActivity.this, "用户名与密码不匹配", Toast.LENGTH_LONG);

tot.show(); }

}

class MyButton implements View.OnClickListener {

@Override

public void onClick(View v) {

}

}
}

把这段代码:

if ((user == "hxc" && pwd == "19960208") || (user == "lsj" && pwd == "19961205")) {

Intent intent = new Intent(); intent.setClass(MainActivity.this, Main.class); startActivity(intent);

}

else {

Toast tot = Toast.makeText( MainActivity.this, "用户名与密码不匹配", Toast.LENGTH_LONG);

tot.show(); }

} 

放到

 class MyButton implements View.OnClickListener {

@Override

public void onClick(View v) {

}

}

这个的onClick里面

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
运行没问题,但上交就是错的。求大神解释。。。。。。
Descriptionrn给出一个正整数(positive integer)(不超过10位),从高位开始逐位分割并输出。rnrnrnInputrn测试数据有多行,每行是一个正整数 n ,不含前导零。rnrnrnOutputrn对每个测试输出一行结果:分割后的整数序列,各位数之间用一个空格隔开。rn温馨提示:最后一个数字后面没有空格哦,否则PE哦。rnrnrnSample Inputrn654321rn1rnrnrnSample Outputrn6 5 4 3 2 1rn1rnrnrnrnrn#include int main (void) rn rnint n; rnint t; rnint a[10]; rnint i; rnwhile(scanf("%d",&n)!=EOF) rn rnt = n/10; rni = 0; rnwhile (t > 0)rn rna[i] = n%10; rni++; rn//printf("%2d",n%10); rnn = n/10; rnt = n/10; rn rna[i] = n; rnfor (;i >= 0;i--) rn rnprintf("%d ",a[i]); rn rngetchar(); rnprintf("\n"); rn rnreturn 0;
[求助]运行没问题,但上交就是错的。求大神解释。。。。。。
Descriptionrn给出一个正整数(positive integer)(不超过10位),从高位开始逐位分割并输出。rnrnInputrn测试数据有多行,每行是一个正整数 n ,不含前导零。rnrnOutputrn对每个测试输出一行结果:分割后的整数序列,各位数之间用一个空格隔开。rn温馨提示:最后一个数字后面没有空格哦,否则PE哦。rnrnSample Inputrn654321rn1rnrnSample Outputrn6 5 4 3 2 1rn1rnrn#include rnint main (void) rnrnint n;rnint t;rnint a[10];rnint i;rnwhile(scanf("%d",&n)!=EOF)rnrnt = n/10;rni = 0;rnwhile (t > 0) rna[i] = n%10;rni++;rn//printf("%2d",n%10);rnn = n/10; rnt = n/10;rnrna[i] = n;rnfor (;i >= 0;i--)rnrnprintf("%d ",a[i]);rnrngetchar();rnprintf("\n");rnrnrnreturn 0;rnrn
安卓学习笔记(四)Button监听
匿名内部类的按钮监听:   loginButton = (Button) findViewById(R.id.button1); loginButton.setOnClickListener(new View.OnClickListener() {     @Override     public void onClick(View view) {       
大神赐教,运行出错
use st;rnDELIMITER $$rnCREATE PROCEDURE 2in1()rnbeginrndeclare bm char(8);rndeclare found boolean default true;rndeclare bm_ cursor for select table_name from information_schema.tables where table_schema='st' limit 1,15000;rndeclare continue handler for not found set found=false;rnopen bm_;rnrnwhile found dornfetch bm_ into bm;rnif found=true thenrnbeginrndeclare rq_ date;rndeclare found2 boolean default true;rnrn# declare rq_bcf cursor for select distinct(rq) from bm;rnrn SET @STMT=CONCAT('declare rq_bcf cursor for select distinct(rq) from ',bm,';'); rn rn PREPARE STMT FROM @STMT; rn EXECUTE STMT; rn rnrndeclare continue handler for not found set found2=false;rnopen rq_bcf;rnwhile found2 dornfetch rq_bcf into rq_;rnend while;rnclose rq_bcf;rnend;rnrnrnend if;rnend while;rnclose bm_;rnend$$rndelimiter ;rnrnrn运行后提示:rnrnERROR 1064 (42000): You have an error in your SQL syntax; check the manual thatrncorresponds to your MySQL server version for the right syntax to use near 'declarnre continue handler for not found set found2=false;rnopen rq_bcf;rnwhile foun' at line 23rnrnrn参见 http://topic.csdn.net/u/20120609/00/0abebfa5-9a35-4375-82fc-6733f10369d1.html?09780595148663154
我找不到错但不能运行
这是一个贪吃蛇的小游戏:rn#include rn#include rn#include rn#include rnrn#define ESC 0x011brn#define UP 0x4800rn#define DOWN 0x5000rn#define LEFT 0x4b00rn#define RIGHT 0x4d00rn#define TIME 5000rnrnstruct snakernint x;rn int y;rn struct snake *next;rn rnhead,*l,*p;rnint map[50][40];rnint fo,fb,bx,by,sock=0;rnint tm;rnint getkey(void)rnint key;rn key=bioskey(0);rn return key;rnrnvoid init(void)rnint i,j,graphdriver=DETECT,graphmode;rn for(i=0;i<=50;i++)rn for(j=0;j<=40;j++)rn map[i][j]=0; rn rnp=&head;rnhead.x=25;rnhead.x=19;rnfor(i=0;i<5;i++)rn l=malloc(sizeof(head));rn p->next=l;rn l->next=NULL;rn l->x=0;rn l->y=0;rn p=l;rn fo=0;rn initgraph( &graphdriver, &graphmode, "E :\\TC" );rn setfillstyle(1,WHITE);rn rectangle(4,4,600,700);rn i=random(49)+1;rn j=random(39)+1;rn map[i][j]=2;rn been(i,j);rn draw(head.x,head.y);rnrn int snake(int x,int y)rn bar(x*10-4,y*10-4,x*10+4,y*10+4);rn int been(int x,int y)rn setfillstyle(1,14);rn bar(x*10-4,y*10-4,x*10+4,y*10-4);rn setfillstyle(1,15);rnvoid black(int x,int y)rnsetfillstyle(1,BLACK);rn bar(x*10-5,y*10-5,x*10+5,y*10+5);rn setfillstyle(1,WHITE);rn rnint draw()rnsnake(head.x,head.y);rn for(p=&head;p->next!=NULL;p=p->next)rn if(!p->next->next)rn black(p->x,p->y);rn continue;rn rn rnrnvoid gameover()rncleardevice();rngetch();rnclosegraph();rnprintf("***%d***\n",sock);rnrnexit(0);rn rnrnvoid main()rnint key,vx,vy,x,y,n,m=0;rn n=NULL;rn srand((unsigned int)time(0));rn tm=TIME;rn init();rn dorn if(bioskey(1))rn key=getkey();rn switch(key)rn case UP: fo=1;break;rn case DOWN: fo=-1;break;rn case LEFT: fo=2;break;rn case RIGHT: fo=-2;break;rn case ESC: exit(0);rn rn rn elsern fb=fo;rnrn if(fb+fo==0)rn fo=fb;rn switch(fo)rn case 1:head.y-=1;break;rn case -1:head.y+=1;break;rn case 2: head.x-=1;break;rn case -2:head.x+=1;break;rn rn if(head.y==0)rn head.y=39;rn fo=1;rn rn if(head.x==40)rn head.y=1;rn fo=-1;rn rn if(head.x==0)rn head.x=49;rn fo=2;rn rn if(head.x==50)rn head.x=1;fo=-2;rnif(map[head.x][head.y]==1)rn gameover();rn draw();rn delay(tm);rn if(map[head.x][head.y]==2)rn l=malloc(sizeof(head));rn p->next=l;rn l->next=NULL;rn p->x=0;rn p->y=0;rn p=l;rn n=1;rn sock++;rn m++;rn if(m==2)rn dorn x=random(48)+1;rn y=random(38)+1;rn while(map[x][y]!=0);rn map[x][y]=1;rn map[head.x][head.y]=0;rn m=0;rn draw(x,y);rn rn dorn x=random(48)+1;rn y=random(38)+1;rn while(map[x][y]!=0);rn map[x][y]=2;rn been(x,y);rn rnbx=head.x;rnby=head.y;rnfor(p=&head;p->next!=NULL;p=p->next)rnvx=p->x;rnvy=p->y;rnp->x=bx;rnp->y=by;rn if(n)rn map[vx][vy]=1;rn if(!p->next->next||!p->next)rn map[bx][by]=0;rn map[vx][vy]=0;rn rn p=p->next;rn if(p->next==NULL)rn break;rn bx=p->x;rnby=p->y;rnp->x=vx;rnp->y=vy;rnif(!p->next->next||!p->next)rn map[bx][by]=0;rn rnwhile(key!=ESC);rngameover();rnZ
矩阵转置问题 运行出问题了 求大神赐教
#include int main() { int a[2][3]; int b[3][2],i,j; for(i=0;i { for(j=0;j { scanf("%d",a[i][j]); b[j][i]=a[i][j]; } } for(i=0;i { for(j=0;j { printf("%d ",b[i][j]); printf("\n");  
循环队列,运行不出结果,求大神赐教
[code=c]/* @filename list.h */rnrn#includern#includern#includerntypedef struct queue 队列rnrn int *arr;//数组arr地址rn size_t cap;//容量rn size_t front;//队首位置rn size_t rear;//队尾位置rn size_t size;//当前队列中元素个数rnQUEUE;rnrnvoid init_queue(QUEUE * que, size_t cap) //初始化rnrn que = (QUEUE*)malloc(cap*sizeof(int));rn que->cap = cap;rn que->front = 0;rn que->rear = 0;rn que->size = 0;rnrnvoid destroy_queue(QUEUE *que) //删除rnrn free(que->arr);rn que->arr = NULL;rn que->cap = 0;rn que->front = 0;rn que->rear = 0;rn que->size = 0;rnrnint pop_queue(QUEUE *que) //出队rnrn if (que->front >= que->cap)rn rn que->front = 0;rn rn que->size--;rn return que->arr[que->front++];rnrnvoid push_queue(QUEUE *que, int data) //入队rnrn if (que->rear >= que->cap)//下标越界rn que->rear = 0;rn que->arr[que->rear++] = data;//数据放进队尾,队尾后移rn que->size++;//个数加1rnrnrnint isfull_queue(QUEUE *que) //判断是否满rnrn if ((que->size) ==( que->cap))rn return 1;rn elsern return -1;rnrnint isempty_queue(QUEUE *que) //是否为空rnrn if (que->size == 0)rn return 0;rn elsern return -1;rnrnint getsize_queue(QUEUE *que) //当前元素个数rnrn return que->size;rnrnvoid show_front(QUEUE *que) //显示队首元素rnrn if (que->front >= que->cap)rn que->front = 0;rn printf("%d\n", que->arr[que->front]);rnrnrnrnrnint main()rnrn QUEUE * qu=NULL;rn init_queue(qu, 5);rn int i;rn for (i = 0; i<5; i++)rn rn if (isfull_queue(qu))rn push_queue(qu,i);rn rn printf("size%d\n", getsize_queue(qu));rn while (!isempty_queue(qu))rn rn printf("%d\n", pop_queue(qu));rn rn destroy_queue(qu);rn getchar();rn return 0;rnrn[/code]
安卓button点击事件设置
屏蔽多次点击事件 ? 1 2 3 4 5 6 7 8 9 10 11 12 /**  * 测试快速点击事件  */  fastButton.setOnClickListener(new OnClickFastListener() {  /** ...
求大神赐教编码问题?
[code=java]import java.io.FileInputStream;rnimport java.io.FileWriter;rnimport java.io.IOException;rnimport java.io.UnsupportedEncodingException;rnimport java.util.Arrays;rnrnrnpublic class Demo8 rn public static void main(String [] args) throws IOException rn String str = "中国";rn System.out.print("默认:"+Arrays.toString(str.getBytes())+"\r\n");rn System.out.println("gbk2312码表:"+Arrays.toString(str.getBytes("gb2312")));rn System.out.println("utf-8码表:"+Arrays.toString(str.getBytes("utf-8")));rn System.out.println("unicode码表:"+Arrays.toString(str.getBytes("unicode")));rn rn FileWriter writer = new FileWriter("d:\\1.txt");rn writer.write(str);rn writer.flush();rn FileInputStream in = new FileInputStream("d:\\1.txt");rn System.out.println("我一个一个字节的读回来怎么不一样了");rn System.out.print(in.read()+"-");rn System.out.print(in.read()+"-");rn System.out.print(in.read()+"-");rn System.out.print(in.read()+"-");rn System.out.print(in.read()+"-");rn System.out.print(in.read()+"-");rn rnrn rnrn[/code]
求大神赐教!!!!!!
10.125.197.118:8080/17lai/checkpreload.htmrn咋么在项目WEB-INF下配置把17lai这个应用名去掉rn10.125.197.118:8080/checkpreload.htmrn
求单元测试大神赐教
我想用单元测试来测试一个web项目,此项目中用到了hibernate和spring,怎么样才能对此项目进行单元测试。目前本人在看junit,由于其中用到了hibernate,每个模块和其他模块的关联也比较多,想做单元测试难度比较大,求赐教应该怎么做。rn现在主要是不知道具体操作应该如何入手。迷茫啊!~
求大神赐教
大神帮忙给个答案,谢谢!rnrn1,假设带表头结点的单向链表头指针为head,试编写一个算法将值为5的结点插入到连接表的第i个结点前,病对该链表进行排序。rnrn2,设Q[0:6]是一个循环队列,初始状态front=rear=3,画出下列操作后该队列及头尾指针的变化情况,若不能入列,请指出其元素并说明理由。rnrn3,给定一组元素25、30、36、54、17、20、94、15、21、83、10,试画出由此产生的二叉排序树。
求rails大神赐教
执行rake db:migrate RAILS_ENV=production时出错rnrake aborted!rnFile to import not found or unreadable: variables.rnLoad path: Sass::Rails::Importer(.../application.css.rnscss)rn (in ..../application.css.scss)rnrn这个问题怎么解决呢
求大神赐教!!!!!!!!!!!!!!!!!!!!
qq空间里,图片通过改变观看着不同而改变图片上的qq号码,是怎么回事?rn求详细的脚本语句。
安卓页面跳转间的动画设置
安卓页面与页面之间的跳转动画其实很简单,主要需要写两个一进一出的动画XML
Button设置监听的三种方式
Button 是继承自TextView 基本监听步骤: 1、写布局 2、在Activity的onCreate中初始化控件 3、定义监听类 4、设置监听 5、填写监听实现方法 点击监听:onClickListener
Button onClick事件不能运行
我创建一个viewPager,在每一个页面上有三个布局。在第二个页面上我想处理按钮事件,当点击按钮时背景颜色会变。但是现在我的代码不能运行。去掉button代码,viewPager就可以正常运行。rn这是我的代码:rnrn public class ViewPagerProjectActivity extends Activity implements OnClickListenerrn rn Button btn;rn rn @Overridern public void onCreate(Bundle savedInstanceState) rn super.onCreate(savedInstanceState);rn setContentView(R.layout.main);rn rn ViewPagerAdapter adapter = new ViewPagerAdapter( this );rn ViewPager pager = (ViewPager)findViewById( R.id.viewpager );rn pager.setAdapter( adapter );rn pager.setCurrentItem(0);rn rn rn rn rn rn public void OnClick(View v) rn if(v.equals(btn)) rn LinearLayout l = (LinearLayout) findViewById(R.id.deneme2);rn l.setBackgroundDrawable(getResources().getDrawable(R.drawable.background));rn rn rn rn错误:rnrn E/AndroidRuntime(273): FATAL EXCEPTION: mainrn E/AndroidRuntime(273): java.lang.RuntimeException: Unable to start activity ComponentInfocom.yahya.ViewPagerProject/com.yahya.ViewPagerProject.ViewPagerProjectActivity: java.lang.ClassCastException: com.yahya.ViewPagerProject.ViewPagerProjectActivityrn E/AndroidRuntime(273): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)rn E/AndroidRuntime(273): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)rn E/AndroidRuntime(273): at android.app.ActivityThread.access$2300(ActivityThread.java:125)rnrn
求各路大神指点 页面跳转
做一个收件箱 有两个页面 一个邮件列表页 一个邮件详细内容页 邮件列表页的邮件数据是通过ajax从ashx读取过来的rn点击邮件就会跳转到邮件详细内容页面 在这个页面可以对邮件进行操作 然后改页面有个返回 当我点击 返回 我想染邮件列表页锁定到我点击的那封邮件上 我不知道该怎么写 rnrn求大神 指点 有代码的更好~~~
HDOJ-1008大神求错
Problem DescriptionrnThe highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 seconds to move the elevator up one floor, and 4 seconds to move down one floor. The elevator will stay for 5 seconds at each stop.rnrnFor a given request list, you are to compute the total time spent to fulfill the requests on the list. The elevator is on the 0th floor at the beginning and does not have to return to the ground floor when the requests are fulfilled.rnrn rnrnInputrnThere are multiple test cases. Each case contains a positive integer N, followed by N positive numbers. All the numbers in the input are less than 100. A test case with N = 0 denotes the end of input. This test case is not to be processed.rnrn rnrnOutputrnPrint the total time on a single line for each test case. rnrn rnrnSample Inputrn1 2rn3 2 3 1rn0rn rnrnSample Outputrn17rn41rn#include rnint max(int n);rnint min(int n);rnint a[100];rnint main()rnrn int i,sum,up,down,n;rn int s;rn while (scanf("%d",&n)!=EOF&&n)rn rn sum=0;rn up=0;rn down=0;rn if(n==1)//如果只变化一层rn scanf("%d",&s);rn sum=sum+s*6+5;rn else for(i=0;ia[0])rn a[0]=a[i];rn return a[0];rnrnint min (int n)rnrn int i;rn for(i=1;i
求大神找错
rn不知道为什么 总是无法提示修改密码 总显示原密码错误 不知道问题出哪了rn[code=C#]using System;rnusing System.Collections.Generic;rnusing System.ComponentModel;rnusing System.Data;rnusing System.Drawing;rnusing System.Text;rnusing System.Windows.Forms;rnusing System.Data.SqlClient;rnrnnamespace SuperMarketrnrn public partial class ModificationPassword : Formrn rn public ModificationPassword()rn rn InitializeComponent();rn rnrn /// rn /// 修改事件rn /// rn /// rn /// rn private void button1_Click(object sender, EventArgs e)rn rn if (Modification())rn rn if (Chose())rn rn MessageBox.Show("修改密码成功!");rn rn elsern rn MessageBox.Show("密码修改失败!");rn rn rn rn public string username;rn public string passwrd;rnrn /// rn /// 修改密码的方法rn /// rn /// rn public bool Modification()rn rn if (this.textBox1.Text.Trim().Equals(string.Empty))rn rn MessageBox.Show("请输入原密码!");rn this.textBox1.Focus();rn return false;rn rn if (this.textBox2.Text.Trim().Equals(string.Empty))rn rn MessageBox.Show("请输入新密码!");rn this.textBox2.Focus();rn return false;rn rn if (this.textBox3.Text.Trim().Equals(string.Empty))rn rn MessageBox.Show("请输入确认新密码!");rn this.textBox3.Focus();rn return false;rn rn if (this.textBox2.Text != this.textBox3.Text)rn rn MessageBox.Show("新密码输入不一致!");rn return false;rn rn elsern rn return true;rn rn rnrnrnrn public bool Chose()rn rn DBHelper.OpenConnection();rn string sql = string.Format("select count(*) from [Users] where UserName='0' and PassWord='1'",username,this.textBox1.Text.ToString());rn SqlCommand com = new SqlCommand(sql, DBHelper.Connection);rn tryrn rn int count = (int)com.ExecuteScalar();rn if (count > 0)rn rn sql = string.Format("update [Users] set PassWord='0' where UserName='1'", this.textBox2.Text.ToString(), username);rn com.CommandText = sql;rn if (com.ExecuteNonQuery() > 0)rn rn return true;rn rn elsern rn return false;rn rn rn elsern rn MessageBox.Show("原密码错误");rn return false;rn rn rn catch (Exception)rn rnrn throw;rn rn finallyrn rn DBHelper.CloseConnection();rn rn rn /// rn /// 返回事件rn /// rn /// rn /// rn private void button2_Click(object sender, EventArgs e)rn rn DialogResult result = MessageBox.Show("你是否要返回商品管理界面?","提示",MessageBoxButtons.YesNo,MessageBoxIcon.Information);rn if (result==DialogResult.Yes)rn rn this.Hide();rn SuperMarketManage sp = new SuperMarketManage();rn sp.Show();rn rn rnrnrnrn rn[/code]rn[code=C#]using System;rnusing System.Collections.Generic;rnusing System.ComponentModel;rnusing System.Data;rnusing System.Drawing;rnusing System.Text;rnusing System.Windows.Forms;rnusing System.Data.SqlClient;rnrnnamespace SuperMarketrnrn public partial class Login : Formrn rn public Login()rn rn InitializeComponent();rn rn /// rn /// 登录时间rn /// rn /// rn /// rn private void button1_Click(object sender, EventArgs e)rn rn if (ChickMessage())rn rn if (ChickLogin())rn rn MessageBox.Show("登录成功!");rn this.Hide();rn SuperMarketManage spu = new SuperMarketManage();rn spu.Show();rn rn elsern rn MessageBox.Show("帐号或者密码错误!请重新输入!");rn rn rn rnrn /// rn /// 验证登录的方法rn /// rn public bool ChickLogin()rn rn bool flag = false;rn ModificationPassword mp = new ModificationPassword();rn mp.username = this.textBox1.Text.Trim().ToString();rn mp.passwrd = this.textBox2.Text.Trim().ToString();rn string sql = string.Format("select count(*) from Users where UserName='0' and PassWord='1'",mp.username,mp.passwrd);rn rn tryrn rn DBHelper.OpenConnection();rn SqlCommand com = new SqlCommand(sql,DBHelper.Connection);rn int count = (int)com.ExecuteScalar();rn if (count>0)rn rn flag = true;rn rn rn catch (Exception)rn rn throw;rn rn finallyrn rn DBHelper.CloseConnection();rn rn return flag;rn rn /// rn /// 验证是否有输入rn /// rn /// rn public bool ChickMessage()rn rn if (this.textBox1.Text.Trim().Equals(string.Empty))rn rn MessageBox.Show("请输入帐号!");rn this.textBox1.Focus();rn return false;rn rn if (this.textBox2.Text.Trim().Equals(string.Empty))rn rn MessageBox.Show("请输入密码!");rn this.textBox2.Focus();rn return false;rn rn elsern rn return true;rn rn rnrn public void Exit()rn rn DialogResult result = MessageBox.Show("你是否取消登录并退出!", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information);rn if (result==DialogResult.Yes)rn rn Application.Exit();rn rn rnrn private void button2_Click(object sender, EventArgs e)rn rn Exit();rn rn rn[/code]
设置了jdk环境,但还是不能运行
Exception in thread "main" java.lang.NoClassDefFoundError: hellodate (wrong namern: HelloDate)rn at java.lang.ClassLoader.defineClass0(Native Method)rn at java.lang.ClassLoader.defineClass(ClassLoader.java:486)rn at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:11rn1)rn at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)rn at java.net.URLClassLoader.access$100(URLClassLoader.java:56)rn at java.net.URLClassLoader$1.run(URLClassLoader.java:195)rn at java.security.AccessController.doPrivileged(Native Method)rn at java.net.URLClassLoader.findClass(URLClassLoader.java:188)rn at java.lang.ClassLoader.loadClass(ClassLoader.java:297)rn at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)rn at java.lang.ClassLoader.loadClass(ClassLoader.java:253)rn at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)rn
安卓音乐播放器_求大神求大神。
最近想做一个音乐播放器。不知道从何下手。第一个问题就是怎么搜索手机里面所有音乐文件。然后加载什么求大神。
安卓!!!!!求大神解释下
要实现多个按钮的点击事件应用匿名内部类,外部类,还是接口实现呢。可以说一下它们分别适用于什么条件吗
求安卓大神解答!!~~~??
someView.setOnLongClickListener(new View.OnLongClickListener() rn // Called when the user long-clicks on someViewrn public boolean onLongClick(View view) rn if (mActionMode != null) rn return false;rn rnrn // Start the CAB using the ActionMode.Callback defined abovern mActionMode = getActivity().startActionMode(mActionModeCallback);rn view.setSelected(true);rn return true;rn rn);rnrnrnrn为什么要判断mActionMode != null) 谢谢!rn本人是菜鸟~
java程序没报错,运行没结果,求大神
一个K均值的程序,一共有三个类,求大神帮助,运行没报错,但是没有输出rnpackage org.algorithm;rnimport java.util.ArrayList;rnimport java.util.Random;rnpublic class Kmeans rnprivate int NumOfCluster;//多少簇rn//private int NumOfData;//数据个数rnprivate ArrayList Data;//存放数据rnprivate ArrayList Center;//存放簇中心rnprivate ArrayList> Cluster;//存放簇rnprivate Random random;rnprivate ArrayList Save;rn//private ArrayList jc;rnrnpublic Kmeans(int k)rnrnif(k<=0)rnrnk=1;rnrnthis.NumOfCluster=k;rnData=new ArrayList();rnCenter=new ArrayList();rnCluster = new ArrayList>();rnSave=new ArrayList();rnrandom=new Random();rnrnrnrnrnpublic void SetData(ArrayList DataSet)rnrnData=DataSet;rnrnrnprivate void GetRandom()rnrnint[][] randoms = new int[NumOfCluster][2];rnPoint temp=new Point(0,0);rnboolean flag;rnfor(int i=0;i0)rnrnfor(int k=0;k());rnrnrnrnprivate void SetCenter()rnrnif(Center==null)rnrnGetRandom();rnrnelsernrndouble X=0,Y=0;rnint n=0;rnfor(int i=0;i> getCluster()rnrnreturn Cluster;rnrnprivate void Change()rnrnfor(int i=0;i dataSet=new ArrayList();rnPoint p0=new Point(1,2);rnPoint p1=new Point(3,3);rnPoint p2=new Point(3,4);rnPoint p3=new Point(5,6);rnPoint p4=new Point(8,9);rnPoint p5=new Point(4,5);rnPoint p6=new Point(6,4);rnPoint p7=new Point(3,9);rnPoint p8=new Point(5,9);rnPoint p9=new Point(4,1);rndataSet.add(p0);rndataSet.add(p1);rndataSet.add(p2);rndataSet.add(p3);rndataSet.add(p4);rndataSet.add(p5);rndataSet.add(p6);rndataSet.add(p7);rndataSet.add(p8);rndataSet.add(p9);rnk.SetData(dataSet);rn//执行算法rnk.execute();rn//得到聚类结果rnArrayList> cluster=k.getCluster();rn//查看结果rnfor(int i=0;i
求大神指导,安卓!!!!
我标记的1,2,3处不理解,求大神可以解释下,谢谢^ω^![图片](https://img-ask.csdn.net/upload/201611/15/1479217669_412896.jpg)
安卓!!!!求大神帮忙
怎么会这样呢![图片](https://img-ask.csdn.net/upload/201611/16/1479228607_521325.jpg)![图片](https://img-ask.csdn.net/upload/201611/16/1479228447_509494.jpg)
求安卓大神帮忙
求安卓大神帮帮忙,能帮我解决问题的,留下你的联系方式,有酬劳,或者站内联系我,可能项目比较大,单独发送需求文档
安卓页面跳转
package com.example.administrator.demo2; import android.support.v7.app.AppCompatActivity; import android.content.Intent; import android.view.View;//注意view的大小写 import android.view.View.OnClickListene...
求C大神赐教,此程序错在哪里
#includernint main(void)rnrn int year,month,day,sum,leap;rn printf("\nplease input year,month,day\n");rn scanf("%d,%d,%d",&year,&month,&day);rn switch(month)rn rn case 1:sum=0;break;rn case 2:sum=31;break;rn case 3:sum=59;break;rn case 4:sum=90;break;rn case 5:sum=120;break;rn case 6:sum=151;break;rn case 7:sum=181;break;rn case 8:sum=212;break;rn case 9:sum=243;break;rn case 10:sum=273;break;rn case 11:sum=304;break;rn case 12:sum=334;break;rn default:printf("data error");rn return -1;rn rn sum+=day;rn if(year%400==0||(year%4==0&&year%100!=0))rn leap=1;rn elsern leap=0;rn if(leap==1&&month>2)rn sum++;rn printf("It is the %dth day.",sum);rn return 0;rnrn//为什么总是出现data error
初学者求大神们赐教
请问怎么实施多个button跳转多个页面?网上面只有一个按钮跳转一个页面的事例,要是说如果单一个页面跳转成功的话复制成功跳转的页面的代码,改改button属性,多加个绑定事件的话..我试过了,结果按钮一按下去模拟器就崩溃了.
java新手求大神赐教
我想问一下 为什么在一个新建的类中重写equals方法是一定要重写hashcode方法?还有 如果我想重写String的 equals方法应该怎么做?
求大神 赐教 网络问题!!
socket的那几种模型,现在都过时了吗?rnselect模型怎样?
求懂winpcap的大神赐教!!
首先想知道winpcap到底是不是一个可执行软件,还是说它是一个库函数需要用其他软件来实现功能?n其次,我现在在做毕设,有关用winpcap来做网络流量监控与分析,仿真时可不可以用wireshark之类软件,这样做符不符合题目?
求安卓短信监听源代码
我想做一个定位器,就用1台安卓系统手机,在手机上安卓短信监听和GPS定位程序,当收到特定内容短信后(如8个0),运行定位程序,并将定位结果发送回去。求助啊。
相关热词 c++和c#哪个就业率高 c# 批量动态创建控件 c# 模块和程序集的区别 c# gmap 截图 c# 验证码图片生成类 c# 再次尝试 连接失败 c#开发编写规范 c# 压缩图片好麻烦 c#计算数组中的平均值 c#获取路由参数