shengry0716 2013-11-24 12:48 采纳率: 0%
浏览 999

JAVA写成后导出apk文件无法运行

初学JAVA,想做一个两个页面间跳转的APP,主页面输入用户名密码(为方便起见,先将其在程序中设定为1234,不等于1234则跳转第二个页面重新输入,等于执行其他,但因目前没有其他页面,故都转到重输入页面,程序不显示BUG,但apk文件运行不了,求各位帮忙。。。真的很急,以下是代码package com.example.health_monitor;

import com.example.health_monitor.R;

import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.content.Intent;
import android.widget.EditText;
import android.widget.TextView;
public class MainActivity extends Activity {
private Button submit1;
private TextView instruction1;
private TextView username1;
private TextView password1;
private EditText user1;
private EditText pass1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
submit1=(Button)findViewById(R.id.button1);
instruction1=(TextView)findViewById(R.id.textView3);
username1=(TextView)findViewById(R.id.textView1);
user1=(EditText)findViewById(R.id.editText1);
String text1=user1.getText().toString();
final int textint1 = Integer.valueOf(text1).intValue();
password1=(TextView)findViewById(R.id.textView2);
pass1=(EditText)findViewById(R.id.editText2);
String text2=pass1.getText().toString();
final int textint2 = Integer.valueOf(text2).intValue();
submit1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(textint1==1234&&textint2==1234)
{Intent call_second_Interface=new Intent();
call_second_Interface.setClass(MainActivity.this,reenter.class);
startActivity(call_second_Interface);}
else {Intent call_second_Interface=new Intent();
call_second_Interface.setClass(MainActivity.this,reenter.class);
startActivity(call_second_Interface);}}
// TODO Auto-generated method stub

    });

    }


@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;
}

}
以上是主页面代码
package com.example.health_monitor;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class reenter extends Activity {
private Button submit1;
private TextView instruction1;
private TextView username1;
private TextView password1;
private EditText user1;
private EditText pass1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.bmeg_reenter);
submit1=(Button)findViewById(R.id.button1);
instruction1=(TextView)findViewById(R.id.textView3);
username1=(TextView)findViewById(R.id.textView1);
user1=(EditText)findViewById(R.id.editText1);
String text1=user1.getText().toString();
final int textint1 = Integer.valueOf(text1).intValue();
password1=(TextView)findViewById(R.id.textView2);
pass1=(EditText)findViewById(R.id.editText2);
String text2=pass1.getText().toString();
final int textint2 = Integer.valueOf(text2).intValue();
submit1.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            if(textint1==1234&&textint2==1234)
        {Intent call_second_Interface=new Intent();
        call_second_Interface.setClass(reenter.this,reenter.class);
        startActivity(call_second_Interface);}
            else {Intent call_second_Interface=new Intent();
            call_second_Interface.setClass(reenter.this,reenter.class);
            startActivity(call_second_Interface);}}
            // TODO Auto-generated method stub





    });
}

@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;
}

}
以上是第二个重输入页面代码。。。第一次用JAVA,求不要嘲笑。。。

  • 写回答

1条回答

  • CSDN-Ada助手 CSDN-AI 官方账号 2022-09-20 23:56
    关注
    不知道你这个问题是否已经解决, 如果还没有解决的话:

    如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^
    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料