Android SDK Slice Support

Ok, I'm just starting to do Android programming now, and I follow the android "TabActivity" instructions: http://developer.android.com/reference/android/app/TabActivity.html , Everything that works, but cannot find some from the support classes, see below the code that generates errors.

mTabManager.addTab(mTabHost.newTabSpec("simple").setIndicator("Simple"), FragmentStackSupport.CountingFragment.class, null); mTabManager.addTab(mTabHost.newTabSpec("contacts").setIndicator("Contacts"), LoaderCursorSupport.CursorLoaderListFragment.class, null); mTabManager.addTab(mTabHost.newTabSpec("custom").setIndicator("Custom"), LoaderCustomSupport.AppListFragment.class, null); mTabManager.addTab(mTabHost.newTabSpec("throttle").setIndicator("Throttle"), LoaderThrottleSupport.ThrottledLoaderListFragment.class,null); 

For FragmentStackSupport / LoaderCursorSupport / LoaderCustomSupport / LoaderThrottleSupport, he says that type cannot be allowed for all of them. I added the latest support library to a folder in the root directory named "libs", and also copied it to the directory "C: / Eclipse / v4 /". My import files:

  import java.util.HashMap; import android.R; import android.content.Context; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentTransaction; import android.support.v4.app.FragmentPagerAdapter; import android.view.View; import android.widget.TabHost; import cowdawg.hello_tab.namespace.R.layout; import cowdawg.hello_tab.namespace.R.id; 

Can someone please offer me some tips on how to solve this, thanks :).

+4
source share
5 answers

Probably because the following classes are not part of the standard Android API (or support library), but exist only in the sample demo example for demo purposes:

 FragmentStackSupport.CountingFragment LoaderCursorSupport.CursorLoaderListFragment LoaderCustomSupport.AppListFragment LoaderThrottleSupport.ThrottledLoaderListFragment 

You will need to add these classes to your own project in order to be able to use them. Here you can find the source files in the "Files" section.

+10
source

In the Eclipse IDE: select your project, and then right-click on the project → Android Tools → Add Support Library.

The required support library will be added to your project building path. You will find this ATM library in the "Java Build Language" → "Libraries" → "Android Dependencies" section.

Enjoy the study!

+6
source

Have you added the library to your build path? Right click on the jar in eclipse -> Build Path -> Add to Build Path.

enter image description here

+2
source

Try adding by right-clicking on the project and opening the properties window

enter image description here

+1
source

Instead of these missing classes, you can create your own by subclassing the Fragment class (or its subclasses such as DialogFragment , ListFragment , etc.). Additional information is provided by Android here .

0
source

Source: https://habr.com/ru/post/1391057/


All Articles