Breaking News
Home / Android (page 10)

Android

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 java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection;   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) {       MainThread.run(context, 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