我在main.xml中有一个Imageview,如何将位图设置为main.xml中的imageView我可以将位图分配给下面代码中的本地图像视图.
//Activates the Camera
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, 1);
// get the bitmap data from the Camera
Bundle extras = data.getExtras();
Bitmap b = (Bitmap) extras.get("data");
int width = b.getWidth();
int height = b.getHeight();
ImageView img = new ImageView(this);
img.setImageBitmap(b);
//Saves the image
MediaStore.Images.Media.insertImage(getContentResolver(), b, timestamp, timestamp);
// Set the View
setContentView(img);
Run Code Online (Sandbox Code Playgroud) 我在下面的代码中将ListView项值访问为字符串并在alert中显示它?
ListView shot = getListView();
shot.setOnItemClickListener(this);
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,long arg3) {
String S = arg1.getContext().toString();
AlertDialog.Builder alertbox = new AlertDialog.Builder(this);
// set the message to display
alertbox.setMessage(S).show();
}
Run Code Online (Sandbox Code Playgroud) 我有一个Android应用程序需要用户名和密码登录.当用户下次打开应用程序并自动登录应用程序而不显示登录屏幕时,我需要在手机或其他地方本地保存用户名和密码以使用它们
EditText input1 = (EditText) findViewById(R.id.usertext);
EditText input2 = (EditText) findViewById(R.id.Passtext);
String username = input1.getText().toString();
String password = input2.getText().toString();
Run Code Online (Sandbox Code Playgroud)
如果登录成功,它将通过意图调用活动.
我有一个从ListActivity派生的Contact Activity,它显示了联系人列表,点击了item,初始化了一个从ListActivity派生的新的Activity Message Activity.
现在我知道,我可以在Bundle中打包一些信息并在创建活动之前传递它,但有没有办法在"MessageActivity"的onCreate方法中获取"ContactActivity"的实例?
<?php
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="toybox"; // Database name
$tbl_name="Emp"; // Table name
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$sql="SELECT * FROM $tbl_name";
$result=mysql_query($sql);
$count=mysql_num_rows($result);
// echo $count;
?>
<table width="400" border="0" cellspacing="1" cellpadding="0">
<tr>
<td><form name="form1" method="post" action="">
<table width="400" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td bgcolor="#FFFFFF"> </td>
<td colspan="4" bgcolor="#FFFFFF"><strong>Delete multiple rows in mysql</strong> </td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF">#</td>
<td …Run Code Online (Sandbox Code Playgroud) 嗨,我有列表视图中的六个项目,但是当我在事件上调用alet函数时它不起作用?让我知道如何在点击项目事件上编写函数?
public class PhotoListView extends ListActivity {
String[] listItems = {"HeadShot", "BodyShot ", "ExtraShot", "Video Take1", "Video Take2", "Video Take3", };
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
setListAdapter(new ArrayAdapter(this,android.R.layout.simple_list_item_1, listItems));
}
Run Code Online (Sandbox Code Playgroud)
OnListclick
ListView Shot = getListView();
protected void onListItemClick(View view) {
if(view == Shot){
AlertDialog.Builder alertbox = new AlertDialog.Builder(this);
// set the message to display
alertbox.setMessage("Please Get Ready");
}
Run Code Online (Sandbox Code Playgroud) 如何解密用PHP加密的PHP密码字符串crypt?
$salt = substr($_POST['password'], 0, 2);
$password = crypt($_POST['password'], $salt);
Run Code Online (Sandbox Code Playgroud)
我需要在忘记密码电子邮件中发送原始密码.
我已经在2.1完成了应用程序,现在我有了Android 2.2的手机.在2.2中重建应用程序需要做什么?
android ×6
listview ×2
php ×2
bitmap ×1
cryptography ×1
encryption ×1
imageview ×1
login ×1
mysql ×1
upgrade ×1