错误不幸应用程序已停止。 [英] Error Unfortunatly App Has stopped.

查看:103
本文介绍了错误不幸应用程序已停止。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是android devloper的初学者,但在午餐期间有一些问题模拟器上的应用程序..请帮助我...所有项目下面提到的,与日志猫错误,,,,任何身体帮我解决这个错误....









错误记录猫



10-18 21:43:07.355 :I / Choreographer(1495):跳过33帧!应用程序可能在其主线程上做了太多工作。

10-18 21:43:21.636:D / AndroidRuntime(1495):关闭VM

10- 18 21:43:21.640:E / AndroidRuntime(1495):致命异常:主要

10-18 21:43:21.640:E / AndroidRuntime(1495):进程:com.jacpl.login, PID:1495

10-18 21:43:21.640:E / AndroidRuntime(1495):java.lang.NullPointerException:尝试调用虚方法'void android.app.ProgressDialog.show()'在null对象引用上

10-18 21:43:21.640:E / AndroidRuntime(1495):at com.jacpl.login.MainActivity.login(MainActivity.java:70)

10-18 21:43:21.640:E / AndroidRuntime(1495):at com.jacpl.login.MainActivity.access $ 2(MainActivity.java:68)

10-18 21 :43:21.640:E / AndroidRuntime(1495):at com.jacpl.login.MainActivity $ 1.onClick(MainActivity.java:93)

10-18 21:43:21.640:E / AndroidRuntime (1495):在android.view.View.performClick(View.java:4756)

10-18 21:43:21.640:E / AndroidRunt ime(1495):在android.view.View $ PerformClick.run(View.java:19749)

10-18 21:43:21.640:E / AndroidRuntime(1495):at android.os .Handler.handleCallback(Handler.java:739)

10-18 21:43:21.640:E / AndroidRuntime(1495):在android.os.Handler.dispatchMessage(Handler.java:95)

10-18 21:43:21.640:E / AndroidRuntime(1495):在android.os.Looper.loop(Looper.java:135)

10-18 21:43:21.640:E / AndroidRuntime(1495):在android.app.ActivityThread.main(ActivityThread.java:5221)

10-18 21:43:21.640:E / AndroidRuntime(1495) ):at java.lang.reflect.Method.invoke(Native Method)

10-18 21:43:21.640:E / AndroidRuntime(1495):at java.lang.reflect.Method.invoke (Method.java:372)

10-18 21:43:21.640:E / AndroidRuntime(1495):at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java: 899)

10-18 21:43:21.640:E / AndroidRuntime(1495):at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

10-18 21:43 :26.463:I / Process(1495):发送信号。 PID:1495 SIG:9













====================================== ========================









MailActivity



package com.jacpl。登录;



导入android.support.v7.app.ActionBarActivity;

导入android.app.AlertDialog;

import android.app.ProgressDialog;

import android.content.Intent;

import android.content.SharedPreferences;

import android。 os.Bundle;

导入android.view.View;

导入android.widget.Button;

导入android.widget.CheckBox;

导入android.widget.EditText;

导入android.widget.TextView;

导入android.widget.Toast;



import com.jacpl.login.Java.UserService.User;

import com.jacpl.login.Java.UserService.UserService;





@SuppressWarnings(弃用)

公共类MainActivity扩展ActionBarActivity {

私有EditText usernameEditText;

私人EditText passwordEduitText ;

私有CheckBox rememberMeCheckBox;

私有TextView forgotPasswordTextView;

私人按钮loginButton;

私人按钮signUpButton;

私人ProgressDialog pd;





@Override

protected void onCreate(Bundle) savedInstanceState){

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);



usernameEditText =(EditText)findViewById(R.id.edittext_username);

passwordEduitText =(EditText)findViewById(R.id.edittext_password);

rememberMeCheckBox =(CheckBox) findViewById(R.id.checkbox_remember_me);

forgotPasswordTextView =(TextView)findViewById(R.id.textview_forgot_passwor d);

loginButton =(Button)findViewById(R.id.button_login);

signUpButton =(Button)findViewById(R.id.button_sign_up);



loginButton.setOnClickListener(onClickLoginButtonListener);

signUpButton.setOnClickListener(onClickSignUpButtonListener);

forgotPasswordTextView.setOnClickListener(onClickForgotPasswordTextViewListener);



ProgressDialog pd = new ProgressDialog(MainActivity.this);

pd.setIndeterminate(true);











SharedPreferences sharedPreferences = getSharedPreferences(user_data,MODE_PRIVATE );

boolean remembered = sharedPreferences.getBoolean(remembered,false);

if(记住)

{

rememberMeCheckBox.setChecked(true);

String username = sharedPreferences.getString(username,null);

String password = sharedPreferences.getString(password,null);

login(username,password);

}

}









private void login(String username,String password)

{

pd.show();

UserService .getInstance(MainActivity.this).login(username,password,loginListener);

}



private void goToSignupActivity()

{

Intent intent = new Intent(this,SignUpActivity.class);

startActivity(intent);

} < br $>


private void goToWelcomeActivity()

{

Intent intent = new Intent(this,WelcomeActivity.class);

startActivity(意图);

完成();

}



V iew.OnClickListener onClickLoginButtonListener = new View.OnClickListener(){

@Override

public void onClick(查看视图){

String username = usernameEditText .getText()。toString();

String password = passwordEduitText.getText()。toString();



login(username,密码);

}

};



View.OnClickListener onClickSignUpButtonListener = new View.OnClickListener(){

@Override

public void onClick(查看视图){

goToSignupActivity();

}

};



View.OnClickListener onClickForgotPasswordTextViewListener = new View.OnClickListener(){

@Override

public void onClick(查看视图){

AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);

builder.setTitle(Waraing);

builder.setIcon(R.drawable.ic_man);

builder.setMessage(Not implement);

builder.setPositiveButton(OK,null);

builder.show();

}

};



UserService.LoginListener loginListener = new UserService.LoginListener(){

@Override

public void onResponce(boolean loggedin) ,字符串消息,用户用户){

pd.dismiss();

Toast.makeText(MainActivity.this,message,Toast.LENGTH_SHORT).show();

if(loggedin)

{

SharedPreferences sharedPreferences = getSharedPreferences(user_data,MODE_PRIVATE);

SharedPreferences。编辑器编辑器= sharedPreferences.edit();

if(rememberMeCheckBox.isChecked())

{

editor.putBoolean(remembered,true);

editor.putString(username,user.getUsername());

editor .putString(password,user.getPassword());

}

else

{

editor .putBoolean(remembered,false);

editor.remove(username);

editor.remove(password);

}

editor.commit();

goToWelcomeActivity();

}

}

};



}













SingUpActivity

package com.jacpl.login;



