Move tab navigation to bottom while using tooleap - android

I have added tab navigation within a tooleap popout, but because the way tooleap works the tabs are covering the toolbar which is required for tooleap to be used. I would like to move the tabs to the bottom of the screen to avoid this issue.
This is what it currently looks like:
This is want I want it to look like:
This is my Tooleap activity I want the tabs in:
import android.os.Bundle;
import com.tooleap.sdk.TooleapActivities;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBar.Tab;
import android.util.Log;
public class MyTooleapActivity extends TooleapActivities.ActionBarActivity {
private static final String TAG = "junk";
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_container);
setUpTabs(savedInstanceState);
}
#Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
// save the selected tab's index so it's re-selected on orientation change
outState.putInt("tabIndex", getSupportActionBar().getSelectedNavigationIndex());
}
private void setUpTabs(Bundle savedInstanceState) {
ActionBar actionBar = getSupportActionBar();
actionBar.setNavigationMode(actionBar.NAVIGATION_MODE_TABS);
actionBar.setDisplayShowTitleEnabled(false);
Tab tab_one = actionBar.newTab();
Tab tab_two = actionBar.newTab();
Tab tab_three = actionBar.newTab();
FirstFragment firstFragment = new FirstFragment();
tab_one.setText("One")
.setContentDescription("The first tab")
.setTabListener(
new MyTabListener<FirstFragment>(
firstFragment));
SecondFragment secondFragment = new SecondFragment();
tab_two.setText("Two")
.setContentDescription("The second tab")
.setTabListener(
new MyTabListener<SecondFragment>(
secondFragment));
ThirdFragment thirdFragment = new ThirdFragment();
tab_three
.setText("Three")
.setContentDescription("The third tab")
.setTabListener(
new MyTabListener<ThirdFragment>(
thirdFragment));
actionBar.addTab(tab_one);
actionBar.addTab(tab_two);
actionBar.addTab(tab_three);
if (savedInstanceState != null) {
Log.i(TAG, "setting selected tab from saved bundle");
// get the saved selected tab's index and set that tab as selected
actionBar.setSelectedNavigationItem(savedInstanceState.getInt("tabIndex", 0));
}
}
}
and here is my activity_container.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<FrameLayout
android:id="#+id/container"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</FrameLayout>
</LinearLayout>
Manifest.xml as requested:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapp">
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity
android:name=".MyActivity"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MyTooleapActivity"
android:launchMode="singleInstance"
android:taskAffinity=".tooleap"
android:theme="#style/Theme.AppCompat.Translucent">
<intent-filter>
<action android:name="com.tooleap.sdk.TOOLEAP_SHOW" />
</intent-filter>
</activity>
<service android:name="com.tooleap.sdk.TooleapAppService" />
<service
android:name="com.tooleap.sdk.TooleapUIService"
android:exported="true"
android:process=":UIService">
<intent-filter>
<action android:name="com.tooleap.sdk.BIND_UI_SERVICE" />
</intent-filter>
</service>
<receiver android:name="com.tooleap.sdk.TooleapReceiver">
<intent-filter>
<action android:name="android.intent.action.PACKAGE_REPLACED" />
<data android:scheme="package" />
</intent-filter>
<intent-filter>
<action android:name="com.tooleap.sdk.TOOLEAP_ACTION" />
</intent-filter>
</receiver>
<meta-data
android:name="com.tooleap.sdk.apiKey"
android:value="Placeholder" />
<activity android:name=".UserBuilding"></activity>
</application>
</manifest>

Related

Android no title bar with action bar

