Currently, I'm trying to develop an app. and I don't know how to change the Toast font. .
final OnClickListener clickListener = new OnClickListener() {
public void onClick(View v) {
try {
Toast.makeText(nova.this,"Hello", 500000).show();
}
catch (Exception e) {
Toast.makeText(nova.this,"Exception:" +e, 500000);
}
}
};
I want to change the text "Hello" with custom font I've tried with TypeFace.
and Then, I want to set a variable at the place "TextClicked" .. I've tried with a local variable .. but it doesn't work
any help with example source code will be really great for me.
From the official documentation:
If a simple text message isn't enough, you can create a customized layout for your toast notification. To create a custom layout, define a View layout, in XML or in your application code, and pass the root View object to the
setView(View)
method.
Following the link to the official Google Documentation will provide examples.