import android.support.v7.app.ActionBarActivity;

import android.app。活动;

i mport android.app.ProgressDialog;

import android.content.Intent;

import android.graphics.Bitmap;

import android.graphics。 BitmapFactory;

导入android.os.Bundle;

导入android.view.Menu;

导入android.view.MenuItem;

导入android.view.View;

导入android.widget.CompoundButton;

导入android.widget.EditText;

import android.widget.ImageView;

import android.widget.RadioButton;

import android.widget.RadioGroup;

import android.widget。 Toast;



import java.io.FileNotFoundException;

import java.io.IOException;

import java .io.InputStream;



import com.jacpl.login.Java.UserService.User;

import com.jacpl.login.Java .UserService.UserService;



@SuppressWarnings(弃用)

公共类SignUpActivity扩展ActionBarActivity {


private ImageView profileImageView;

private EditText usernameEditText;

private EditText passwordEditText;

private EditText emailEditText;

私人RadioGroup genderRadioGroup;

私人RadioButton maleRadioButton;

@SuppressWarnings(unused)

私人RadioButton femaleRadioButton;

private CompoundButton newsletterSubscriptionCompoundButton;

private CompoundButton allowOtherEmailCompoundButton;

private ProgressDialog progressDialog;

private Bitmap bitmap;



private static final int SELECT_PICTURE = 1;



@Override

protected void onCreate(Bundle savedInstanceState ){

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_sign_up);



if(UserService.getInstance(this).getCurrentUser()!= null)

{

goToWelcomeActivity();

}



progressDialog = new ProgressDialog(this);

progressDialog.setIndeterminate(true);



profileImageView =(ImageView)findViewById(R.id.imageview_profile);

usernameEditText =(EditText)findViewById(R.id.edittext_username);

passwordEditText =(EditText)findViewById(R.id.edittext_password);

emailEditText =(EditText)findViewById( R.id.edittext_email);

genderRadioGroup =(RadioGroup)findViewById(R.id.radiogroup_gender);

maleRadioButton =(RadioButton)findViewById(R.id.radiobutton_male) ;

femaleRadioButton =(RadioButton)findViewById(R.id.radiobutton_female);

newsletterSubscriptionCompoundButton =(CompoundButton)findViewById(R.id.switch_subscription);

if(newsletterSubscriptionCompoun dButton == null)

{

newsletterSubscriptionCompoundButton =(CompoundButton)findViewById(R.id.checkbox_subscription);

}

allowOtherEmailCompoundButton =(CompoundButton)findViewById(R.id.switch_allow_email);

if(allowOtherEmailCompoundButton == null){

allowOtherEmailCompoundButton =(CompoundButton)findViewById(R。 id.checkbox_allow_email);

}

maleRadioButton.setChecked(true);



profileImageView.setOnClickListener(onClickProfileImageViewListener );



}



View.OnClickListener onClickProfileImageViewListener = new View.OnClickListener(){

@Override

public void onClick(查看视图){

chooseImage();

}

};



private void chooseImage()

{

Intent intent = new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);

startActivityForResult(intent,SELECT_PICTURE);

}



@Override

protected void onActivityResult(int requestCode,int resultCode,Intent data){

if(requestCode == SELECT_PICTURE&& resultCode == Activity.RESULT_OK)

try {

//我们需要重新调用未使用的位图

if(bitmap!= null){

bitmap.recycle();

}

InputStream stream = getContentResolver()。openInputStream(data.getData());

BitmapFactory.Options options = new BitmapFactory.Options();

options.inSampleSize = 2;

bitmap = BitmapFactory.decodeStream(stream,null,options) ;

int width = bitmap.getWidth();

int height = bitmap.getHeight();

double scale = 100.0 / height;

height =(int)(height * scale);

width =(int)(width * scale);

bitmap = Bitmap。 createScaledBitmap(bitmap,width,height,false);

stream.close() ;

profileImageView.setImageBitmap(位图);

} catch(FileNotFoundException e){

e.printStackTrace();

} catch(IOException e){

e.printStackTrace();

}

super.onActivityResult(requestCode,resultCode,data );

}



@Override

public boolean onCreateOptionsMenu(菜单菜单){

getMenuInflater()。inflate(R.menu.sign_up,menu);

返回true;

}



@Override

public boolean onOptionsItemSelected(MenuItem item){

int id = item.getItemId();

if(id == R.id.action_submit){

String username = usernameEditText.getText()。toString();

String password = passwordEditText.getText()。toString() ;

字符串email = emailEditText.getText()。toString();

User.Gender性别;

if(genderRadioGroup.getCheckedRadioButtonId()== R.id.radiobutton_male)

{

gender = User.Gender.MALE;

}

else

{

gender = User.Gender.FEMALE;

}

boolean newsletterSubscribed = newsletterSubscriptionCompoundButton.isChecked();

boolean allowedOtherEmail = allowOtherEmailCompoundButton.isChecked();



注册(用户名,密码,电子邮件,性别,newsletter订阅,allowedOtherEmail);



返回true;

}

返回super.onOptionsItemSelected(item);

}



private void register(String username,String password,String email,User.Gender gender,boo精简newsletterSubscribed,boolean allowedOtherEmail)

{

progressDialog.show();

UserService.getInstance(SignUpActivity.this).register(username,密码,电子邮件,性别,newsletter订阅,allowedOtherEmail,registerListener,bitmap);

}



UserService.RegisterListener registerListener = new UserService.RegisterListener( ){

@Override

public void onResponce(布尔注册,字符串消息,用户用户){

progressDialog.dismiss();

Toast.makeText(SignUpActivity.this,message,Toast.LENGTH_SHORT).show();

if(registered)

{

goToWelcomeActivity();

}

}

};



private void goToWelcomeActivity()

{

Intent intent = new Intent(this,WelcomeActivity.c lass);

startActivity(意图);

完成();

}

}









WelcomeActivity





包com.jacpl.login;



import android .support.v7.app.ActionBarActivity;

导入android.os.Bundle;

导入android.view.View;

导入android。 widget.CheckBox;

import android.widget.CompoundButton;

import android.widget.ImageView;

import android.widget.Switch;

导入android.widget.TextView;



导入com.jacpl.login.Java.UserService.User;

import com.jacpl.login.Java.UserService.UserService;

@SuppressWarnings(deprecation)

