Android 密码通知
我目前正在android上制作一个应用程序,注册完成后,我会在数据库中随机生成一个密码。我想知道如何在注册完成后立即通知密码? 您可以在这里学习如何显示应用程序中的本地通知。用xml创建listviewAndroid 密码通知,android,database,Android,Database,我目前正在android上制作一个应用程序,注册完成后,我会在数据库中随机生成一个密码。我想知道如何在注册完成后立即通知密码? 您可以在这里学习如何显示应用程序中的本地通知。用xml创建listview <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_widt
<LinearLayout 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:orientation="vertical"
tools:context=".ListActivity" >
<ListView
android:id="@+id/mobile_list"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</ListView>
</LinearLayout>
在新活动的onCreate()中
String[] passwordArray = (String[]) getValues().toArray(new String[alDcCode.size()]);
ArrayAdapter adapter = new ArrayAdapter<String>(this,
R.layout.activity_listview, passwordArray);
ListView listView = (ListView) findViewById(R.id.mobile_list);
listView.setAdapter(adapter);
String[]passwordArray=(String[])getValues().toArray(新字符串[alDcCode.size()]);
ArrayAdapter=新的ArrayAdapter(此,
R.layout.activity_列表视图,密码数组);
ListView ListView=(ListView)findViewById(R.id.mobile\u列表);
setAdapter(适配器);
粘贴此方法
public ArrayList<String> getValues() {
ArrayList<String> values = new ArrayList<String>();
LocalDatabase DpDataBase = new LocalDatabase(getApplicationContext());
SQLiteDatabase db =DpDataBase.getReadableDatabase();
Cursor cursor = db.rawQuery("SELECT passwordColumName FROM " + tableName, null);
if(cursor.moveToFirst()) {
do {
values.add(cursor.getString(cursor.getColumnIndex("passwordColumName")));
}while(cursor.moveToNext());
}
cursor.close();
db.close();
}
public ArrayList getValues(){
ArrayList值=新的ArrayList();
LocalDatabase DpDataBase=新的LocalDatabase(getApplicationContext());
SQLiteDatabase db=DpDataBase.getReadableDatabase();
Cursor Cursor=db.rawQuery(“从“+tableName,null”中选择passwordColumName);
if(cursor.moveToFirst()){
做{
add(cursor.getString(cursor.getColumnIndex(“passwordColumName”));
}while(cursor.moveToNext());
}
cursor.close();
db.close();
}
以及您的活动_listview.xml
<?xml version="1.0" encoding="utf-8"?>
<!-- Single List Item Design -->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/label"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:padding="10dip"
android:textSize="16dip"
android:textStyle="bold" >
</TextView>
您想发出什么通知?我必须检索密码并将其显示给用户。请尝试我共享的代码答案