|
如題:紅字的地方有錯誤~但不知道該怎麼辦@@
package android.arc;
import android.os.Bundle;
import android.app.Activity;
import android.content.SharedPreferences;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;
import android.support.v4.app.NavUtils;
public class Comein extends Activity {
TextView b1,a2,a3;
EditText c1,c2;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_comein);
b1= (TextView) findViewById(R.id.b1);
a2= (TextView) findViewById(R.id.a2);
a3= (TextView) findViewById(R.id.a3);
c1= (EditText) findViewById(R.id.c1);
c2= (EditText) findViewById(R.id.c2);
}
public void b5to(View view){
SharedPreferences sp = getPreferences(MODE_PRIVATE);
String db = sp.getString(c1.getText().toString(),"");
if(c2!=db){
Toast.makeText(getApplicationContext(),
"登入成功",Toast.LENGTH_LONG).show();
}
else{
Toast.makeText(getApplicationContext(),
"帳號密碼錯誤",Toast.LENGTH_LONG).show();
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_comein, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
}
} |
|