公共类WelcomeActivity扩展ActionBarActivity {



私人ImageView profileImageView;

私人TextView usernameTextView;

pr ivate TextView emailTextVIew;

private TextView genderTextView;

private CompoundButton newsletterSubscriptionCompoundButton;

private CompoundButton allowOtherEmailCompoundButton;



@Override

protected void onCreate(Bundle savedInstanceState){

super.onCreate(savedInstanceState);

setContentView(R .layout.activity_welcome);



用户user =(用户)getIntent()。getExtras()。getSerializable(user);



if(user == null){

finish();

return;

}



profileImageView =(ImageView)findViewById(R.id.imageview_profile);

usernameTextView =(TextView)findViewById(R.id.textview_username);

emailTextVIew =(TextView)findViewById(R.id.textview_email);

genderTextView =(TextView)findViewById(R.id.textview _gender);

newsletterSubscriptionCompoundButton =(Switch)findViewById(R.id.switch_subscription);

if(newsletterSubscriptionCompoundButton == null)

{

newsletterSubscriptionCompoundButton =(CheckBox)findViewById(R.id.checkbox_subscription);

}

allowOtherEmailCompoundButton =(Switch)findViewById(R.id.switch_allow_email );

if(allowOtherEmailCompoundButton == null)

{

allowOtherEmailCompoundButton =(CheckBox)findViewById(R.id.checkbox_allow_email);

}



profileImageView.setImageBitmap(UserService.getInstance(this).getProfileImage(user));

usernameTextView。 setText(String.format(Username:%s,user.getUsername()));

emailTextVIew.setText(String.format(Email:%s,user.getEmail()) );

genderTextView.setText(String.format (性别:%s,user.getGender()== User.Gender.MALE?男:女));

newsletterSubscriptionCompoundButton.setChecked(user.isNewsletterSubscribed());

allowOtherEmailCompoundButton.setChecked(user.isAllowedOtherEmail());



if(!allowOtherEmailCompoundButton.isChecked())

{

emailTextVIew.setVisibility(View.GONE);

}

}

}







ProfileActivity



包com.jacpl.login;



import android.support.v7.app.ActionBarActivity;

import android.content.Intent;

import android.content.SharedPreferences;

import android.os.Bundle;

import android。 view.Menu;

import android.view.MenuItem;

import android.widget.ImageView;

import android.widget.TextView; < br $> b $ b

import co m.jacpl.login.Java.UserService.User;

import com.jacpl.login.Java.UserService.UserService;



@ SuppressWarnings(弃用)

公共类ProfileActivity扩展ActionBarActivity {



私有ImageView profileImageView;

私有TextView greetingTextView;



@Override

protected void onCreate(Bundle savedInstanceState){

super.onCreate(savedInstanceState) ;

setContentView(R.layout.activity_profile);

profileImageView =(ImageView)findViewById(R.id.imageview_profile);

greetingTextView = (TextView)findViewById(R.id.textview_greeting);



用户user = UserService.getInstance(this).getCurrentUser();



if(user == null){

finish();

return;

}



greetingTextView.setText(String.fo rmat(Hello,%s,user.getUsername()));

profileImageView.setImageBitmap(UserService.getInstance(this).getProfileImage(user));

} $ / $


@Override

public boolean onCreateOptionsMenu(菜单菜单){

//给菜单充气;如果它存在,这会将项目添加到操作栏。

getMenuInflater()。inflate(R.menu.welcome,menu);

返回true;

}



@Override

public boolean onOptionsItemSelected(MenuItem item){

int id = item.getItemId();

if(id == R.id.menu_user_list){

return true;

} else if(id == R.id.menu_profile){

goToMenuProfilePage();

返回true;

}否则if(id == R.id .menu_logout){

logout();

返回true;

}

返回super.onOptionsItemSelected(item );

}



private void goToMenuProfilePage()

{

意图intent = new Intent(this,ProfileActivity.class);

startActivity(intent);

}



private void logout()

{

UserService.getInstance(this).logout();

SharedPreferences sharedPreferences = getSharedPreferences( user_data,MODE_PRIVATE);

SharedPreferences.Editor editor = sharedPreferences.edit();

editor.putBoolean(remembered,false);

editor.remove(username);

editor.remove(password);

editor.commit();

完成();

}

}





UserListActivity



包com.jacpl.login;



import android.support.v7.app.ActionBarActivity;

import android.os.Bundle;

import android.widget.ListView;



import java.util.ArrayList;

import java.util.List;



import com.jacpl .login.Java.UserService.User;

import com.jacpl.login.Java。 UserService.UserListAdapter;

import com.jacpl.login.Java.UserService.UserService;



@SuppressWarnings(deprecation)

公共类UserListActivity扩展ActionBarActivity {



List< user> users = new ArrayList< user>();

UserListAdapter adapter;



@Override

protected void onCreate (Bundle savedInstanceState){

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_user_list);

adapter = new UserListAdapter(这个,用户);



UserService.getInstance(this).getUserList(getUserListListener);



ListView userListView =(ListView)findViewById(android.R.id.list);

userListView.setAdapter(adapter);

}



UserService.GetUserListListener getUserListListener = new UserService.GetUserListListener(){

@Override

public void onResponce(boolean success,String message,List< user> userList){

if(成功)

{

users.clear();

adapter.notifyDataSetChanged();

users.addAll(userList);

adapter.notifyDataSetChanged();

}

}

};

}







activity_main





< relativelayout xmlns:android =http://schemas.android.com/apk/res/android>

xmlns:tools =http://schemas.android.com/tools

android:layout_width =match_parent

android:layout_height =match_parent

tools:context =com.jacpl.login。 MainActivity>



< ImageView

android:layout_width =match_parent

android:layout_height = 200dp

android:id =@ + id / imageview_app_logo

android:layout_alignParentTop =true

android:layout_centerHorizo​​ntal =真的

android: src =@ drawable / ic_launcher

android:adjustViewBounds =true

android:padding =32dp

android:background = #2DABFF

android:layout_marginBottom =16dp

/>



< edittext>

android:id =@ + id / edittext_username

android:layout_centerHorizo​​ntal =true

android:hint =Username

android:layout_width =250dp

android:layout_height =wrap_content

android:layout_below =@ + id / imageview_app_logo

android:singleLine =true

android:maxLines =1/>



< edittext> ;

android:id =@ + id / edittext_password

android:layout_below =@ + id / edittext_username

android:layout_alignRight =@ + id / edittext_username

android:layout_alignLeft =@ + id / edittext _username

android:hint =密码

android:layout_width =0dp

android:layout_height =wrap_content

android:inputType =textPassword

android:ems =10

android:singleLine =true

android:maxLines =1/>



< checkbox>

android:id =@ + id / checkbox_remember_me

android:layout_width =wrap_content

android:layout_height =wrap_content

android:text =remember_me

android:layout_below =@ + id / edittext_password

android:layout_alignLeft =@ + id / edittext_password

android:layout_marginLeft =8dp

android:layout_marginTop =16dp/>



< textview>

android:id =@ + id / textview_forgot_password

android:layout_width =wrap_content

