0

the code below makes the application crash on a meizu phone, but not on my galaxy s2. (meizu version is newer but it's not mine, and not here so I don't know what is the version)

public void onClick(View v){
    et= (EditText) findViewById(R.id.searchEdit);
    int newArrIndex= 0;
    Log.d("BeforeFirst","BeforeFirst");
    String [] newArr=new String [contactsArray.length];
    for (int i=0;i<contactsArray.length;i++){
        if(et.getText().toString().contains("blibli")){
            newArr[0]="bla";
            newArr[1]="blo";
            break;
        }
        else if(et.getText().toString().contains("blabla")){
            newArr[0]="bli";
            newArr[1]="blu";
            break;
        }
        if(contactsArray[i].contains(et.getText().toString())){
            newArr[newArrIndex]=contactsArray[i];
            newArrIndex++;
        }
        et.setSelected(false);
    }

    Bundle bundle=new Bundle();
    bundle.putStringArray("contacts",newArr);

    MyPlaceholderFragment frag=new MyPlaceholderFragment();
    frag.setArguments(bundle);
    getSupportFragmentManager().beginTransaction()
            .add(R.id.container, frag)
            .commit();
    setContentView(R.layout.activity_search);
}

when I click enter the my galaxy s2 keyboard, I get what I want. when I do the same on the meizu mx4, it crashes after I press enter. So what could be the problem here? It must be some android class that is not compatible with both phones (and not my stupid program - cause it works)

the phone is not mine, and not with me, so I don't have error log. Any idea? direction? Thanks a lot.

Upsilon42
  • 241
  • 2
  • 17
  • Thank you, but I said twice that I dont have the phone, so no logCat – Upsilon42 Feb 13 '15 at 16:29
  • All we can do is guess, if I guessed based on experience, I'd say contactsArray is probably null. Of course it could be anything. Best bet is to check Google Play for reported errors, or of course install an error reporting library: https://try.crashlytics.com/ – James Feb 13 '15 at 17:07
  • Thank you James, but look, it works on my galaxy. so contactArray is not null. I'm 99% sure the error comes after the loop, or with the EditText... does the EditText and what I do with Bundle and Fragment work the same for most of android versions? – Upsilon42 Feb 13 '15 at 17:21

0 Answers0