① android手機中如何發送彩信
Android手機創建彩信的方法為:在媒體庫里找到一張照片選擇分享-信息,即創建了彩信;新建一條簡訊息,在菜單中選擇添加圖片附件,即創建彩信。了解更多服務優惠點擊下方的「官方網址」客服218為你解答。
② android怎麼把數據存入資料庫
把數據放入資料庫
通過把ContentValues對象傳入instert()方法把數據插入資料庫:
// Gets the data repository in write mode
SQLiteDatabase db = mDbHelper.getWritableDatabase();
// Create a new map of values, where column names are the keys
ContentValues values = new ContentValues();
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_ENTRY_ID, id);
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_TITLE, title);
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_CONTENT, content);
// Insert the new row, returning the primary key value of the new row
long newRowId;
newRowId = db.insert(
FeedReaderContract.FeedEntry.TABLE_NAME,
FeedReaderContract.FeedEntry.COLUMN_NAME_NULLABLE,
values);
insert()方法的第一個參數是表名。第二個參數提供了框架中的一個列名,在ContentValues的值是空的時候,框架會向表中插入NULL值(如果這個參數是「null」,那麼當沒有值時,框架不會向表中插入一行。
從資料庫中讀取數據
要從資料庫中讀取數據,就要使用query()方法,你需要給這個方法傳入選擇條件和你想要獲取數據的列。查詢結果會在Cursor對象中被返回。
SQLiteDatabase db = mDbHelper.getReadableDatabase();
// Define a projection that specifies which columns from the database
// you will actually use after this query.
String[] projection = {
FeedReaderContract.FeedEntry._ID,
FeedReaderContract.FeedEntry.COLUMN_NAME_TITLE,
FeedReaderContract.FeedEntry.COLUMN_NAME_UPDATED,
...
};
// How you want the results sorted in the resulting Cursor
String sortOrder =
FeedReaderContract.FeedEntry.COLUMN_NAME_UPDATED + " DESC";
Cursor c = db.query(
FeedReaderContract.FeedEntry.TABLE_NAME, // The table to query
projection, // The columns to return
selection, // The columns for the WHERE clause
selectionArgs, // The values for the WHERE clause
null, // don't group the rows
null, // don't filter by row groups
sortOrder // The sort order
);
使用Cursor對象的移動方法來查看游標中的一行數據,在開始讀取數據之前必須先調用這個方法。通常,應該從調用moveToFirst()方法開始,它會把讀取數據的位置放到結果集中第一實體。對於每一行,你可以通過調用Cursor對象的相應的get方法來讀取列的值,如果getString()或getLong()方法。對於每個get方法,你必須把你希望的列的索引位置傳遞給它,你可以通過調用getColumnIndex()或getColumnIndexOrThrow()方法來獲取列的索引。例如:
cursor.moveToFirst();
long itemId = cursor.getLong(
cursor.getColumnIndexOrThrow(FeedReaderContract.FeedEntry._ID)
);
從資料庫中刪除數據
要從一個表中刪除行數據,你需要提供標識行的選擇條件。數據API為創建選擇條件提供了一種機制,它會防止SQL注入。這中機制把選擇條件分成了選擇條件和選擇參數。條件子句定義了要查看的列,並且還允許你使用組合列來進行篩選。參數是用於跟條件綁定的、用戶篩選數據的值。因為這樣不會導致像SQL語句一樣的處理,所以它避免了SQL注入。
// Define 'where' part of query.
String selection = FeedReaderContract.FeedEntry.COLUMN_NAME_ENTRY_ID + " LIKE ?";
// Specify arguments in placeholder order.
String[] selelectionArgs = { String.valueOf(rowId) };
// Issue SQL statement.
db.delete(table_name, selection, selectionArgs);
更新資料庫
當你需要編輯資料庫值的時候,請使用update()方法。
這個方法在更新數據時會把insert()方法中內容值的語法跟delete()方法中的where語法結合在一起。
SQLiteDatabase db = mDbHelper.getReadableDatabase();
// New value for one column
ContentValues values = new ContentValues();
values.put(FeedReaderContract.FeedEntry.COLUMN_NAME_TITLE, title);
// Which row to update, based on the ID
String selection = FeedReaderContract.FeedEntry.COLUMN_NAME_ENTRY_ID + " LIKE ?";
String[] selelectionArgs = { String.valueOf(rowId) };
int count = db.update(
FeedReaderDbHelper.FeedEntry.TABLE_NAME,
values,
selection,
selectionArgs);
③ android的機器怎麼設置彩信接入點我用的186的3G號碼
以HTC Legend(G6)為例
設置(G6里有兩個「設置」圖標,選圓形齒輪狀圖標)->無線和網路->移動網路設置->接入點名稱->按手機上的實體「MENU」鍵->新接入點名稱(具體設置附後面)
編輯完以後,按「MENU」鍵選擇 「保存」。
1.設置完成後,把「接入點名稱」界面中使用的接入點對應的圓點選點為綠色(這一步一定要做)
2.勾選上「無線和網路」設置(接入點設置的上兩級菜單)中的「移動網路」。
附:1.手機上網設置
2.彩信設置
1.聯通的APN設置(手機上網)
名稱:3gnet
APN:3gnet
代理:<未設置>
埠:<未設置>
用戶名:<未設置>
密碼:<未設置>
伺服器:<未設置>
MMSC: <未設置>
彩信埠:80
彩信協議:WAP 2.0
MCC:460
MNC: 01(保持默認值,不要更改,有的機器是00)
APN類型:default
2.彩信設置
名稱:3gwap
APN:3gwap
代理:10.0.0.172
埠:80
用戶名:空
密碼:空
伺服器:http://www.wo.com.cn
MMSC: http://mmsc.myuni.com.cn
彩信代理:10.0.0.172
彩信埠:80
彩信協議:WAP 2.0
MCC:460
MNC: 01(保持默認值,不要更改,有的機器是00)
APN類型:mms
④ android百度消息推送過來的數據如何存入資料庫
可以通過getText()方法,首先需要的到輸入的值,然後調用資料庫的插入方法 db.insert();插入到資料庫中就行;這樣數據就存入資料庫了。⑤ Android手機怎麼創建彩信
Android手機創建彩信的方法為:在媒體庫里找到一張照片選擇分享-信息,即創建了彩信;新建一條簡訊息,在菜單中選擇添加圖片附件,即創建彩信。了解更多服務優惠點擊下方的「官方網址」客服220為你解答。
⑥ android開發中如何往調用的類庫中的資料庫插入數據
你通過getText()方法首先得到輸入的值,然後調用資料庫的插入方法 db.insert();插入到資料庫中就行 就想這樣
EditText et ;
String num = et.getText().toString();
public void addData(String num) {
SQLiteDatabase db = dbHelper.getWritableDatabase();
ContentValues values = new ContentValues();
values.put("num", num);
db.insert("表名", null, values);
}
當你調用這個 addData()方法時就會向資料庫中插入數據了
⑦ Android客戶端怎麼與伺服器資料庫連接
不能與資料庫連接的
Android客戶端不能直接與伺服器資料庫連接。資料庫是需要非常大的內存,安裝之後有好幾G,連接資料庫要有一個像SQLServer里的webservice,這樣的一個橋梁來間接訪問。就是在伺服器運行一個服務端程序,該服務端程序通過接收來自android客戶端的指令,對資料庫進行操作。
客戶端的http請求可以通過 HttpClient類實現,在anddroid 4.0之後,客戶端的網路請求已經不被允許在主線程中運行,所以還需注意另開啟一個子線程進行網路請求。
(7)android插入彩信資料庫擴展閱讀:
Android安全許可權機制:
Android默認設置下,所有應用都沒有許可權對其他應用、系統或用戶進行較大影響的操作。這其中包括讀寫用戶隱私數據(聯系人或電子郵件),讀寫其他應用文件,訪問網路或阻止設備待機等。安裝應用時,在檢查程序簽名提及的許可權,且經過用戶確認後,軟體包安裝器會給予應用許可權。
下載一款Android應用通常會要求如下的許可權:撥打電話、發送簡訊或彩信、修改/刪除SD卡上的內容、讀取聯系人的信息、讀取日程信的息,寫入日程數據、讀取電話狀態或識別碼、精確的(基於GPS)地理位置、模糊的(基於網路獲取)地理位置、創建藍牙連接、
還有對互聯網的完全訪問、查看網路狀態,查看WiFi狀態、避免手機待機、修改系統全局設置、讀取同步設定、開機自啟動、重啟其他應用、終止運行中的應用、設定偏好應用、震動控制、拍攝圖片等。
⑧ Android手機創建彩信的方法是
您好,手機發送彩信方法,以oppo手機為例:
1、進入簡訊發送界面,點擊左下角【+】-【彩信主題】,編輯主題和簡訊內容即可以彩信方式發送該條信息;
2、點擊【+】中的【圖片】、【拍照】、【姓名和號碼】、【音頻】、【視頻】添加內容後,均會通過彩信方式發送該條信息。
⑨ android 怎麼往資料庫裡面添加數據
一、引入
資料庫創建的問題解決了,接下來就該使用資料庫實現應用程序功能的時候了。基
本的操作包括創建、讀取、更新、刪除,即我們通常說的 CRUD(Create, Read, Update, Delete)。
在實現這些操作的時候,我們會使用到兩個比較重要的類 SQLiteDatabase 類和 Cursor 類。
二、創建表
1,execSQL(String sql):執行一條 sql 語句,且執行操作不能為 SELECT
因為它的返回值為 void,所以推薦使用 insert、update 方法等
2.,execSQL (String sql,Object[] bindArgs)
sql:執行一條 sql 語句
bindArgs:為 sql 語句中的?賦值
三、添加數據
1、execSQL(String sql)
2、使用對象的 insert 方法
ContentValues values = new ContentValues();
values.put(USERNAME, user.getUsername());
values.put(PASSWORD, user.getPassword());
db.insert(TABLE_NAME, null, values);
參數:
table:資料庫中的表名
nullColumnHack:指定默認插入欄位,為 null 時能插入數據
values:表示插入欄位所對應的值,使用 put 方法。
四、刪除數據
1、execSQL(String sql)
2、使用對象的 delete 方法
String whereClaues="_id=?";
String [] whereArgs={String.valueOf(id)};
//db.delete(TABLE_NAME, "_id="+id, null);
db.delete(TABLE_NAME, whereClaues, whereArgs);
參數
table:資料庫的表名
whereClause:where 子句,比如:_id=?
whereArgs:where 子句中?的值
五、修改數據
1、execSQL(String sql)
2、使用對象的 delete 方法
ContentValues values = new ContentValues();
values.put(USERNAME, user.getUsername());
values.put(PASSWORD, user.getPassword());
String whereClaues="_id=?";
String [] whereArgs={String.valueOf(user.getId())};
db.update(TABLE_NAME, values, whereClaues, whereArgs);
參數
table:資料庫的表名
values:代表要修改的值,修改方法還是 put(key,values)
whereClause:條件子句,比如 id=?,name=?
whereArgs:為 whereClause 中的?賦值,比如:new String[]{"1","張三"}
圖:
參考代碼:
程序內使用SQLite資料庫是通過SQLiteOpenHelper進行操作
1.自己寫個類繼承SQLiteOpenHelper,重寫以下3個方法
publicvoidonCreate(SQLiteDatabasedb)
{//創建資料庫時的操作,如建表}
publicvoidonUpgrade(SQLiteDatabasedb,intoldVersion,intnewVersion)
{
//版本更新的操作
}
2.通過SQLiteOpenHelper的getWritableDatabase()獲得一個SQLiteDatabase資料庫,以後的操作都是對SQLiteDatabase進行操作。
3.對得到的SQLiteDatabase對象進行增,改,刪,查等操作。
代碼
packagecx.myNote;
importandroid.content.ContentValues;
importandroid.content.Context;
importandroid.content.Intent;
importandroid.database.Cursor;
importandroid.database.sqlite.SQLiteDatabase;
importandroid.database.sqlite.SQLiteOpenHelper;
//DBOptionsforlogin
publicclassDBOptions{
privatestaticfinalStringDB_NAME="notes.db";
privatestaticfinalStringDB_CREATE="createtablelogininf(nametext,pwdtext)";
{
publicDBHelper(Contextcontext){
super(context,DB_NAME,null,1);
}
@Override
publicvoidonCreate(SQLiteDatabasedb){
//TODOAuto-generatedmethodstub
//建表
db.execSQL(DB_CREATE);
}
@Override
publicvoidonUpgrade(SQLiteDatabasedb,intoldVersion,intnewVersion){
//TODOAuto-generatedmethodstub
db.execSQL("droptableifexistslogininf");
onCreate(db);
}
}
privateContextcontext;
privateSQLiteDatabasedb;
privateDBHelperdbHelper;
publicDBOptions(Contextcontext)
{
this.context=context;
dbHelper=newDBHelper(context);
db=dbHelper.getReadableDatabase();
}
//自己寫的方法,對資料庫進行操作
publicStringgetName()
{
Cursorcursor=db.rawQuery("selectnamefromlogininf",null);
cursor.moveToFirst();
returncursor.getString(0);
}
publicintchangePWD(StringoldP,Stringpwd)
{
ContentValuesvalues=newContentValues();
values.put("pwd",pwd);
returndb.update("logininf",values,"pwd="+oldP,null);
}
}
insert方法插入的一行記錄使用ContentValus存放,ContentValues類似於Map,它提供了put(String key, Xxx value)(其中key為數據列的列名)方法用於存入數據、getAsXxxx(String key)方法用於取出數據
⑩ 安卓系統的彩信圖片存放位置在哪裡
Android的簡訊和彩信是放在/data/data/com.android.provider.telephony/databases目錄下的mmssms.db數據文件的。拿一部具有root許可權的手機用sqlite工具打開可以看到裡面的資料庫結構