Sms Gratis Indosat

Phone Numbers
0 -
Example : 83832867987 Without 0

Type your Messages

Question: + =

Free 2d wallpapers and 2d backgrounds

Free 2d wallpapers and 2d backgrounds for your computer desktop. Find 2d pictures and 2d photos on Desktop Nexus.















3d hd wallpaper, 3d wallpaper hd

3d hd wallpaper, 3d wallpaper hd, 3d wallpaper free, free 3d wallpaper, free 3d backgrounds, 3d hd wallpapers, 3d hd pictures, free wallpaper, 3d desktop wallpaper











Free Dice wallpapers and Dice backgrounds

Free Dice wallpapers and Dice backgrounds for your computer desktop. Find Dice pictures and Dice photos on Desktop Nexus,3d dice wallpapers, free 3d wallpaper, 3d wallpapers, dice wallpapers, 3d wallpaper free, wallpaper for backgrounds, computer wallpaper free, 3d dice images, free 3d backgrounds, 3d backgrounds free











3d chess wallpapers, 3d welpaper


3d chess wallpapers, 3d welpaper, free wallpaper for desktop, 3d desktop wallpaper, wallpaper downloads, free wallpaper, chess wallpapers















Allow navigate BACK through FragmentTransaction, by calling addToBackStack()

If you try last exercise "Handle onListItemClick() of ListFragment, to pass data between fragment" on phone FragmentTransaction, when you BACK in MyDetailFragment, it will exit the application, not back to MyListFragment as common expected. To allow the user to navigate backward through the fragment transactions, you must call addToBackStack() before you commit the FragmentTransaction.


package com.example.androiddualmode;

import android.os.Bundle;
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.app.ListFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class MainActivity extends Activity {

// if run on phone, isSinglePane = true
// if run on tablet, isSinglePane = false
static boolean isSinglePane;

static String[] month ={
"January", "February", "March", "April",
"May", "June", "July", "August",
"September", "October", "November", "December"};

public static class MyListFragment extends ListFragment {

@Override
public void onActivityCreated(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onActivityCreated(savedInstanceState);

ListAdapter myArrayAdapter =
new ArrayAdapter<String>(
getActivity(), android.R.layout.simple_list_item_1, month);
setListAdapter(myArrayAdapter);

}

@Override
public void onListItemClick(ListView l, View v, int position, long id) {

String clickedDetail = (String)l.getItemAtPosition(position);

if(isSinglePane == true){
/*
* The second fragment not yet loaded.
* Load MyDetailFragment by FragmentTransaction, and pass
* data from current fragment to second fragment via bundle.
*/
MyDetailFragment myDetailFragment = new MyDetailFragment();
Bundle bundle = new Bundle();
bundle.putString("KEY_DETAIL", clickedDetail);
myDetailFragment.setArguments(bundle);
FragmentTransaction fragmentTransaction =
getActivity().getFragmentManager().beginTransaction();
fragmentTransaction.replace(R.id.phone_container, myDetailFragment);

/*
* Add this transaction to the back stack.
* This means that the transaction will be remembered after it is
* committed, and will reverse its operation when later popped off
* the stack.
*/
fragmentTransaction.addToBackStack(null);

fragmentTransaction.commit();

}else{
/*
* Activity have two fragments. Pass data between fragments
* via reference to fragment
*/

//get reference to MyDetailFragment
MyDetailFragment myDetailFragment =
(MyDetailFragment)getFragmentManager().findFragmentById(R.id.detail_fragment);
myDetailFragment.updateDetail(clickedDetail);

}
}

}

public static class MyDetailFragment extends Fragment {

TextView textDetail;

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// TODO Auto-generated method stub
View view = inflater.inflate(R.layout.layout_detailfragment, null);
textDetail = (TextView)view.findViewById(R.id.text_detail);

Bundle bundle = getArguments();
if(bundle != null){
String detail = bundle.getString("KEY_DETAIL", "no argument pass");
textDetail.setText(detail);
}

return view;
}

public void updateDetail(String detail) {
textDetail.setText(detail);
}

}

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

View v = findViewById(R.id.phone_container);
if(v == null){
//it's run on tablet
isSinglePane = false;
/*
* MyListFragment and MyDetailFragment have been loaded in XML,
* no need load.
*/

}else{
//it's run on phone
//Load MyListFragment programmatically
isSinglePane = true;

if(savedInstanceState == null){
//if's the first time created
MyListFragment myListFragment = new MyListFragment();
FragmentTransaction fragmentTransaction = getFragmentManager().beginTransaction();
fragmentTransaction.add(R.id.phone_container, myListFragment);
fragmentTransaction.commit();
}
}
}

}


Next:
- Display UP icon on action bar and implement BACK navigation in Fragment Transaction


Trusting quotes, broken trust quotes, trust quote

Trusting quotes, broken trust quotes, trust quote, heartbroken quotes, short love quotes, mother teresa quotes, best friend quotes, true love quotes









 
Copyright © 2015. About - Web Version - Mobile Version Sitemap - Contact - Privacy