I am trying to setup a tooltip using a OnCreateOptionsMenu, however I am getting an error when trying to setText(text).
CODE:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.puzzle_tips, menu);
SpannableString text = new SpannableString("TOP TIP:\nShake screen to reshuffle puzzle");
text.setSpan(new ForegroundColorSpan(Color.RED), 0, 3, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
Drawable d = ContextCompat.getDrawable(getBaseContext(), R.drawable.tips_icon);
d.setBounds(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight());
ImageSpan span = new ImageSpan(d, ImageSpan.ALIGN_BASELINE);
text.setSpan(span, 31, 32, Spannable.SPAN_INCLUSIVE_EXCLUSIVE);
MenuItem menuItem = menu.findItem(R.id.menuPuzzleTips);
Tooltip.Builder builder = new Tooltip.Builder(menuItem)
.setCornerRadius(10f)
.setGravity(Gravity.BOTTOM)
.setText(text);
builder.show();
return super.onCreateOptionsMenu(menu);
}
ERROR:
error: no suitable method found for setText(SpannableString)
method Builder.setText(int) is not applicable
(argument mismatch; SpannableString cannot be converted to int)
method Builder.setText(String) is not applicable
(argument mismatch; SpannableString cannot be converted to String)