Click here to Skip to main content
15,881,516 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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" >



Posted
Comments
E.F. Nijboer 20-Oct-15 3:43am    
That's way to much code for a question. You need to pinpoint where the error is happening. Run the app in the emulator with the debugger attached.
By he way. Try it without ps.Show() and pd.Dismiss()

1 solution

This is your error:
The application may be doing too much work on its main thread.
Rather use async task for your methods.

Refer this:
AsyncTask[^]
Why, When & How to use it[^]

-KR
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900