android-fragmentactivity

Android ViewPager with bottom dots

梦想的初衷 提交于 2019-11-26 05:54:55
问题 I want to add 3 bottom dots to my ViewPager, like this. I use FragmentActivity and support library ViewPager. 回答1: No need for that much code. You can do all this stuff without coding so much by using only viewpager with tablayout . Your main Layout: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content"> <android.support.v4.view.ViewPager android:id

refresh fragment UI from fragmentActivity

蓝咒 提交于 2019-11-26 04:54:51
问题 I want to change a ImageView in fragment(that create in code), from FragmentActivity. (there is no fragment and tag in XML). MainActivity that extends from FragmentActivity and implements from GooglePlayServicesClient.ConnectionCallbacks: ... FragmentAdapter mAdapter; ViewPager mPager; ... public void onCreate(Bundle savedInstanceState){ ... FragmentManager fm = getSupportFragmentManager(); mAdapter = new FragmentAdapter(fm); mPager.setAdapter(mAdapter); ...} @Override public void onConnected

TabHost with Fragments and FragmentActivity

℡╲_俬逩灬. 提交于 2019-11-26 04:39:55
问题 I\'m working on an Android App and I want to use 3 tabs for navigation using Fragments for each tab, but I don\'t know how to create the structure for doing it. I want to add each fragment separately because each one is different, but I don\'t know where to add them in FragmentActivity. I have these files. tabs_layout.xml <LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\" android:orientation=\"vertical\" android:layout_height=\"match_parent\" android:layout_width=\

Setting Custom ActionBar Title from Fragment

馋奶兔 提交于 2019-11-26 04:16:54
问题 In my Main FragmentActivity , I setup my custom ActionBar title like this: LayoutInflater inflator = (LayoutInflater) this .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflator.inflate(R.layout.custom_titlebar, null); TextView tv = (TextView) v.findViewById(R.id.title); Typeface tf = Typeface.createFromAsset(this.getAssets(), \"fonts/capsuula.ttf\"); tv.setTypeface(tf); tv.setText(this.getTitle()); actionBar.setCustomView(v); This works perfect. However, once I open other

startActivityForResult() from a Fragment and finishing child Activity, doesn&#39;t call onActivityResult() in Fragment

折月煮酒 提交于 2019-11-26 03:48:45
问题 FirstActivity.Java has a FragmentA.Java which calls startActivityForResult() . SecondActivity.Java call finish() but onActivityResult never get called which is written in FragmentA.Java . FragmentA.Java code: @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); // some code Intent i = new Intent(getActivity(), SecondActivity.class); i.putExtra(\"helloString\", helloString); getActivity().startActivityForResult(i, 1); } @Override

Difference between Activity and FragmentActivity

天涯浪子 提交于 2019-11-26 03:47:10
问题 I was working on fragments and came across two things Activity and FragmentActivity which are used several times. I want to know that is there any difference between these two, because when I changed Activity with FragmentActivity , it had no effect on the app. 回答1: A FragmentActivity is a subclass of Activity that was built for the Android Support Package. The FragmentActivity class adds a couple new methods to ensure compatibility with older versions of Android, but other than that, there