android:layout_height =wrap_content

android:textAppearance =?android:attr / textAppearanceSmall

android:text =forgote pass?

android:layout_below =@ + id / checkbox_remember_me

android:layout_centerHorizo​​ntal =true

android:layout_marginTop =16dp

android:textColor =#FF4040/>



< linearlayout> android:orientation =horizo​​ntal

android:layout_width =fill_parent

android:layout_height =wrap_content

android:layout_alignParentBottom =真的

android:layout_alignParentLeft =true

android:layout_alignParentStart =true

android:weightSum =2> < br $> b $ b

<按钮

android:id =@ + id / button_sign_up

android:layout_width = wrap_content

android:layout_height =wrap_content

android:text =Sing Up

android:layout_weight =1/> ;



<按钮

android:id =@ + id / button_login

android:layout_width =\"wrap_content\"

android:layout_height=\"wrap_content\"

android:text=\"login\"

android:layout_weight=\"1\" / >









activity_sing-up







<relativelayout xmlns:android=\"http://schemas.android.com/apk/res/android\">

xmlns:tools=\"http://schemas.android.com/tools\"

android:layout_width=\"match_parent\"

android:layout_height=\"match_parent\"

android:paddingLeft=\"@dimen/activity_horizontal_margin\"

android:paddingRight=\"@dimen/activity_horizontal_margin\"

android:paddingTop=\"@dimen/activity_vertical_margin\"

android:paddingBottom=\"@dimen/activity_vertical_margin\"

tools:context=\"com.jacpl.login.SignUpActivity\" >



<ImageView

android:layout_width=\"100dp\"

android:layout_height=\"100dp\"

android:adjustViewBounds=\"true\"

android:id=\"@+id/imageview_profile\"

android:layout_alignParentTop=\"true\"

android:layout_centerHorizontal=\"true\"

android:layout_marginTop=\"32dp\"

android:src=\"@drawable/ic_man\" />



<edittext>

android:id=\"@+id/edittext_username\"

android:layout_width=\"250dp\"

android:layout_height=\"wrap_content\"

android:textAppearance=\"?android:attr/textAppearanceMedium\"

android:hint=\"Username\"

android:layout_below=\"@+id/imageview_profile\"

android:layout_centerHorizontal=\"true\"

android:layout_marginTop=\"16dp\" />



<edittext>

android:id=\"@+id/edittext_password\"

android:layout_width=\"250dp\"

android:layout_height=\"wrap_content\"

android:textAppearance=\"?android:attr/textAppearanceMedium \"

android:hint=\"Password\"

android:password=\"true\"

android:layout_below=\"@+id/edittext_username\"

android:layout_centerHorizontal=\"true\"

/>



<edittext>

android:id=\"@+id/edittext_email\"

android:inputType=\"textEmailAddress\"

android:layout_width=\"250dp\"

android:layout_height=\"wrap_content\"

android:textAppearance=\"?android:attr/textAppearanceMedium\"

android:hint=\"Username\"

android:layout_below=\"@+id/edittext_password\"

android:layout_centerHorizontal=\"true\"

/>

<radiogroup>

android:id=\"@+id/radiogroup_gender\"

android:layout_width=\"250dp\"

android:layout_height=\"wrap_content\"

android:orientation=\"horiz ontal\"

android:layout_below=\"@+id/edittext_email\"

android:layout_centerHorizontal=\"true\"

>

<radiobutton>

android:id=\"@+id/radiobutton_male\"

android:text=\"male\"

android:layout_width=\"wrap_content\"

android:layout_height=\"wrap_content\" />

<radiobutton>

android:text=\"female\"

android:id=\"@+id/radiobutton_female\"

android:layout_width=\"wrap_content\"

android:layout_height=\"wrap_content\" />





<switch>

android:id=\"@+id/switch_subscription\"

android:layout_width=\"300dp\"

android:layout_height=\"wrap_content\"

android:text=\"Email subscriptions\"

android:layout_centerHo rizontal=\"true\"

android:layout_marginTop=\"16dp\"

android:layout_below=\"@+id/radiogroup_gender\"

/>



<switch>

android:id=\"@+id/switch_allow_email\"

android:layout_width=\"300dp\"

android:layout_height=\"wrap_content\"

android:text=\"Allow email from other\"

android:layout_centerHorizontal=\"true\"

android:layout_marginTop=\"16dp\"

android:layout_below=\"@+id/switch_subscription\"

/>









activity_welcome





<relativelayout xmlns:android=\"http://schemas.android.com/apk/res/android\">

xmlns:tools=\"http://schemas.android.com/tools\"

android:layout_width=\"match_parent\"

android:layout_height=\"match_parent \"

android:paddingLeft=\"@dimen/activity_horizontal_margin\"

android:paddingRight=\"@dimen/activity_horizontal_margin\"

android:paddingTop=\"@dimen/activity_vertical_margin\"

android:paddingBottom=\"@dimen/activity_vertical_margin\"

tools:context=\"com.jacpl.login.WelcomeActivity\" >



<ImageView

android:layout_width=\"100dp\"

android:layout_height=\"100dp\"

android:adjustViewBounds=\"true\"

android:id=\"@+id/imageview_profile\"

android:layout_alignParentTop=\"true\"

android:layout_centerHorizontal=\"true\"

android:layout_marginTop=\"32dp\"

android:src=\"@drawable/ic_man\" />



<textview>

android:layout_width=\"wrap_content\"

android:layout_height=\"wrap_content\"

android:t extAppearance=\"?android:attr/textAppearanceMedium\"

android:text=\"Welcome To Gujju famaly \"

android:id=\"@+id/textview_greeting\"

android:layout_below=\"@+id/imageview_profile\"

android:layout_centerHorizontal=\"true\"

android:layout_marginTop=\"16dp\" />







activity_profile



<relativelayout xmlns:android=\"http://schemas.android.com/apk/res/android\">

xmlns:tools=\"http://schemas.android.com/tools\"

android:layout_width=\"match_parent\"

android:layout_height=\"match_parent\"

android:paddingLeft=\"@dimen/activity_horizontal_margin\"

android:paddingRight=\"@dimen/activity_horizontal_margin\"

android:paddingTop=\"@dimen/activity_vertical_margin\"

android:paddingBottom=\"@dimen/activity_vertical_margin\"

tools:context=\"com.jacpl.login.ProfileActivity\" >



<ImageView

android:layout_width=\"100dp\"

android:layout_height=\"100dp\"

android:adjustViewBounds=\"true\"

android:id=\"@+id/imageview_profile\"

android:layout_alignParentTop=\"true\"

android:layout_centerHorizontal=\"true\"

android:layout_marginTop=\"32dp\"

android:src=\"@drawable/ic_man\" />