I have really tried everything I found on the internet and cannot find a solution.
I want to remove title bar from all of my activities, and my main activity to look like home activity screen on facebook. So, action bar with swiping, fragments and a search on the top. Iv done action bar with swiping and fragments right, but I cannot remove title bar for my search. Here is the code:
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
FacebookSdk.sdkInitialize(getApplicationContext());
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
setContentView(R.layout.activity_main);
initializeLayout();
}
public Lokal getLokal() {
return lokal;
}
public Context context(){
return getApplicationContext();
}
private void initializeLayout(){
// Initilization
viewPager = (ViewPager) findViewById(R.id.pager);
actionBar = getActionBar();
mAdapter = new TabsPageAdapter(getSupportFragmentManager());
getActionBar().setDisplayShowTitleEnabled(false);
getActionBar().setDisplayShowHomeEnabled(false);
viewPager.setAdapter(mAdapter);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
// Adding Tabs
for (String tab_name : tabs) {
actionBar.addTab(actionBar.newTab().setText(tab_name)
.setTabListener(this));
}
viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
#Override
public void onPageSelected(int position) {
// on changing the page
// make respected tab selected
actionBar.setSelectedNavigationItem(position);
}
#Override
public void onPageScrolled(int arg0, float arg1, int arg2) {
}
#Override
public void onPageScrollStateChanged(int arg0) {
}
});
}
And here is my manifest file:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="v.menadzeri" >
<uses-sdk android:minSdkVersion="11" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:theme="#style/Theme.Sherlock.Light.NoActionBar">
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="#string/facebook_app_id"/>
<supports-screens android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:xlargeScreens="true"
android:anyDensity="true" />
<activity
android:name=".activities.Login"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".activities.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MainActiviy" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".activities.SplashScreen"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.SplashScreen" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".activities.ProfilActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.ProfilActiviy" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".activities.LokalLayoutActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.LokalLayoutAct" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
Thank you for your answer in advance.
http://i.stack.imgur.com/QGmEG.png
Need the Soundboard removed, whole thing and instead of that put search box.
It doesnt allow me to put images

Wierd action bar tabs

I created an action bar style with ANDROID ACTION BAR STYLE GENERATOR i copied the generated theme and integrated it into my app but when i run the app the action bar is blurred http://postimg.org/image/ox2saxhkt/ is a screen shot of how it looks
I've searched the web and stackoverflow but i haven't seen anyone with this kind of issue before i've done a rebuild i've tested it tdifferent emulators and it is still the same i even removed the 4.4W and 4.4L and used the 4.4.2 library to build it but no success
NOTE:I'm running on linux Kubuntu.
This is the code below
package com.pico;
import com.pico.sales.R;
import android.app.ActionBar;
import android.app.ActionBar.Tab;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
public class Set extends FragmentActivity implements
ActionBar.TabListener {
CollectionPagerAdapter mCollectionPagerAdapter;
ViewPager mViewPager;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mCollectionPagerAdapter = new CollectionPagerAdapter(
getSupportFragmentManager());
final ActionBar actionBar = getActionBar();
actionBar.setHomeButtonEnabled(false);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
mViewPager = (ViewPager) findViewById(R.id.pager);
mViewPager.setAdapter(mCollectionPagerAdapter);
mViewPager
.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
#Override
public void onPageSelected(int position) {
actionBar.setSelectedNavigationItem(position);
}
});
for (int i = 0; i < mCollectionPagerAdapter.getCount(); i++) {
actionBar.addTab(actionBar.newTab()
.setText(mCollectionPagerAdapter.getPageTitle(i))
.setTabListener(this));
}
}
#Override
public void onTabReselected(Tab tab, android.app.FragmentTransaction fragmentTransaction) {
// TODO Auto-generated method stub
}
#Override
public void onTabSelected(Tab tab, android.app.FragmentTransaction fragmentTransaction) {
// TODO Auto-generated method stub
mViewPager.setCurrentItem(tab.getPosition());
}
#Override
public void onTabUnselected(Tab tab, android.app.FragmentTransaction fragmentTransaction) {
// TODO Auto-generated method stub
}
public class CollectionPagerAdapter extends FragmentPagerAdapter {
final int NUM_ITEMS = 4; // number of tabs
public CollectionPagerAdapter(FragmentManager fm) {
super(fm);
}
/** This method will be invoked when a page is requested to create */
#Override
public Fragment getItem(int position) {
switch(position) {
case 0:
return new Tab1();
case 1:
return new Tab2();
case 2:
return new Tab3();
case 3:
return new Tab4();
default:
return null;
}
}
#Override
public int getCount() {
return NUM_ITEMS;
}
#Override
public CharSequence getPageTitle(int position) {
String tabLabel = null;
switch (position) {
case 0:
tabLabel = "Dashboard";
break;
case 1:
tabLabel = "Invoices";
break;
case 2:
tabLabel = "Inventory";
break;
case 3:
tabLabel = "Reports";
break;
}
return tabLabel;
}
}
}
and this is the manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.pico.sales"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="19"/>
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/Theme.Pico" >
<activity
android:name="com.pico.MainActivity"
android:label="Please Login" >
<intent-filter>
<action android:name="android.intent.action.START" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.pico.Splash"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.pico.Set"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.SET" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.pico.Register"
android:label="Setup Your Account"
android:icon="#drawable/new_user" >
<intent-filter>
<action android:name="android.intent.action.REGISTER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.pico.Setup"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.SETUP" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.pico.Items"
android:parentActivityName="com.pico.Set" >
<!-- Parent activity meta-data to support API level 7+ -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.pico.Set"
android:label="Items" >
</meta-data>
<intent-filter>
<action android:name="android.intent.action.ITEMS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.pico.No_items"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.NO_ITEMS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.pico.Pricing"
android:parentActivityName="com.pico.Set" >
<!-- Parent activity meta-data to support API level 7+ -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.pico.Set"
android:label="Pricing Schemes" >
</meta-data>
<intent-filter>
<action android:name="android.intent.action.PRICING" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.pico.No_pricing"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.NO_PRICING" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:icon="#drawable/new_user"
android:name="com.pico.Customers"
android:parentActivityName="com.pico.Set" >
<!-- Parent activity meta-data to support API level 7+ -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.pico.Set"
android:label="Customers" >
</meta-data>
<intent-filter>
<action android:name="android.intent.action.CUSTOMERS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:icon="#drawable/new_user"
android:name="com.pico.No_customers" >
<intent-filter>
<action android:name="android.intent.action.NO_CUSTOMERS" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:icon="#drawable/new_user"
android:name="com.pico.Add_customer"
android:parentActivityName="com.pico.Customers" >
<!-- Parent activity meta-data to support API level 7+ -->
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="com.pico.Customers"
android:label="Add_customer" >
</meta-data>
<intent-filter>
<action android:name="android.intent.action.ADD_CUSTOMER" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>

