Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7853345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:39:27+00:00 2026-06-02T19:39:27+00:00

I’m getting a NullPointerException: public void llenardatos(SQLiteDatabase db, int pos) { ImgVector = new

  • 0

I’m getting a NullPointerException:

public void llenardatos(SQLiteDatabase db, int pos) {

    ImgVector = new ImageView[50];
    String[] id = new String[] { String.valueOf(pos + 1) }; 

    EditText txttipo = (EditText) mContentView.findViewById(R.id.Txttipo);
    EditText spalto = (EditText) mContentView.findViewById(R.id.Txtalto);
    EditText splargo = (EditText) mContentView.findViewById(R.id.TxtLargo);
    EditText spancho = (EditText) mContentView.findViewById(R.id.Txtancho);
    EditText sobser = (EditText) mContentView
            .findViewById(R.id.txtobservaciones);
    EditText sphora = (EditText) mContentView.findViewById(R.id.Txthora);
    EditText txtfecha = (EditText) mContentView.findViewById(R.id.txtfecha);
    TextView txtlati = (TextView) mContentView
            .findViewById(R.id.txtlatitud);
    TextView txtlongi = (TextView) mContentView
            .findViewById(R.id.txtlongitud);

    Critico cr = new Critico();
    cr.seleccionar(db, id);
    txttipo.setText("" + cr.getTipo());
    spalto.setText("" + cr.getAlto());
    splargo.setText("" + cr.getLargo());
    spancho.setText("" + cr.getAncho());
    sobser.setText("" + cr.getObservaciones());
    sphora.setText(cr.getHora());
    txtfecha.setText("" + cr.getFecha());
    txtlati.setText("" + cr.getLatitud());
    txtlongi.setText("" + cr.getLongitud());

    FotoCritico fc = new FotoCritico();
    ArrayList<String> datos = fc.seleccionartodos(db, id);
    int i = datos.size();
    for (int contador = 0; contador < i; contador++) {
        String dato = datos.get(contador);
        Uri imgUri = Uri.parse(dato);

        LinearLayout.LayoutParams lparams4 = new LinearLayout.LayoutParams(
                500, 250, 1f);
        ImgVector[contador] = new ImageView(getActivity());
        ImgVector[contador].setLayoutParams(lparams4);
        ImgVector[contador].setImageResource(R.drawable.fotoandroid);
        ImgVector[contador].setId(contador);
        ImgVector[contador].setPadding(0, 10, 0, 10);
        lyn.addView(ImgVector[contador]);
        // personas++;
        ImgVector[contador].setImageURI(imgUri);
    }
}

I’m getting a NullPointerException:

04-25 08:39:57.630: E/AndroidRuntime(3358): FATAL EXCEPTION: main
04-25 08:39:57.630: E/AndroidRuntime(3358): java.lang.NullPointerException
04-25 08:39:57.630: E/AndroidRuntime(3358):     at android.view.ViewConfiguration.get(ViewConfiguration.java:276)

Eclipse is not reporting a syntax error. What did I do wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T19:39:31+00:00Added an answer on June 2, 2026 at 7:39 pm

    A java.lang.NullPointerException happens when you try to access an object that has the value null. The variable ‘lyn’, or ‘ImgVector[contador]’ has the value null when when you are trying to use it.

    To find out which variable has the value null, put some if statements in there:

    if (lyn == null)
      Log.d("error", "lyn has null");
    
    if (ImgVector[contador] == null)
      Log.d("error", "ImgVector[contador] has null");
    

    Put these lines throughout the code, and the if statement should evaluate to true, and this will be the spot where you need to make sure the variables are instantiated.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
public static bool CheckLogin(string Username, string Password, bool AutoLogin) { bool LoginSuccessful; // Trim
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
Specifically, suppose I start with the string string =hello \'i am \' me And
I want use html5's new tag to play a wav file (currently only supported

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.