<textview>

android:id=\"@+id/textview_username\"

android:layout_width=\"250dp\"

android:layout_height=\"wrap_content\"

android:textAppearance=\"?android:attr/textAppearanceMedium\"

android:text=\"Username: JohnDoe\"

android:layout_below=\"@+id/imageview_profile\"

android:layout_centerHorizontal=\"true\"

andro id:layout_marginTop=\"16dp\" />



<textview>

android:id=\"@+id/textview_email\"

android:inputType=\"textEmailAddress\"

android:layout_width=\"250dp\"

android:layout_height=\"wrap_content\"

android:textAppearance=\"?android:attr/textAppearanceMedium\"

android:text=\"Email: john.doe@example.com\"

android:layout_below=\"@+id/textview_username\"

android:layout_centerHorizontal=\"true\"

android:layout_marginTop=\"16dp\"

/>



<textview>

android:id=\"@+id/textview_gender\"

android:inputType=\"textEmailAddress\"

android:layout_width=\"250dp\"

android:layout_height=\"wrap_content\"

android:textAppearance=\"?android:attr/textAppearanceMedium\"

android:text=\"Ge nder: Male\"

android:layout_below=\"@+id/textview_email\"

android:layout_centerHorizontal=\"true\"

android:layout_marginTop=\"16dp\"

/>



<checkbox>

android:id=\"@+id/checkbox_subscription\"

android:layout_width=\"250dp\"

android:layout_height=\"wrap_content\"

android:text=\"Email subscriptions\"

android:layout_centerHorizontal=\"true\"

android:layout_marginTop=\"16dp\"

android:layout_below=\"@+id/textview_gender\"

android:enabled=\"false\"

/>



<checkbox>

android:id=\"@+id/checkbox_allow_email\"

android:layout_width=\"250dp\"

android:layout_height=\"wrap_content\"

android:text=\"Allow email from other\"

android:l ayout_centerHorizontal=\"true\"

android:layout_marginTop=\"16dp\"

android:layout_below=\"@+id/checkbox_subscription\"

android:enabled=\"false\"

/>

















UserList Layout



<listview xmlns:android=\"http://schemas.android.com/apk/res/android\"> xmlns:tools=\"http://schemas.android.com/tools\"

android:layout_width=\"match_parent\"

android:layout_height=\"match_parent\"

tools:context=\"com.jacpl.login.UserListActivity\"

android:id=\"@android:id/list\">









Manifest







<manifest xmlns:android=\"http://schemas.android.com/apk/res/android\">

package=\"com.jacpl.login\"









android:versionCode=\"1\"

android:versionName=\"1.0\" >



<uses-sdk>

android:minSdkVersion=\"9\"

android:targetSdkVersion=\"21\" />

<uses-permission android:name=\"android.permission.INTERNET\">

<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\">
<uses-permission android:name=\"android.permission.READ_USER_DICTIONARY\">



<application>

android:allowBackup=\"true\"

android:icon=\"@drawable/ic_launcher\"

android:label=\"@string/app_name\"

android:theme=\"@style/Theme.AppCompat\" >

<activity>

android:name=\".MainActivity\"

android:label=\"@string/app_name\" >

<intent-filter>

<action android:name=\"android.intent.action.MAIN\">



<category android:name=\"android.intent.category.LAUNCHER\">





<activity>

android:name=\".WelcomeActivity\"

android:label=\"@string/title_activity_welcome\" >







<activity>

android:name=\".SignUpActivity\"

android:label=\"@string/title_activity_sign_up\" >



<activity>

android:name=\".ProfileActivity\"

android:label=\"@string/title_activity_profile\" >



<activity>

android:name=\".UserListActivity\"

android:label=\"@string/title_activity_user_list\" >






I am beginger for android devloper but having some issue during lunch the application on emulator ..please Help me ...All the project mantioned below,,with log cat Error,,,,any body help me how to resolve this error ....




Error Log Cat

10-18 21:43:07.355: I/Choreographer(1495): Skipped 33 frames! The application may be doing too much work on its main thread.
10-18 21:43:21.636: D/AndroidRuntime(1495): Shutting down VM
10-18 21:43:21.640: E/AndroidRuntime(1495): FATAL EXCEPTION: main
10-18 21:43:21.640: E/AndroidRuntime(1495): Process: com.jacpl.login, PID: 1495
10-18 21:43:21.640: E/AndroidRuntime(1495): java.lang.NullPointerException: Attempt to invoke virtual method 'void android.app.ProgressDialog.show()' on a null object reference
10-18 21:43:21.640: E/AndroidRuntime(1495): at com.jacpl.login.MainActivity.login(MainActivity.java:70)
10-18 21:43:21.640: E/AndroidRuntime(1495): at com.jacpl.login.MainActivity.access$2(MainActivity.java:68)
10-18 21:43:21.640: E/AndroidRuntime(1495): at com.jacpl.login.MainActivity$1.onClick(MainActivity.java:93)
10-18 21:43:21.640: E/AndroidRuntime(1495): at android.view.View.performClick(View.java:4756)
10-18 21:43:21.640: E/AndroidRuntime(1495): at android.view.View$PerformClick.run(View.java:19749)
10-18 21:43:21.640: E/AndroidRuntime(1495): at android.os.Handler.handleCallback(Handler.java:739)
10-18 21:43:21.640: E/AndroidRuntime(1495): at android.os.Handler.dispatchMessage(Handler.java:95)
10-18 21:43:21.640: E/AndroidRuntime(1495): at android.os.Looper.loop(Looper.java:135)
10-18 21:43:21.640: E/AndroidRuntime(1495): at android.app.ActivityThread.main(ActivityThread.java:5221)
10-18 21:43:21.640: E/AndroidRuntime(1495): at java.lang.reflect.Method.invoke(Native Method)
10-18 21:43:21.640: E/AndroidRuntime(1495): at java.lang.reflect.Method.invoke(Method.java:372)
10-18 21:43:21.640: E/AndroidRuntime(1495): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
10-18 21:43:21.640: E/AndroidRuntime(1495): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
10-18 21:43:26.463: I/Process(1495): Sending signal. PID: 1495 SIG: 9






==============================================================




MailActivity

package com.jacpl.login;

import android.support.v7.app.ActionBarActivity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import com.jacpl.login.Java.UserService.User;
import com.jacpl.login.Java.UserService.UserService;


