blob: a7deaf6eeccc6277d7e43a5d225541c90361746c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
package ${packageName};
import android.os.Bundle;
import android.content.Intent;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.NavUtils;
import android.view.MenuItem;
public class ${DetailName}Activity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_${detail_name});
getActionBar().setDisplayHomeAsUpEnabled(true);
if (savedInstanceState == null) {
Bundle arguments = new Bundle();
arguments.putString(${DetailName}Fragment.ARG_ITEM_ID,
getIntent().getStringExtra(${DetailName}Fragment.ARG_ITEM_ID));
${DetailName}Fragment fragment = new ${DetailName}Fragment();
fragment.setArguments(arguments);
getSupportFragmentManager().beginTransaction()
.add(R.id.${detail_name}_container, fragment)
.commit();
}
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == android.R.id.home) {
NavUtils.navigateUpTo(this, new Intent(this, ${CollectionName}Activity.class));
return true;
}
return super.onOptionsItemSelected(item);
}
}
|