Now you have access to the entire file system.
You can read more here
setText() and/or setIcon().
public class Fragment_A extends Fragment {
protected static final String TAG = "FRAGMENTS_A";
private CallbackInterface listener;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_a_layout, container, false);
return view; //returns view
}
// ********** declare INTERFACE ***************** //
public interface CallbackInterface {
public void onSomethingSelected(int position);
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
// This makes sure that the container activity has implemented the callback interface. If not, it throws an exception
try {
listener = (CallbackInterface) activity;
} catch (ClassCastException e) {
throw new ClassCastException(activity.toString()
+ " must implement CallbackInterface");
}
}
}
public class MainActivity extends FragmentActivity implements CallbackInterface {
private static final String TAG = "passNumberTAG";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Button button = (Button) findViewById(R.id.button_id);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Fragment_A Frag_A = new Fragment_A();
FragmentManager fm1 = getSupportFragmentManager();
FragmentTransaction transaction = fm1.beginTransaction();
transaction.add(R.id.fragment_container, Frag_A);
transaction.commit();
}
});
}
@Override
public void onSomethingSelected(int position) {
Log.d(TAG, "Give me the result " + position );
position = position +1;
Log.d(TAG, "Give me the result " + position );
}
}
FrameLayoutthat acts as the fragment container. /res/menu. In those items on the XML file I have to add the android:showAsAction keyword, so now the items will appear as Action Items in my ActionBar and not Options Menu.ifRoom, if you want the icon to be part of your action bar and you should use never if you want the item to always be part of the overflow menu. )
mMap.addMarker(new MarkerOptions().position(point));
@Override
public void onMapClick(LatLng point) {
mMap.animateCamera(CameraUpdateFactory.newLatLng(point));
}