5
TextView textview = (TextView)findViewById(timeScore);
    i = (int)(gridView.getTime() / 1000L);
    String s = getString(time_score);
    Object aobj[] = new Object[1];
    aobj[0] = Integer.valueOf(i);
    textview.setText(String.format(s, aobj));

Getting Error in Android Studio in last conversion aobj

"Wrong Argument type for formatting argument #1 in time_score: conversion 'd', recevied Object (argument #2 in method call)"

4
  • show initialization of time_score Commented Jul 22, 2015 at 4:52
  • there is no initialization here, only getting String from resource id Commented Jul 22, 2015 at 5:08
  • Pls check or comment the answers. Commented Jul 22, 2015 at 13:06
  • Minhtdh answer worked for me Commented Jul 26, 2015 at 10:14

1 Answer 1

5

I think it's because of textview.setText(String.format(s, aobj));

Your string format require integer value but you pass a array to it.

Try this: textview.setText(String.format(s, i));

Hope this helps.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.