小编Sri*_*idu的帖子

如何将位图设置为从相机捕获的main.xml中的ImageView?

我在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)

android bitmap imageview

25
推荐指数
1
解决办法
7万
查看次数

如何获取在android中单击的Listview项的值?

我在下面的代码中将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 listview

9
推荐指数
2
解决办法
5万
查看次数

如何保存android app的登录详细信息?

我有一个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)

如果登录成功,它将通过意图调用活动.

android login

7
推荐指数
1
解决办法
2万
查看次数

如何从被调用的Activity中"调用"Activity实例?

我有一个从ListActivity派生的Contact Activity,它显示了联系人列表,点击了item,初始化了一个从ListActivity派生的新的Activity Message Activity.

现在我知道,我可以在Bundle中打包一些信息并在创建活动之前传递它,但有没有办法在"MessageActivity"的onCreate方法中获取"ContactActivity"的实例?

android android-activity

5
推荐指数
2
解决办法
9490
查看次数

在php我的sql中删除多条记录

 <?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">&nbsp;</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)

php mysql

1
推荐指数
1
解决办法
4934
查看次数

如何在Android中为ListView编写onclick事件?

嗨,我有列表视图中的六个项目,但是当我在事件上调用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)

android listview

1
推荐指数
1
解决办法
3万
查看次数

如何解密用crypt加密的PHP中的密码字符串?

如何解密用PHP加密的PHP密码字符串crypt

$salt = substr($_POST['password'], 0, 2);  
$password = crypt($_POST['password'], $salt);
Run Code Online (Sandbox Code Playgroud)

我需要在忘记密码电子邮件中发送原始密码.

php encryption cryptography

0
推荐指数
1
解决办法
3839
查看次数

如何将应用程序Api级别从2.1更改为2.2

我已经在2.1完成了应用程序,现在我有了Android 2.2的手机.在2.2中重建应用程序需要做什么?

android upgrade

0
推荐指数
1
解决办法
2022
查看次数