I'm trying to edit the ViewPager Source code. However, if I add the file to my project it says on the line mAdapter.registerDataSetObserver(mObserver); that the method registerDataSetObserver is invisible. mAdapter here is a PagerAdapter. If you look at the developer page, PagerAdapter really has no registerDataSetObserver method. But I also checked the PagerAdapter source code in the SDK. It turns out that there is a registerDataSetObserver method in the source.
I'm a bit confused here. Can someone please enlighten me?
viewpager is available in the compatability package (aka support library) .
why not use the one inside there ?
this way , you can also support older android versions (down to API 4 ).
example : the FragmentTabsPager.java file has it being used , inside the path "...\extras\android\support\samples\Support4Demos\src\com\example\android\supportv4\app"
Related
I have 2 NDK libraries (.so files ) in my android project and there is a method in the first library that is also called (used) in the first library and I want the second library to override the called (used) method found in the first library. Is it possible to just have the same name and parameters and load the second library after the first like
System.load(first);
System.load(second);
Will this override the first method or do I have to do something else? If so, please specify.
Thanks in advance for your time.
Once a symbol has been resolved (by System.load) it will not be changed. The definition loaded from first will be used.
My Current Situation
I am working on an existing app that is using CustomFragment derived from android.app.Fragment. I want to add a new functionnality with a ViewPager which will show my CustomFragments. For that I need to use a FragmentPagerAdapter.
Oooh snap !
Here I am, importing android.support.v4.view.ViewPager and android.support.v4.app.FragmentPagerAdapter to achieve my goal. And now the funny part begins :
When I try to use my FragmentPagerAdapter with my CustomFragment, I get the classic error Type mismatch: cannot convert from android.app.Fragment to android.support.v4.app.Fragment
Knowing that I can't change the whole app fragments to android.support.v4.app.Fragment, I searched and found that the android.support.v13.app.FragmentPagerAdapter was made to use native fragments. Great !
Not great. When I try to import the v13 FragmentPagerAdapter, I get the error The import android.support.v13 cannot be resolved. For the record, I checked in SDKManager what support version is installed : v19.0.1
I searched again, because of course I can't be the first one with that problem. I found that you can't use support.v4 and support.v13 in the same app because v4 is included in v13. And for everyone that encoutered my problem, the solution was to use only android.support.v4.app.FragmentPagerAdapter and android.support.v4.app.Fragment
What to do now ?
Since I have to use android.app.Fragment and I can't use only support.v4, I don't know where to go search next. Any help would be highly appreciated !
Well that is simply not possible. I went to use support.v4.app.Fragment.
I'm newbie to android and must use image as Pinterest. i am using staggeredgridview using etsy demo but as soon as project is imported to eclipse it shows many errors is there any step to implement staggered demo?
Try Below code..
https://github.com/bulletnoid/StaggeredGridView
Hope Help you.
if the Existing Code is Correct, and It shows An error when you import the Project You need to Take Care of two things..
If you want to seed Demo... if a Existing Projects... it Depends on the Way You Import.
1.Some Existing Source codes can Be imported directly..
Like :
File>
Import >
Android >
Existing Android Code Into Work Space> Browse file..
But For Some Source Code In the Above Way you will Get Errors Definitely.. Due to incomplete Import..(I mean Eclipse may not import Complete Functionality)
If you Get Errors in First Way choose Second Way..
2.Second Way to Import
File>
other>
Android >
Android project from Existing Code> Browse file..
I hope this is Problem..
Or Else Please Mention Your Log Cat Code so that the Error will be Fixed..
Update
One More thing If you are Using Android Build Tools.. It may a problem for some old codes..
So you need to Use Separate Eclipse J2EE kepler IDE and Android SDK ...
See here for Reference...
One Place Your Log Cat.. I will Solve Problem...
You can go with this link:
It explains few steps as follows:
Just Use a Grid List
Try a Modified GridView with Staggered Grid View
Try a Modified List with Pinterest Like Adapter View
Or Try Two Synced List Views with Pinterest List View
You might not have change your Package Name or i would be good if you have posted error.
I am porting an Xamarin-based Android app to be PCL'ified and MvvmCross'ified so we can target multiple mobile device platforms.
Since this is a line-of-business app where we can dictate the minimum Android OS version, we wish to avoid using the various v4 / v7 etc "Support libraries". We prefer to use all native components that are already part of the OS. So this basically means we only wish to target Jellybean and probably Android v4.2 upwards.
Unfortunately whilst there are lots of examples out there of using MvvmCross with ActionBarSherlock and the SupportActionBar (in a support library), there appears to be no examples of how to wire up MvvmCross with the native ActionBar using native Fragments as tabs.
I'm not expecting someone to post up swathes of code but would really appreciate if someone could give me a few pointers on the best approach to take to achieve this.
I will certainly blog about it once I have a working solution to benefit the whole MvvmCross/Xamarin community.
Thanks.
Probably the most important thing is to use MvvmCross - Hot Tuna Droid Full Fragment Support NUGet library. Then create activity that inherits from MvxActivity and fragment from MvxFragment.
ViewModel for tab fragment set in activity when create this class for TabEventArgs.FragmentTransaction.Add method used in ActionBar.Tab.TabSelected event handler like this:
var tab1 = new TabFragment1 {DataContext = ViewModel};
In TabFragment1 class you can use standard fluent binding method on bindingSet creted by
var bindingSet = this.CreateBindingSet<TabFragment1, MyViewModel>();
I don't know if it is a right way, but work.
I'm trying to use the SlideMenu library with ActionBarSherlock.
https://github.com/jfeinstein10/SlidingMenu
http://actionbarsherlock.com/
I had not issue installing actionbarsherlock and run the examples provided.
But, can't do the same with the example og the SlideMenu library :(
I can set up the library fine (or so i think) without errors (under eclipse with jre6).
For the slidemenu example, i created the project, and added com_actionbarssherlock.jar as a "referenced libraies".
But i have lots of :
- R cannot resolve erros ;
- can't overrides some methods erros;
- methods from actionbarsherlock are not recognized ; ex : "The method getSupportActionBar() is undefined for the type BaseActivity"
- can't load style from actionbarsherlock erros.
It is as if the project doesn't see the classes from actionbarsherlock.
Thanks for any help.
For the error
"The method getSupportActionBar() is undefined for the type BaseActivity"
Inside the SlidingMenu library, edit the class SlidingFragmentActivity to extend SherlockFragmentActivity (like below). Then clean and rebuild, this method should now be found.
public class SlidingFragmentActivity extends SherlockFragmentActivity implements SlidingActivityBase {
Source
Look add Problems tab to see there are any error ?
Right click your project and check your all Libraries.
If everthing ok, try to clean your project.
There are lots of issues on github with that bug. Mrcb123's solution works, but I suppose it will be good to separate example ABS dependency from library.