Im making a twitter client for android and Im having a hard time adding the list fragment for timelines (fabric) to my activity. At first it would crash my app but now Ive made a few changes and it doesnt crash but once twitter authenticates and it loads the activity but shows a blank screen. below is my code... any help would be greatly appreciated. Thanks in advance.
Activity
import android.app.Activity;
import android.app.Fragment;
import android.app.FragmentManager;
import android.app.FragmentTransaction;
import android.os.Bundle;
/**
* Created by B on 11/24/2015.
*/
public class TweetClass extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tweet_layout_multi);
Fragment frag = new Fragment();
FragmentManager manager = getFragmentManager();
FragmentTransaction transaction = manager.beginTransaction();
transaction.add(R.id.fragment_timeline_user,frag, "Timeline Fragment");
transaction.commit();
FragmentTimeline.xml (fragment layout)
`
<TextView
android:id="@id/android:empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/no_tweets"
android:gravity="center_horizontal|center_vertical"/>
<ListView android:id="@id/android:list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:divider="#e1e8ed"
android:dividerHeight="1dp"
android:drawSelectorOnTop="false"/>
tweet_layout_multi (activty layout)
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/fragment_timeline_user"
android:name="com.continuumwear.continuumbrowser.TimelineFragment"
tools:layout="@layout/fragment_timeline">
</RelativeLayout>
TimelineFragment(fragment)
import android.app.ListFragment;
import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.twitter.sdk.android.tweetui.SearchTimeline;
import com.twitter.sdk.android.tweetui.TweetTimelineListAdapter;
public class TimelineFragment extends ListFragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final SearchTimeline searchTimeline = new SearchTimeline.Builder()
.query("#twitterflock")
.build();
final TweetTimelineListAdapter adapter = new TweetTimelineListAdapter.Builder(getActivity())
.setTimeline(searchTimeline)
.build();
setListAdapter(adapter);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.fragment_timeline, container, false);
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
}
@Override
public void onAttach(Context context) {
super.onAttach(context);
}