@SuppressWarnings("deprecation")
public class MainActivity extends ActionBarActivity {
private EditText usernameEditText;
private EditText passwordEduitText;
private CheckBox rememberMeCheckBox;
private TextView forgotPasswordTextView;
private Button loginButton;
private Button signUpButton;
private ProgressDialog pd;


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

usernameEditText = (EditText) findViewById(R.id.edittext_username);
passwordEduitText = (EditText) findViewById(R.id.edittext_password);
rememberMeCheckBox = (CheckBox) findViewById(R.id.checkbox_remember_me);
forgotPasswordTextView = (TextView) findViewById(R.id.textview_forgot_password);
loginButton = (Button) findViewById(R.id.button_login);
signUpButton = (Button) findViewById(R.id.button_sign_up);

loginButton.setOnClickListener(onClickLoginButtonListener);
signUpButton.setOnClickListener(onClickSignUpButtonListener);
forgotPasswordTextView.setOnClickListener(onClickForgotPasswordTextViewListener);

ProgressDialog pd = new ProgressDialog(MainActivity.this);
pd.setIndeterminate(true);





SharedPreferences sharedPreferences = getSharedPreferences("user_data",MODE_PRIVATE);
boolean remembered = sharedPreferences.getBoolean("remembered",false);
if(remembered)
{
rememberMeCheckBox.setChecked(true);
String username = sharedPreferences.getString("username", null);
String password = sharedPreferences.getString("password", null);
login(username,password);
}
}




private void login(String username,String password)
{
pd.show();
UserService.getInstance(MainActivity.this).login(username, password, loginListener);
}

private void goToSignupActivity()
{
Intent intent = new Intent(this,SignUpActivity.class);
startActivity(intent);
}

private void goToWelcomeActivity()
{
Intent intent = new Intent(this,WelcomeActivity.class);
startActivity(intent);
finish();
}

View.OnClickListener onClickLoginButtonListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
String username = usernameEditText.getText().toString();
String password = passwordEduitText.getText().toString();

login(username, password);
}
};

View.OnClickListener onClickSignUpButtonListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
goToSignupActivity();
}
};

View.OnClickListener onClickForgotPasswordTextViewListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setTitle("Waraing");
builder.setIcon(R.drawable.ic_man);
builder.setMessage("Not implement");
builder.setPositiveButton("OK",null);
builder.show();
}
};

UserService.LoginListener loginListener = new UserService.LoginListener() {
@Override
public void onResponce(boolean loggedin, String message, User user) {
pd.dismiss();
Toast.makeText(MainActivity.this,message,Toast.LENGTH_SHORT).show();
if(loggedin)
{
SharedPreferences sharedPreferences = getSharedPreferences("user_data",MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
if(rememberMeCheckBox.isChecked())
{
editor.putBoolean("remembered", true);
editor.putString("username", user.getUsername());
editor.putString("password", user.getPassword());
}
else
{
editor.putBoolean("remembered",false);
editor.remove("username");
editor.remove("password");
}
editor.commit();
goToWelcomeActivity();
}
}
};

}






SingUpActivity
package com.jacpl.login;

import android.support.v7.app.ActionBarActivity;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Toast;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

import com.jacpl.login.Java.UserService.User;
import com.jacpl.login.Java.UserService.UserService;

@SuppressWarnings("deprecation")
public class SignUpActivity extends ActionBarActivity {

private ImageView profileImageView;
private EditText usernameEditText;
private EditText passwordEditText;
private EditText emailEditText;
private RadioGroup genderRadioGroup;
private RadioButton maleRadioButton;
@SuppressWarnings("unused")
private RadioButton femaleRadioButton;
private CompoundButton newsletterSubscriptionCompoundButton;
private CompoundButton allowOtherEmailCompoundButton;
private ProgressDialog progressDialog;
private Bitmap bitmap;

private static final int SELECT_PICTURE = 1;

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

if(UserService.getInstance(this).getCurrentUser()!=null)
{
goToWelcomeActivity();
}

progressDialog = new ProgressDialog(this);
progressDialog.setIndeterminate(true);

profileImageView = (ImageView) findViewById(R.id.imageview_profile);
usernameEditText = (EditText) findViewById(R.id.edittext_username);
passwordEditText = (EditText) findViewById(R.id.edittext_password);
emailEditText = (EditText) findViewById(R.id.edittext_email);
genderRadioGroup = (RadioGroup) findViewById(R.id.radiogroup_gender);
maleRadioButton = (RadioButton) findViewById(R.id.radiobutton_male);
femaleRadioButton = (RadioButton) findViewById(R.id.radiobutton_female);
newsletterSubscriptionCompoundButton = (CompoundButton) findViewById(R.id.switch_subscription);
if(newsletterSubscriptionCompoundButton == null)
{
newsletterSubscriptionCompoundButton = (CompoundButton) findViewById(R.id.checkbox_subscription);
}
allowOtherEmailCompoundButton = (CompoundButton) findViewById(R.id.switch_allow_email);
if(allowOtherEmailCompoundButton == null) {
allowOtherEmailCompoundButton = (CompoundButton) findViewById(R.id.checkbox_allow_email);
}
maleRadioButton.setChecked(true);

profileImageView.setOnClickListener(onClickProfileImageViewListener);

}

View.OnClickListener onClickProfileImageViewListener = new View.OnClickListener() {
@Override
public void onClick(View view) {
chooseImage();
}
};

private void chooseImage()
{
Intent intent = new Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, SELECT_PICTURE);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == SELECT_PICTURE && resultCode == Activity.RESULT_OK)
try {
// We need to recyle unused bitmaps
if (bitmap != null) {
bitmap.recycle();
}
InputStream stream = getContentResolver().openInputStream(data.getData());
BitmapFactory.Options options = new BitmapFactory.Options();
options.inSampleSize=2;
bitmap = BitmapFactory.decodeStream(stream, null, options);
int width = bitmap.getWidth();
int height = bitmap.getHeight();
double scale = 100.0/height;
height = (int)(height*scale);
width = (int)(width*scale);
bitmap = Bitmap.createScaledBitmap(bitmap, width,height, false);
stream.close();
profileImageView.setImageBitmap(bitmap);
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
super.onActivityResult(requestCode, resultCode, data);
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.sign_up, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.action_submit) {
String username = usernameEditText.getText().toString();
String password = passwordEditText.getText().toString();
String email = emailEditText.getText().toString();
User.Gender gender;
if(genderRadioGroup.getCheckedRadioButtonId() == R.id.radiobutton_male)
{
gender = User.Gender.MALE;
}
else
{
gender = User.Gender.FEMALE;
}
boolean newsletterSubscribed = newsletterSubscriptionCompoundButton.isChecked();
boolean allowedOtherEmail = allowOtherEmailCompoundButton.isChecked();

register(username,password,email,gender,newsletterSubscribed,allowedOtherEmail);

return true;
}
return super.onOptionsItemSelected(item);
}