Android Settings Bar below Tabs

I have just started working on a new tabbed App.
For some reason, I can't seem to be able to get rid for a settings action item with its own bar that goes below my tab bar.
Anyone know what this is all about?
public class MainActivity extends Activity
{
#Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Fragment fragment = new Fragment();
ActionBar actionBar = getActionBar();
actionBar.setDisplayShowHomeEnabled(false);
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
actionBar.setDisplayOptions(0, ActionBar.DISPLAY_SHOW_TITLE);
ActionBar.Tab mapTab = actionBar.newTab().setText("TEST1");
ActionBar.Tab infoTab = actionBar.newTab().setText("TEST2");
ActionBar.Tab settingsTab = actionBar.newTab().setText("TEST3");
mapTab.setTabListener(new TabListener(fragment));
infoTab.setTabListener(new TabListener(fragment));
settingsTab.setTabListener(new TabListener(fragment));
actionBar.addTab(mapTab, 0, false);
actionBar.addTab(infoTab, 1, false);
actionBar.addTab(settingsTab, 2, false);
}
Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.nfcproducttracing"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="14"
android:targetSdkVersion="19" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name" >
<activity
android:name="com.example.nfcproducttracing.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Presumably, you are adding that action item in onCreateOptionsMenu() of your activity. If you do not want that action item, remove it.

TitlePageIndicator: Title text not appearing or hidden on top of activity layout.(Viewpager,Xml)

