aboutsummaryrefslogtreecommitdiff
path: root/src/net/cbaines/suma/ToastHelperActivity.java
blob: 6c5974c3d5ca1d4abd9d17eef9822fbd2eddb172 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package net.cbaines.suma;

import android.widget.TextView;
import android.widget.Toast;

import com.j256.ormlite.android.apptools.OrmLiteBaseActivity;

public class ToastHelperActivity extends OrmLiteBaseActivity<DatabaseHelper> {

	protected Toast toast;
	protected TextView toastView;

	void makeToast(String message, int length) {
		if (toastView == null) {
			toastView = (TextView) getLayoutInflater().inflate(R.layout.toast_view, null);
		}
		toastView.setText(message);
		if (toast == null) {
			toast = new Toast(this);
		}
		toast.setDuration(length);
		toast.setView(toastView);
		toast.show();
	}

}