List of usage examples for android.widget TabWidget getContext
@ViewDebug.CapturedViewProperty public final Context getContext()
From source file:br.com.viniciuscr.notification2android.mediaPlayer.MusicUtils.java
static boolean updateButtonBar(Activity a, int highlight) { final TabWidget ll = (TabWidget) a.findViewById(R.id.buttonbar); boolean withtabs = false; Intent intent = a.getIntent();/* w w w. j a v a 2 s. c o m*/ if (intent != null) { withtabs = intent.getBooleanExtra("withtabs", false); } if (highlight == 0 || !withtabs) { ll.setVisibility(View.GONE); return withtabs; } else if (withtabs) { ll.setVisibility(View.VISIBLE); } for (int i = ll.getChildCount() - 1; i >= 0; i--) { View v = ll.getChildAt(i); boolean isActive = (v.getId() == highlight); if (isActive) { ll.setCurrentTab(i); sActiveTabIndex = i; } v.setTag(i); v.setOnFocusChangeListener(new View.OnFocusChangeListener() { public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { for (int i = 0; i < ll.getTabCount(); i++) { if (ll.getChildTabViewAt(i) == v) { ll.setCurrentTab(i); processTabClick((Activity) ll.getContext(), v, ll.getChildAt(sActiveTabIndex).getId()); break; } } } } }); v.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { processTabClick((Activity) ll.getContext(), v, ll.getChildAt(sActiveTabIndex).getId()); } }); } return withtabs; }