private void register(String username,String password, String email, User.Gender gender, boolean newsletterSubscribed, boolean allowedOtherEmail)
{
progressDialog.show();
UserService.getInstance(SignUpActivity.this).register(username,password,email,gender,newsletterSubscribed,allowedOtherEmail,registerListener,bitmap);
}

UserService.RegisterListener registerListener = new UserService.RegisterListener() {
@Override
public void onResponce(boolean registered, String message, User user) {
progressDialog.dismiss();
Toast.makeText(SignUpActivity.this, message, Toast.LENGTH_SHORT).show();
if(registered)
{
goToWelcomeActivity();
}
}
};

private void goToWelcomeActivity()
{
Intent intent = new Intent(this,WelcomeActivity.class);
startActivity(intent);
finish();
}
}




WelcomeActivity


package com.jacpl.login;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.Switch;
import android.widget.TextView;

import com.jacpl.login.Java.UserService.User;
import com.jacpl.login.Java.UserService.UserService;
@SuppressWarnings("deprecation")
public class WelcomeActivity extends ActionBarActivity {

private ImageView profileImageView;
private TextView usernameTextView;
private TextView emailTextVIew;
private TextView genderTextView;
private CompoundButton newsletterSubscriptionCompoundButton;
private CompoundButton allowOtherEmailCompoundButton;

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

User user = (User) getIntent().getExtras().getSerializable("user");

if(user==null) {
finish();
return;
}

profileImageView = (ImageView) findViewById(R.id.imageview_profile);
usernameTextView = (TextView) findViewById(R.id.textview_username);
emailTextVIew = (TextView) findViewById(R.id.textview_email);
genderTextView = (TextView) findViewById(R.id.textview_gender);
newsletterSubscriptionCompoundButton = (Switch) findViewById(R.id.switch_subscription);
if(newsletterSubscriptionCompoundButton==null)
{
newsletterSubscriptionCompoundButton = (CheckBox) findViewById(R.id.checkbox_subscription);
}
allowOtherEmailCompoundButton = (Switch) findViewById(R.id.switch_allow_email);
if(allowOtherEmailCompoundButton==null)
{
allowOtherEmailCompoundButton = (CheckBox) findViewById(R.id.checkbox_allow_email);
}

profileImageView.setImageBitmap(UserService.getInstance(this).getProfileImage(user));
usernameTextView.setText(String.format("Username: %s",user.getUsername()));
emailTextVIew.setText(String.format("Email: %s",user.getEmail()));
genderTextView.setText(String.format("Gender: %s",user.getGender()== User.Gender.MALE?"Male":"Female"));
newsletterSubscriptionCompoundButton.setChecked(user.isNewsletterSubscribed());
allowOtherEmailCompoundButton.setChecked(user.isAllowedOtherEmail());

if(!allowOtherEmailCompoundButton.isChecked())
{
emailTextVIew.setVisibility(View.GONE);
}
}
}



ProfileActivity

package com.jacpl.login;

import android.support.v7.app.ActionBarActivity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.widget.ImageView;
import android.widget.TextView;

import com.jacpl.login.Java.UserService.User;
import com.jacpl.login.Java.UserService.UserService;

@SuppressWarnings("deprecation")
public class ProfileActivity extends ActionBarActivity {

private ImageView profileImageView;
private TextView greetingTextView;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profile);
profileImageView = (ImageView) findViewById(R.id.imageview_profile);
greetingTextView = (TextView) findViewById(R.id.textview_greeting);

User user = UserService.getInstance(this).getCurrentUser();

if(user==null) {
finish();
return;
}

greetingTextView.setText(String.format("Hello, %s", user.getUsername()));
profileImageView.setImageBitmap(UserService.getInstance(this).getProfileImage(user));
}

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

@Override
public boolean onOptionsItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.menu_user_list) {
return true;
}else if (id == R.id.menu_profile) {
goToMenuProfilePage();
return true;
}else if (id == R.id.menu_logout) {
logout();
return true;
}
return super.onOptionsItemSelected(item);
}

private void goToMenuProfilePage()
{
Intent intent = new Intent(this,ProfileActivity.class);
startActivity(intent);
}

private void logout()
{
UserService.getInstance(this).logout();
SharedPreferences sharedPreferences = getSharedPreferences("user_data",MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putBoolean("remembered",false);
editor.remove("username");
editor.remove("password");
editor.commit();
finish();
}
}


UserListActivity

package com.jacpl.login;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;

import com.jacpl.login.Java.UserService.User;
import com.jacpl.login.Java.UserService.UserListAdapter;
import com.jacpl.login.Java.UserService.UserService;

@SuppressWarnings("deprecation")
public class UserListActivity extends ActionBarActivity {

List<user> users = new ArrayList<user>();
UserListAdapter adapter;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_user_list);
adapter = new UserListAdapter(this, users);

UserService.getInstance(this).getUserList(getUserListListener);

ListView userListView = (ListView) findViewById(android.R.id.list);
userListView.setAdapter(adapter);
}

UserService.GetUserListListener getUserListListener = new UserService.GetUserListListener() {
@Override
public void onResponce(boolean success, String message, List<user> userList) {
if(success)
{
users.clear();
adapter.notifyDataSetChanged();
users.addAll(userList);
adapter.notifyDataSetChanged();
}
}
};
}



activity_main


<relativelayout xmlns:android="http://schemas.android.com/apk/res/android">
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.jacpl.login.MainActivity" >

<ImageView
android:layout_width="match_parent"
android:layout_height="200dp"
android:id="@+id/imageview_app_logo"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:src="@drawable/ic_launcher"
android:adjustViewBounds="true"
android:padding="32dp"
android:background="#2DABFF"
android:layout_marginBottom="16dp"
/>

<edittext>
android:id="@+id/edittext_username"
android:layout_centerHorizontal="true"
android:hint="Username"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:layout_below="@+id/imageview_app_logo"
android:singleLine="true"
android:maxLines="1"/>

<edittext>
android:id="@+id/edittext_password"
android:layout_below="@+id/edittext_username"
android:layout_alignRight="@+id/edittext_username"
android:layout_alignLeft="@+id/edittext_username"
android:hint="Password"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:ems="10"
android:singleLine="true"
android:maxLines="1"/>

<checkbox>
android:id="@+id/checkbox_remember_me"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="remember_me"
android:layout_below="@+id/edittext_password"
android:layout_alignLeft="@+id/edittext_password"
android:layout_marginLeft="8dp"
android:layout_marginTop="16dp"/>

<textview>
android:id="@+id/textview_forgot_password"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="forgote pass?"
android:layout_below="@+id/checkbox_remember_me"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
android:textColor="#FF4040"/>

<linearlayout> android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:weightSum="2">

<Button
android:id="@+id/button_sign_up"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sing Up"
android:layout_weight="1" />

<Button
android:id="@+id/button_login"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="login"
android:layout_weight="1" />




