android-fragmentactivity

how to set toolbar on FragmentActivity?

前提是你 提交于 2019-12-21 07:14:03
问题 I want to set toolbar on my activity which extends FragmentActivity . I know that for use setSuppoertActionBar(toolbar) method we extends AppCompatActivity instead of FragmentActivity but I override the onMenuItemSelected(int featureId, MenuItem item) method which is final in AppCompatActivity and final method cannot override. so I'm restricted to extends FragmentActivity . Here is my code: public class MainActivity extends FragmentActivity { @Override protected void onCreate(Bundle

how to open WifiDisplay Setting from another app?

泄露秘密 提交于 2019-12-21 06:48:33
问题 I want to open Android4.2 setting WifiDisplaySettingsActivity from my app. I tried Intent i; PackageManager manager = getActivity().getPackageManager(); try { i = manager.getLaunchIntentForPackage("com.android.settings.wfd"); if (i == null) throw new PackageManager.NameNotFoundException(); i.addCategory(Intent.ACTION_MAIN); startActivity(i); } catch (PackageManager.NameNotFoundException e) { } and final Intent intent = new Intent(Intent.ACTION_MAIN, null); intent.addCategory(Intent.CATEGORY

Translating this from AppCompatActivity to Fragment and having Intent errors, etc

穿精又带淫゛_ 提交于 2019-12-20 07:42:38
问题 I have been trying for a month doing a lot of research to translate this to Fragment since I need it for my navigation Menu. Basically I'm creating an app. I'm using my MainActvity to run the navigation menu using Fragment. Then I would have to use the classes and run it as Fragment, but at one point I had to use AppCompatActivity, so I translated it to Fragment, but came across a problem with Intent, and other variables. I need help. I'm just learning how to code. The errors I'm getting are:

How to implement show and hide fragment inside fragment in android

痞子三分冷 提交于 2019-12-19 16:47:34
问题 How to implement show and hide fragment inside fragment in Android? I have added two fragment inside activity. One fragment containing menu and one fragment contain sub menu. I have lot of button in menu fragment like home, idea, etc. If i click idea button. I have to show sub menu. If I again click idea button, I have to hide the sub menu. Can anybody provide example, or how to access one view fragment in another fragment? this is my layout main ?xml version="1.0" encoding="utf-8"?>

Saving MapFragment (Maps v2) State in Android

夙愿已清 提交于 2019-12-19 12:37:08
问题 I'm working with the new GoogleMaps API (v2) and have some problems with the fragment. I have two fragments in my app (Map, List) and the user can switch between them. Works fine so far with this code: if (itemPosition == 0) { getSupportFragmentManager().beginTransaction() .replace(R.id.fragmentpos, myMapFragment).commit(); } else if (itemPosition == 1) { getSupportFragmentManager().beginTransaction() .replace(R.id.fragmentpos, myListFragment).commit(); }...... When I work with the map,

What to determine a Fragment restore upon Activity re-create?

社会主义新天地 提交于 2019-12-19 11:59:17
问题 For View s having IDs, they will be auto-saved when calling super.onSaveInstanceState(outState); . For Fragment s added to an Activity , what are the cases that it will be re-created when its Activity is re-created (e.g. screen rotation), and what are the cases it will not? What to determine? What is the rule? So far, i have tried the following cases. But trial-n-error does not mean any rules or solutions. Cases when Fragment s are re-stored: Normal case: FragmentTransaction.add() to the

Real approach for Avoiding Re-creation of Fragment after Screen Rotate (Official Fragment Developer Guide as example)

点点圈 提交于 2019-12-19 04:55:35
问题 i'm finding a Real approach for Avoiding Re-creation of Fragment after Screen Rotate if (container == null) { return null; } is not really avoiding the Fragment to be re-created at all. (illustrated below) Where is the Official Fragment Developer Guide? The official guide we are concerning is at http://developer.android.com/guide/components/fragments.html. The partial example code is at the bottom of the guide. As far as i know, the full sample code is available in the "Samples for SDK" under

pull to refresh and loadmore listview like facebook [closed]

北城以北 提交于 2019-12-18 17:14:42
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . here i am using sliding drawer. in that on click home icon it shows 3 tabs 1) which concept should i apply for tab ? 2) I want to apply pulltoreferesh and loadmore in listview like facebook ? in that you have also seen that when scrolling up progressbar gets hide and request get

Transfer data from Fragment Activity to Fragment

眉间皱痕 提交于 2019-12-18 09:04:45
问题 I'm working with a bluetooth service in my application which ables me to get received message from another device. In my FragmentActivity, i'm using a handler to get this message: FragmentActivity: public final Handler mHandler = new Handler() { @Override public void handleMessage(Message msg) { switch (msg.what) { //my code case MESSAGE_READ: byte[] readBuf = (byte[]) msg.obj; byte[] alpha = null; alpha=readBuf; if(alpha!=null){ //my code.. } } } From this Handler I would like to get a data

How update ListView in ListFragment from FragmentActivity?

a 夏天 提交于 2019-12-18 04:42:37
问题 I'm using a ListFragment within an FragmentActivity together with a SimpleCursorAdapter and a modified CursorLoader. The modified CursorLoader simply issues rawQueries - no other changes. At some point in the FragmentActivity I need to refetch the data/cursor that feeds the ListView in the ListFragment. How can I do that? Many thanks in advance. Here's the FragmentActivity calling a method in the ListFragment: public class ActivityList extends FragmentActivity { @Override protected void