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
@Override | |
public void onClick(View v) { | |
HogeDialogFragment fragment = new HogeDialogFragment(); | |
// 必要なパラメータがあればsetArgument | |
// requestCodeが37になる | |
fragment.setTargetFragment(null,37); | |
fragment.show(getFragmentManager(), "dialog"); |
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
@Override | |
protected void onActivityResult(int requestCode, int resultCode, Intent data) { | |
// 指定したrequestCodeで戻ってくる | |
if (requestCode == 37) | |
Log.d("HogeDialogFragmentResult", Integer.toString(requestCode)); | |
} |
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
java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState |
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 RefreshFragment extends Fragment implements | |
SwipeRefreshLayout.OnRefreshListener { | |
private SwipeRefreshLayout mSwipeRefreshLayout; | |
@Override | |
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { | |
View view = inflater.inflate(R.layout.refreshlayout, null); | |
mSwipeRefreshLayout = (SwipeRefreshLayout) view.findViewById(R.id.swipelayout); |
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
<menu xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
tools:context=".MyActivity"> | |
<item | |
android:id="@+id/action_share_always" | |
android:actionProviderClass="android.widget.ShareActionProvider" | |
android:showAsAction="always" | |
android:title="@string/action_share" /> | |
</menu> |
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 PopupWindow mPopupWindow; | |
@Override | |
public void onClick(View v) { | |
mPopupWindow = new PopupWindow(MyActivity.this); | |
// レイアウト設定 | |
View popupView = getLayoutInflater().inflate(R.layout.popup_layout, null); |
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
BroadcastReceiver receiver = new MyBroadcastReceiver(); | |
IntentFilter intentFilter = new IntentFilter(); | |
intentFilter.addAction(MY_ACTION); | |
// 優先度を高めに設定 | |
intentFilter.setPriority(100); | |
registerReceiver(receiver, intentFilter); |
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
<uses-permission android:name="android.permission.WAKE_LOCK" /> | |
<receiver android:name=".MyBroadcastReceiver"> | |
... | |
</receiver> | |
<service android:name=".MyService" /> |
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 SlidingPanelFragment extends Fragment { | |
SlidingPaneLayout mSlidingPaneLayout; | |
public SlidingPanelFragment() { | |
} | |
@Override | |
public View onCreateView(LayoutInflater inflater, ViewGroup 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
AtomicFile atomicFile = new AtomicFile(getFileStreamPath(FILENAME)); | |
FileOutputStream fos = null; | |
try { | |
// 書き込み開始 | |
fos = atomicFile.startWrite(); | |
fos.write(...); | |
// 書き込み成功 | |
atomicFile.finishWrite(fos); |
OlderNewer