Available for download on Wrox.com
Context context = getApplicationContext();
int duration = Toast.LENGTH_LONG;
Toast toast = Toast.makeText(context, msg, duration); toast.setGravity(Gravity.TOP, 0, 0);
LinearLayout ll = new LinearLayout(context) ll.setOrientation(LinearLayout.VERTICAL);
TextView myTextView = new TextView(context) CompassView cv = new CompassView(context);
int lHeight = LinearLayout.LayoutParams.FILL_PARENT; int lWidth = LinearLayout.LayoutParams.WRAP_CONTENT;
ll.addView(cv, new LinearLayout.LayoutParams(lHeight, lWidth)); ll.addView(myTextView, new LinearLayout.LayoutParams(lHeight, lWidth));
The resulting Toast will appear as shown in Figure 9-2.
Was this article helpful?
Quick start guide to skyrocket your offline and online business success with mobile apps. If you know anything about mobile devices, you’ve probably heard that famous phrase coined by one of the mobile device’s most prolific creators proclaiming that there’s an app for pretty much everything.