This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<fragment android:name="com.myproject.activities.SomeFragment" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:id="@+id/some_fragment"/> | |
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@InjectFragment(id.some_fragment) | |
private SomeFragment someFragment; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SomeActivity extends FragmentActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
SomeFragment someFragment = (SomeFragment)findViewById(id.some_fragment); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SomeFragment someFragment = new SomeFragment(); | |
FragmentManager supportFragmentManager = context.getFragmentManager(); | |
FragmentTransaction fragmentTransaction = supportFragmentManager.beginTransaction(); | |
fragmentTransaction.replace(R.id.some_fragment_container, someFragment, "SOME_FRAGMENT_TAG"); | |
fragmentTransaction.addToBackStack("SOME_FRAGMENT_TAG"); | |
fragmentTransaction.commit(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<LinearLayout android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:id="@+id/some_fragment_container"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void configureActionBarTabs() { | |
final ActionBar actionBar = getActionBar(); | |
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); | |
actionBar.addTab(actionBar.newTab() | |
.setIcon(R.drawable.puppies) | |
.setTabListener(new TabListener<PuppyFragment>(this, "PUPPIES", PuppyFragment.class))); | |
actionBar.addTab(actionBar.newTab() | |
.setIcon(R.drawable.rainbows) | |
.setTabListener(new TabListener<RainbowsFragment>(this, "RAINBOWS", RainbowsFragment.class))); | |
actionBar.addTab(actionBar.newTab() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SendMessageTask extends SafeAsyncTask<Boolean> { | |
private final HttpClient httpClient; | |
private final sendMessageCallbacks sendMessageCallbacks; | |
@Inject | |
public SendMessageTask(org.apache.http.client.HttpClient httpClient, | |
@Assisted SendMessageCallbacks sendMessageCallbacks { | |
this.httpClient = httpClient; | |
this.sendMessageCallbacks = sendMessageCallbacks; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MessagingActivity implements SendMessageCallbacks extends Activity { | |
//activity setup methods | |
public void sendMessage(){ | |
new SendMessageTask(httpClient, this).execute(); | |
} | |
@Override | |
protected void onMessageSendingFailed(String reason) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface SendMessageCallbacks { | |
void onMessageSendingFailed(String callbackMessage); | |
void onMessageSendingSuccess(String callbackMessage); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SendMessageTask extends SafeAsyncTask<Boolean> { | |
private final EventBus eventBus; | |
@Inject | |
public EndSessionTask(EventBus eventBus) { | |
this.eventBus = eventBus; | |
} | |
@Override | |
public Boolean call() throws Exception { |
OlderNewer