Tech-Today
Android Studio - Displaying List View Inside AlertDialog
Android Studio - Displaying List View Inside AlertDialog
1.) Follow this code:
================
>Note: custom_dialog_layout.xml is the layout that will pop-up
>Note: row.xml is the item used for populating row
AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(MainActivity.this, android.R.style.Theme_Holo));
builder.setTitle("Custom Dialog");
View customView = LayoutInflater.from(MainActivity.this).inflate(R.layout.custom_dialog_layout, null, false);
ListView listList1 = (ListView)customView.findViewById(R.id.listView1);
String[] stringArray1 = new String[] { "Bright Mode", "Normal Mode" };
ArrayAdapter adapter1 = new MyListAdapter(MainActivity.this, R.layout.row, stringArray1);
listList1.setAdapter(adapter1);
builder.setView(customView);
builder.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
//Ok
}
});
builder.setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
//Cancel
}
});
builder.show();
-
Android Studio - Creating Material Design App Bar
Android Studio - Creating Material Design App Bar 1.) Set-up the color that we'll use for the app bar: ======================================== >Create a new xml inside values and name it color.xml <resources> <color name="ColorPrimary">#FF5722</color>...
-
Ios Donut Progress Bar
The iOS Donut Progress Bar is an iOS library that you can integrate in your project to present data in a graphical way. Furthermore, it will allow you to get a live preview of the design right in the Interface Builder. Inside the Interface Builder: iOS...
-
Uitabbarcontroller Error - Loaded The "yourview" Nib But The View Outlet Was Not Set
Working on a simple UITabBarController I encountered the above error "nib but the view outlet was not set". This usually happens when you create a new nib file and forgot to change the File's Owner class in the interface builder. So for example we...
-
Android Bundle Sqlite Database On Application. Create Sqlite Database On First Application Invoke.
How to setup a default sqlite database structure with data in an android application. Add this class and initialize it in your main class that extends Activity. import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase;...
-
Android's Datepickerdialog And Timepickerdialog Implementation
Layout (calendar.xml) Java Class: package org.ipiel.demo.layout; import java.text.DateFormat; import java.util.Calendar; import android.app.Activity; import android.app.DatePickerDialog; import android.app.TimePickerDialog; import android.os.Bundle;...
Tech-Today