Example usage for twitter4j Category getName

List of usage examples for twitter4j Category getName

Introduction

In this page you can find the example usage for twitter4j Category getName.

Prototype

String getName();

Source Link

Usage

From source file:com.daiv.android.twitter.adapters.CategoriesArrayAdapter.java

License:Apache License

public void bindView(final View view, Context mContext, final Category category) {
    final ViewHolder holder = (ViewHolder) view.getTag();

    holder.text.setText(category.getName());

}

From source file:com.daiv.android.twitter.ui.drawer_activities.discover.people.CategoryFragment.java

License:Apache License

public void getSuggestions() {

    new Thread(new Runnable() {
        @Override/*from w  ww. j a v  a  2s .c  o m*/
        public void run() {
            try {
                Twitter twitter = Utils.getTwitter(context, DrawerActivity.settings);

                int i = 0;

                final ResponseList<Category> categories = twitter.getSuggestedUserCategories();

                Collections.sort(categories, new Comparator<Category>() {
                    public int compare(Category result1, Category result2) {
                        return result1.getName().compareTo(result2.getName());
                    }
                });

                ((Activity) context).runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        listView.setAdapter(new CategoriesArrayAdapter(context, categories));
                        listView.setVisibility(View.VISIBLE);

                        LinearLayout spinner = (LinearLayout) layout.findViewById(R.id.list_progress);
                        spinner.setVisibility(View.GONE);
                    }
                });
            } catch (Throwable e) {
                e.printStackTrace();
                ((Activity) context).runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Toast.makeText(context, getResources().getString(R.string.no_location),
                                Toast.LENGTH_SHORT).show();
                    }
                });
            }
        }
    }).start();
}

From source file:com.klinker.android.twitter.adapters.CategoriesArrayAdapter.java

License:Apache License

public void bindView(final View view, Context mContext, final Category category) {
    final ViewHolder holder = (ViewHolder) view.getTag();

    holder.text.setText(category.getName());

    holder.text.setOnClickListener(new View.OnClickListener() {
        @Override/*from  w  w w  . j a  va 2s  .c  o  m*/
        public void onClick(View view) {
            Intent search = new Intent(context, PeopleSearch.class);
            search.putExtra("slug", category.getSlug());
            context.startActivity(search);
        }
    });

}

From source file:twitter4j.examples.suggestedusers.GetSuggestedUserCategories.java

License:Apache License

/**
 * Usage: java twitter4j.examples.suggestedusers.GetSuggestedUserCategories
 *
 * @param args message/*w  w w .j  a v  a2s.c  o m*/
 */
public static void main(String[] args) {
    try {
        Twitter twitter = new TwitterFactory().getInstance();
        System.out.println("Showing suggested user categories.");
        ResponseList<Category> categories = twitter.getSuggestedUserCategories();
        for (Category category : categories) {
            System.out.println(category.getName() + ":" + category.getSlug());
        }
        System.out.println("done.");
        System.exit(0);
    } catch (TwitterException te) {
        te.printStackTrace();
        System.out.println("Failed to get suggested categories: " + te.getMessage());
        System.exit(-1);
    }
}