activity_sing-up



<relativelayout xmlns:android="http://schemas.android.com/apk/res/android">
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.jacpl.login.SignUpActivity" >

<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:adjustViewBounds="true"
android:id="@+id/imageview_profile"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="32dp"
android:src="@drawable/ic_man" />

<edittext>
android:id="@+id/edittext_username"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:hint="Username"
android:layout_below="@+id/imageview_profile"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp" />

<edittext>
android:id="@+id/edittext_password"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:hint="Password"
android:password="true"
android:layout_below="@+id/edittext_username"
android:layout_centerHorizontal="true"
/>

<edittext>
android:id="@+id/edittext_email"
android:inputType="textEmailAddress"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:hint="Username"
android:layout_below="@+id/edittext_password"
android:layout_centerHorizontal="true"
/>
<radiogroup>
android:id="@+id/radiogroup_gender"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_below="@+id/edittext_email"
android:layout_centerHorizontal="true"
>
<radiobutton>
android:id="@+id/radiobutton_male"
android:text="male"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<radiobutton>
android:text="female"
android:id="@+id/radiobutton_female"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />


<switch>
android:id="@+id/switch_subscription"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:text="Email subscriptions"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
android:layout_below="@+id/radiogroup_gender"
/>

<switch>
android:id="@+id/switch_allow_email"
android:layout_width="300dp"
android:layout_height="wrap_content"
android:text="Allow email from other"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
android:layout_below="@+id/switch_subscription"
/>




activity_welcome


<relativelayout xmlns:android="http://schemas.android.com/apk/res/android">
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.jacpl.login.WelcomeActivity" >

<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:adjustViewBounds="true"
android:id="@+id/imageview_profile"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="32dp"
android:src="@drawable/ic_man" />

<textview>
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Welcome To Gujju famaly "
android:id="@+id/textview_greeting"
android:layout_below="@+id/imageview_profile"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp" />



activity_profile

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android">
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.jacpl.login.ProfileActivity" >

<ImageView
android:layout_width="100dp"
android:layout_height="100dp"
android:adjustViewBounds="true"
android:id="@+id/imageview_profile"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="32dp"
android:src="@drawable/ic_man" />

<textview>
android:id="@+id/textview_username"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Username: JohnDoe"
android:layout_below="@+id/imageview_profile"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp" />

<textview>
android:id="@+id/textview_email"
android:inputType="textEmailAddress"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Email: john.doe@example.com"
android:layout_below="@+id/textview_username"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
/>

<textview>
android:id="@+id/textview_gender"
android:inputType="textEmailAddress"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Gender: Male"
android:layout_below="@+id/textview_email"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
/>

<checkbox>
android:id="@+id/checkbox_subscription"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:text="Email subscriptions"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
android:layout_below="@+id/textview_gender"
android:enabled="false"
/>

<checkbox>
android:id="@+id/checkbox_allow_email"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:text="Allow email from other"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
android:layout_below="@+id/checkbox_subscription"
android:enabled="false"
/>








UserList Layout

<listview xmlns:android="http://schemas.android.com/apk/res/android"> xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.jacpl.login.UserListActivity"
android:id="@android:id/list">




Manifest



<manifest xmlns:android="http://schemas.android.com/apk/res/android">
package="com.jacpl.login"




android:versionCode="1"
android:versionName="1.0" >

<uses-sdk>
android:minSdkVersion="9"
android:targetSdkVersion="21" />
<uses-permission android:name="android.permission.INTERNET">
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE">
<uses-permission android:name="android.permission.READ_USER_DICTIONARY">

<application>
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.AppCompat" >
<activity>
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN">

<category android:name="android.intent.category.LAUNCHER">


<activity>
android:name=".WelcomeActivity"
android:label="@string/title_activity_welcome" >



<activity>
android:name=".SignUpActivity"
android:label="@string/title_activity_sign_up" >

<activity>
android:name=".ProfileActivity"
android:label="@string/title_activity_profile" >

<activity>
android:name=".UserListActivity"
android:label="@string/title_activity_user_list" >



推荐答案

2(MainActivity.java:68)

10-18 21:43:21.640: E/AndroidRuntime(1495): \tat com.jacpl.login.MainActivity
2(MainActivity.java:68)
10-18 21:43:21.640: E/AndroidRuntime(1495): at com.jacpl.login.MainActivity


1.onClick(MainActivity.java:93)

10-18 21:43:21.640: E/AndroidRuntime(1495): \tat android.view.View.performClick(View.java:4756)

10-18 21:43:21.640: E/AndroidRuntime(1495): \tat android. view.View
1.onClick(MainActivity.java:93)
10-18 21:43:21.640: E/AndroidRuntime(1495): at android.view.View.performClick(View.java:4756)
10-18 21:43:21.640: E/AndroidRuntime(1495): at android.view.View


PerformClick.run(View.java:19749)

10-18 21:43:21.640: E/AndroidRuntime(1495): \tat android.os.Handler.handleCallback(Handler.java:739)

10-18 21:43:21.640: E/AndroidRuntime(1495): \tat android.os.Handler.dispatchMessage(Handler.java:95)

10-18 21:43:21.640: E/AndroidRuntime(1495): \tat android.os.Looper.loop(Looper.java:135)

10-18 21:43:21.640: E/AndroidRuntime(1495): \tat android.app.ActivityThread.main(ActivityThread.java:5221)

10-18 21:43:21.640: E/AndroidRuntime(1495): \tat java.lang.reflect.Method.invoke(Native Method)

10-18 21:43:21.640: E/AndroidRuntime(1495): \tat java.lang.reflect.Method.invoke(Method.java:372)

10-18 21:43:21.640: E/AndroidRuntime(1495): \tat com.android.internal.os.ZygoteInit
PerformClick.run(View.java:19749)
10-18 21:43:21.640: E/AndroidRuntime(1495): at android.os.Handler.handleCallback(Handler.java:739)
10-18 21:43:21.640: E/AndroidRuntime(1495): at android.os.Handler.dispatchMessage(Handler.java:95)
10-18 21:43:21.640: E/AndroidRuntime(1495): at android.os.Looper.loop(Looper.java:135)
10-18 21:43:21.640: E/AndroidRuntime(1495): at android.app.ActivityThread.main(ActivityThread.java:5221)
10-18 21:43:21.640: E/AndroidRuntime(1495): at java.lang.reflect.Method.invoke(Native Method)
10-18 21:43:21.640: E/AndroidRuntime(1495): at java.lang.reflect.Method.invoke(Method.java:372)
10-18 21:43:21.640: E/AndroidRuntime(1495): at com.android.internal.os.ZygoteInit


这篇关于错误不幸应用程序已停止。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