This is my ExampleFragment.java
package com.test.methods;
import android.support.v4.app.Fragment;
import android.support.v4.app.ListFragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import com.crumbin.main.R;
public class ExampleFragment extends ListFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup
container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
setListAdapter(new ArrayAdapter<String>(getActivity(),
R.layout.example_fragment,
Shakespeare.TITLES));
return inflater.inflate(R.layout.example_fragment, container,
false);
}
}
This is my Acitivity:
package com.test.methods;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
public class DemoUserActivity extends FragmentActivity{
protected void OnCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
if (savedInstanceState == null)
{
ExampleFragment details = new ExampleFragment();
details.setArguments(getIntent().getExtras());
getSupportFragmentManager().beginTransaction().add(
android.R.id.content,details).commit();
}
}
}
This is my Shakesphere class:
package com.test.methods;
public class Shakespeare {
public static final String[] TITLES = null;
String [] TILES = {"hello","hi"};
}
This is my xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/
android"
android:id="@+id/example_fragment"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent">
<fragment class="com.test.methods.ExampleFragment"
android:id="@+id/list_example"
android:layout_weight="1"
android:layout_width="0px"
android:layout_height="match_parent" />
<FrameLayout android:id="@+id/details" android:layout_weight="1"
android:layout_width="0px"
android:layout_height="match_parent" />
</LinearLayout>
I'm getting a blank page on my emulator. No data of Shakesphere class
is getting displayed. What might be the error in my code? I'm guessing
I've gone wrong with the layout.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en