I want to know how to display toast programmaticaly. When I read the data from the database, I can only see the toast for short time, even though the length of the text is small or bigger. But I want to see the toast visible for little longer(At least for 3-5 seconds).
Something like this might suit your needs :
String stringFromDatabase = "your string";
if (stringFromDatabase.length()<200){
Toast.make(context, stringFromDatabase, Toast.LENGTH_SHORT).show();
}else{
Toast.make(context, stringFromDatabase, Toast.LENGTH_LONG).show();
}
This will show your Toast for a short or long time, depending on the length of your String.