Fala ae pessoal, eu estou tendo erro em um método que eu fiz. Sempre que eu chamo esse metodo na minha classe ela da o seguinte erro:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.alan.beeconnection/com.example.alan.beeconnection.ProfileActivity}: java.lang.NumberFormatException: Invalid int: "null"
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2416)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.NumberFormatException: Invalid int: "null"
at java.lang.Integer.invalidInt(Integer.java:138)
at java.lang.Integer.parseInt(Integer.java:358)
at java.lang.Integer.parseInt(Integer.java:334)
at com.example.alan.beeconnection.ProfileActivity.spinnerGender(ProfileActivity.java:156)
at com.example.alan.beeconnection.ProfileActivity.executeClass(ProfileActivity.java:90)
at com.example.alan.beeconnection.ProfileActivity.onCreate(ProfileActivity.java:50)
at android.app.Activity.performCreate(Activity.java:6237)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
O metodo que estou usando é o seguinte:
public void spinnerAge(){
//Spinner
final Spinner spinnerAge = (Spinner) findViewById(R.id.spinnerProfileAge);
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.age, android.R.layout.simple_spinner_item);
spinnerAge.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
spinnerAge.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
age = String.valueOf(position);
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
}
});
return false;
}
});
spinnerAge.setAdapter(adapter);
spinnerAge.setSelection(Integer.parseInt(age));
}
Esse é só um método da minha classe, caso precisem eu posso postar a classe toda.
Obs: A Activity nem chega a abrir