ViewPagerFragment.java
package nsixty.crew.app;
import java.util.List;
import java.util.Vector;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import com.viewpagerindicator.TitlePageIndicator;
import com.viewpagerindicator.TitleProvider;
public class ViewPagerFragment extends FragmentActivity {
private CustomFragmentAdapter mPagerAdapter;
ViewPager pager;
TitlePageIndicator titleIndicator;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.setContentView(R.layout.lcmeter);
this.initialisePaging();
}
private void initialisePaging() {
List<Fragment> fragments = new Vector<Fragment>();
fragments
.add(Fragment.instantiate(this, LoginActivity.class.getName()));
fragments.add(Fragment.instantiate(this, main.class.getName()));
this.mPagerAdapter = new CustomFragmentAdapter(
super.getSupportFragmentManager(), fragments);
pager = (ViewPager) findViewById(R.id.viewpager);
pager.setAdapter(this.mPagerAdapter);
titleIndicator = (TitlePageIndicator) findViewById(R.id.titles);
titleIndicator.setViewPager(pager);
}
public static class CustomFragmentAdapter extends FragmentPagerAdapter
implements TitleProvider {
public static final int POSITION_PAGE_1 = 0;
public static final int POSITION_PAGE_2 = 1;
public static final int POSITION_PAGE_3 = 2;
private List<Fragment> fragments;
private static final String[] TITLES = new String[] { "LOGIN", "HOME" };
public static final int NUM_TITLES = TITLES.length;
#Override
public String getTitle(int position) {
return TITLES[position];
}
public CustomFragmentAdapter(FragmentManager fm,
List<Fragment> fragments) {
super(fm);
this.fragments = fragments;
}
#Override
public int getCount() {
// return this.fragments.size();
return NUM_TITLES;
}
#Override
public Fragment getItem(int position) {
try {
LoginActivity.class.newInstance();
} catch (InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return this.fragments.get(position);
}
}
}
lcmeter.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<com.viewpagerindicator.TitlePageIndicator
android:id="#+android:id/titles"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<android.support.v4.view.ViewPager
android:id="#+android:id/viewpager"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="nsixty.crew.app"
android:versionCode="1"
android:versionName="1.0" >
<support-screens
android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="false" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:icon="#drawable/icon87"
android:label="#string/app_name" >
<activity
android:name="ViewPagerFragment"
android:theme="#android:style/Theme.Black.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".main" >
<intent-filter>
<action android:name="nsixty.crew.app.main" />
<category
android:name="android.intent.category.DEFAULT"
android:screenOrientation="portrait" />
</intent-filter>
</activity>
<activity
android:name=".play"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="nsixty.crew.app.play" />
<category
android:name="android.intent.category.DEFAULT"
android:screenOrientation="landscape" />
</intent-filter>
</activity>
<activity
android:name=".secondView"
android:label="#string/app_name"
android:screenOrientation="landscape" >
<intent-filter>
<action android:name="nsixty.crew.app.SECONDVIEW" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".recorder"
android:configChanges="orientation"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen" >
<intent-filter>
<action android:name="nsixty.crew.app.RECORD" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".send"
android:label="#string/app_name" >
<!-- android:theme="#android:style/Theme.Dialog" -->
<intent-filter>
<action android:name="nsixty.crew.app.SHARE" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".gallery"
android:theme="#android:style/Theme.Dialog" >
<intent-filter>
<action android:name="nsixty.crew.app.gallery" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name=".RegisterActivity"
android:theme="#android:style/Theme.Dialog" >
</activity>
<activity
android:name=".media"
android:theme="#android:style/Theme.Dialog" >
<intent-filter>
<action android:name="nsixty.crew.app.media" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".LoginActivity" >
</activity>
<activity android:name="CustomTitleBar" >
</activity>
</application>
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" >
</uses-permission>
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-feature android:name="android.hardware.camera" />
</manifest>
ScreenShot1
ScreenShot2
Please help me with these tiny problem i just can't figure out where the problem is coming from, i have been working for these for hours. i think the problem will be coming from the Xml layout thanks.
Try Like this:
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.viewpager);
// Create our custom adapter to supply pages to the viewpager.
mPagerAdapter = new Pager_Adapter(this,getSupportFragmentManager());
mViewPager = (ViewPager)findViewById(R.id.pager);
mViewPager.setAdapter(mPagerAdapter);
// Start at a custom position
mViewPager.setCurrentItem(0);
// Find the indicator from the layout
mTabs = (TitleIndicator) findViewById(R.id.swipeytabs);
mTabs.setAdapter(mPagerAdapter);
// Set the indicator as the pageChangeListener
mViewPager.setOnPageChangeListener(mTabs);
}
class Pager_Adapter extends FragmentPagerAdapter implements ViewpagerAdapter{
private final Context mContext;
public Pager_Adapter(Context context, FragmentManager fm) {
super(fm);
this.mContext = context;
}
#Override
public Fragment getItem(int pos) {
return ItemFragment.newInstance(QUES[pos],listArray[pos]);
//return ItemFragment.newInstance(QUES[pos % TITLES.length]);
}
#Override
public int getCount() {
return TITLES.length;
}
public TextView getTab(final int position, TitleIndicator root) {
TextView view = (TextView) LayoutInflater.from(mContext).inflate(
R.layout.swipey_tab_indicator, root, false);
// swipey_tab_indicator is the your titleBar Layout ,
// You can use only textview on that layout for the titlebar
view.setText(TITLES[position]);
view.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
mViewPager.setCurrentItem(position);
}
});
return view;
}
}
For the more Information check this
link
I used this library View pager extensions among them i used swipey tab view indicator instead of Title page indicator and it worked perfectly.
Hmm it looks like that the defaut selected color for this text is Black and your background is so you should change it to another color in the android XML file.

