I'm trying to use activity groups - since I use tabs, and want to have the tabs when loading and activity after the list item was clicked,. but I'm getting nullpointerexception in the following line:
View view1 = S1_Group.group.getLocalActivityManager()
.startActivity("S1", intent)
.getDecorView();
Code is .. .
lv.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Intent intent = new Intent(getApplicationContext(), S1.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Log.d("test","Before view");
try{
View view1 = S1_Group.group.getLocalActivityManager()
.startActivity("S1", intent)
.getDecorView();
Settings_Group.group.setContentView(view1);
}
catch (Exception e){
Log.e("test","view failded:"+e);
}
....
update: this how my group activity is: I couldn't find what was the issue.,
public class S1_Group extends ActivityGroup {
public static S1_Group group;
private ArrayList<View> history;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
this.history = new ArrayList<View>();
group = this;
View view = getLocalActivityManager().startActivity("F1",
new Intent(this, F1.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)).getDecorView();
setContentView(view);
}
}
not sure how you implemented the ActivityGroup, but the group needs to be a static variable.
I found this tutorial on google and it describes how to implement an ActivityGroup. http://blog.henriklarsentoft.com/2010/07/android-tabactivity-nested-activities/
Hope this helps, tobias