Breaking News
Home / Android (page 10)


How to create menu list in Android?

Snippet   The following snippet shows how to create a menu option list.  public boolean onCreateOptionsMenu(Menu menu) {     super.onCreateOptionsMenu(menu);     menu.add(0, SHARE_ID, 0, R.string.menu_share)         .setIcon(android.R.drawable.ic_menu_share);     menu.add(0, HISTORY_ID, 0, R.string.menu_history)         .setIcon(android.R.drawable.ic_menu_recent_history);     menu.add(0, SETTINGS_ID, 0, R.string.menu_settings)   …

Read More »

How to get content of Http URL as a String Android?

package com.livrona.andriod.commons.utils;   import; import; import; import; import; import; import; import;   public class HttpUtils {     public static String getContents(String url) {         String contents ="";     try {         URLConnection conn = …

Read More »

How to show an Alert Dialog in Android?

public static void showDialog(final Context context, final String title, final String message) {, new Runnable() {   @Override   public void run() {   AlertDialog.Builder builder = new AlertDialog.Builder(context);   builder.setTitle(title);   builder.setMessage(message); DialogInterface.OnClickListener buttonListener = new DialogInterface.OnClickListener() {               …

Read More »
Advertisment ad adsense adlogger