Android: Multiple TabActivities problem

I have already lost 2 days in this problem, please provide any help you can.
I have an Android application which displays 2 Android Activity icons: "Comp 1" and "Comp 2".
Both "Comp 1" and "Comp 2" shows TabActivities with tabs within.
Problem:
Right after deploying my application, I can enter into any of "Comp 1" or "Comp 2" TabActivity, but when I leave the activity and when I try to enter the other TabActivity, the tabs shown are the same from the previous one "Comp 1" or "Comp 2" it always depends on which I start first.
Objective:
For any of the "Comp N", open correctly the tabs assigned on the TabActivities(see code on this post).
Please, allow me to show my code.
I will show AndroidManifest.xml, TabActivity for "Comp 1" and TabActivity for "Comp 2". They're a bit extensive, so I apologize in advance for any extra and unnecessary info they may contain. I just didn't want to take risk to forget to provide any important information on the first post.
AndroidManifest.xml ("Comp 1"=MMComponentTabAssembler, "Comp 2"=TabAssembler)
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0"
android:installLocation="internalOnly"
package="be.multitel.android.mmnd">
<application android:icon="#drawable/icon" android:label="#string/app_name">
<uses-library android:name="com.google.android.maps" />
<activity android:name=".activity.TabAssembler"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activity.NetworkDispatcher1"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.TAB" />
</intent-filter>
</activity>
<activity android:name=".activity.Device"
android:label="#string/app_test_device_name">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.TAB" />
</intent-filter>
</activity>
<activity android:name=".activity.SMS"
android:label="#string/sms_app_name">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.TAB" />
</intent-filter>
</activity>
<activity android:name=".activity.NetworkDispatcherActivity"
android:label="#string/test_network_dispatcher_app_name">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.TAB" />
</intent-filter>
</activity>
<!-- Begin :: Code for standard MMComponentTabAssembler tab view.
Use this code to include new components activities that extend from MMSuperComponent.
-->
<activity android:name=".activity.MMComponentTabAssembler"
android:label="Comp 1"
android:theme="#android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activity.GPS"
android:label="GPS">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.TAB" />
</intent-filter>
</activity>
<activity android:name=".activity.GPSPreferences"
android:label="GPSPrefs">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.TAB" />
</intent-filter>
</activity>
<activity android:name=".activity.StandardSetupActivity"
android:label="Setup">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.TAB" />
</intent-filter>
</activity>
<!-- End :: Code for standard MMComponentTabAssembler tab view. -->
<service android:exported="true" android:name=".service.NetworkDispatcherService" android:process=":remote">
<intent-filter>
<action android:name="NetworkDispatcherService">
</action>
</intent-filter>
</service>
<service android:exported="true" android:name=".service.NetHubService" android:process=":remote"/>
<receiver android:name=".service.utils.NetworkListener">
<intent-filter>
<action android:name=
"android.net.conn.CONNECTIVITY_CHANGE" />
<action android:name=
"android.provider.Telephony.SMS_RECEIVED" />
<action android:name=
"be.multitel.android.mmnd.service.utils.SocketListener.ACK_RECEIVED" />
</intent-filter>
</receiver>
<receiver android:name=".service.utils.MMNetworkDispatcherReceiver" >
<intent-filter>
<action android:name=
"android.net.conn.CONNECTIVITY_CHANGE" />
<action android:name=
"CONNECTIVITY_CHANGE" />
<action android:name=
"android.provider.Telephony.SMS_RECEIVED" />
<action android:name=
"be.multitel.android.mmnd.service.utils.SocketListener.ACK_RECEIVED" />
</intent-filter>
</receiver>
<receiver android:name=".service.utils.MMReceiver" >
<intent-filter>
<action android:name="ACTION_MM_CONNECT" />
<action android:name="ACTION_MM_DISCONNECT" />
<action android:name="ACTION_EVENT_CMD_DISPATCHER_ACCESREQ" />
<action android:name="ACTION_EVENT_CMD_DISPATCHER_ACCESRELEASE" />
<action android:name="ACTION_EVENT_CMD_DISPATCHER_ACCESINFOREQ" />
<action android:name="ACTION_EVENT_CMD_DISPATCHER_BWINFOREQ" />
<action android:name="ACTION_EVENT_CMD_DISPATCHER_LATENCYINFOREQ" />
<category android:name="COMPONENT_CATEGORY_GPS"/>
</intent-filter>
</receiver>
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.SEND_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
"Comp 1" TabActivity = MMComponentTabAssembler
public class MMComponentTabAssembler extends TabActivity {
public static final String TAG = MMComponentTabAssembler.class.getName();
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.standard_tabbed_pane);
Resources res = getResources(); // Resource object to get Drawables
TabHost tabHost = getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Resusable TabSpec for each tab
Intent intent; // Reusable Intent for each tab
//Multimodal component tab
intent = new Intent().setClass(this, GPS.class);
intent.addCategory(Const.COMPONENT_CATEGORY_GPS); //Used to produce Intents to the MMComponent
intent.addCategory(Const.ACTIVITY_CATEGORY_GPS); //Used to consume Intents on the BroadcastReceiver associated to the Activity
// Initialize a TabSpec for each tab and add it to the TabHost
spec = tabHost.newTabSpec("gps").setIndicator("GPS",
res.getDrawable(R.drawable.ic_tab_gps))
.setContent(intent);
tabHost.addTab(spec);
//preferences tab
intent = new Intent().setClass(this, GPSPreferences.class);
// Initialize a TabSpec for each tab and add it to the TabHost
spec = tabHost.newTabSpec("gpsPrefs").setIndicator("GPSPrefs",
res.getDrawable(R.drawable.ic_tab_gpsprefs))
.setContent(intent);
tabHost.addTab(spec);
//standard setup tab
intent = new Intent().setClass(this, StandardSetupActivity.class);
intent.addCategory(Const.COMPONENT_CATEGORY_GPS); //Used to produce Intents to the MMComponent
intent.addCategory(Const.ACTIVITY_CATEGORY_GPS); //Used to consume Intents on the BroadcastReceiver associated to the Activity
spec = tabHost.newTabSpec("standard_setup_tab").setIndicator("Setup",
res.getDrawable(R.drawable.ic_tab_standard_setup))
.setContent(intent);
tabHost.addTab(spec);
tabHost.setCurrentTab(0);
}
#Override
protected void onResume() {
super.onResume();
Log.d(TAG,"Activity group lifecicle :: onResume().");
}
#Override
protected void onPause() {
super.onPause();
Log.d(TAG,"Activity group lifecicle :: onPause().");
}
#Override
protected void onStop() {
super.onStop();
Log.d(TAG,"Activity group lifecicle :: onStop().");
}
#Override
protected void onDestroy() {
super.onDestroy();
Log.d(TAG,"Activity group lifecicle :: onDestroy().");
}
}
"Comp 2" TabActivity = TabAssembler
public class TabAssembler extends TabActivity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_tab);
Resources res = getResources(); // Resource object to get Drawables
TabHost tabHost = getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Resusable TabSpec for each tab
Intent intent; // Reusable Intent for each tab
intent = new Intent().setClass(this, NetworkDispatcher1.class);
// Initialize a TabSpec for each tab and add it to the TabHost
spec = tabHost.newTabSpec("netword_dispatcher").setIndicator("NDispatcher",
res.getDrawable(R.drawable.ic_tab_mmnd))
.setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, Device.class);
spec = tabHost.newTabSpec("test_device").setIndicator("Test Device",
res.getDrawable(R.drawable.ic_tab_test_device))
.setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, SMS.class);
spec = tabHost.newTabSpec("test_sms").setIndicator("SMS",
res.getDrawable(R.drawable.ic_tab_sms))
.setContent(intent);
tabHost.addTab(spec);
intent = new Intent().setClass(this, NetworkDispatcherActivity.class);
spec = tabHost.newTabSpec("test_network_dispatcher").setIndicator("Test ND",
res.getDrawable(R.drawable.ic_tab_test_network_dispatcher))
.setContent(intent);
tabHost.addTab(spec);
tabHost.setCurrentTab(3);
}
}
Only one of activity set
And others should set something else, such as
Then only one activity assigned the icon.

Categories

Resources