GitNex/app/src/main/java/org/mian/gitnex/helpers/Toasty.java

32 lines
739 B
Java

package org.mian.gitnex.helpers;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;
import org.mian.gitnex.R;
/**
* Author M M Arif
*/
public class Toasty {
public static void info(Context context, String message) {
LayoutInflater inflater = LayoutInflater.from(context);
View view = inflater.inflate( context.getResources().getLayout(R.layout.custom_toast), null );
TextView text = view.findViewById(R.id.toastText);
text.setText(message);
Toast toast = new Toast(context);
toast.setDuration(Toast.LENGTH_LONG);
toast.setView(view);
toast.show();
}
}