hbb20 / hbb20/CountryCodePickerProject

Ihave this error :Attempt to invoke virtual method 'void com.hbb20.CountryCodePicker.registerCarrierNumberEditText(android.widget.EditText)' on a null object reference

Open
#502 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.5k
Forks
509
PR merge metrics
No merged PRs in 30d

Description

package com.example.geolab;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import com.hbb20.CountryCodePicker;

public class PhoneLoginActivity extends AppCompatActivity {

private CountryCodePicker ccp;
private EditText userPhoneNumber;
private Button cuntiniueToVerify;
@Override
protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

InitializeFields();

cuntiniueToVerify.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view)
{
Intent OTPintent = new Intent(PhoneLoginActivity.this,OTPActivity.class);
OTPintent.putExtra("mobile",ccp.getFullNumberWithPlus().replace(" ",""));
startActivity(OTPintent);
}
});

}

private void InitializeFields()
{
userPhoneNumber = (EditText) findViewById(R.id.phone_number_id);
ccp = (CountryCodePicker) findViewById(R.id.ccp);
ccp.registerCarrierNumberEditText(userPhoneNumber);
cuntiniueToVerify = (Button) findViewById(R.id.cuntiniue_button);
}

}

//------------------------------------------------------layout-------------------------------------------


Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the pasted PhoneLoginActivity, especially InitializeFields(), and compare its findViewById calls with the embedded layout XML. Reproduce the crash at registerCarrierNumberEditText and determine why the CountryCodePicker lookup is null. Done means the phone-login screen initializes without this null-reference exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.