728x15 Ads

bar

Android tools and DDMS

0

Android tools and DDMS

Hello Friends welcome to "Hello Word " post of prayas

Start From Scratch

Now apni pehli application banane ke liye sabse pehle open eclipse and upar toolbar main new par  use select click kariye and then agar android ka option aa rha hai to use select kariye ni to other option par click kariye .

Android Installation

0


Hello Friends welcome to "Hello Word " post of prayas


Now apni pehli application banane ke liye sabse pehle open eclipse and upar toolbar main new par  use select click kariye and then agar android ka option aa rha hai to
use select kariye ni to other option par click kariye .
*)Ab android par click kariye and select android application project.
*)now project , app and package ka name dijiye.

NOte-> minimum and maximum sdk define kariye (minimum 1.6 ya usse upar koi bi select akr lijiye)

*)Ab activity select kariye (koi bi) ya blank select akr lijiye. and finish.

Eclipse apne aap application ka directory structure prepare kar dega.

*) NOw to run our app->
  
   clcik on project and select run as ab ismein android select kariye and new configuration par click kariye and select select your project uske baad target select 
kariye 
i will sujest you 2.2 api level 8 now run.
                                 
                                             Signature Hromit Prodigy


Next post -> Next post is on Android tools and ddms.



                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    

ANDROID LINKING ACTIVITIES

0
Android applications mein activities ko link karna padta hai. ye linking within the application bi ho sakti hai and outside the application bi ho sakti hai .
Android mein hum applications ko different tarike se link kar sakte hain.

let suppose two activities hain:

Modifications in the manifest file:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.linking"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="15" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="@string/title_activity_main" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".Activity2"
android:label="@string/app_name" >
<intent-filter>
<action android:name="com.example.linking" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>

now main activity se activity2 ko link karne ke liye :




packagecom.example.linking;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;




public class MainActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//---link to Activity2---
Intent i = new Intent("com.example.linking.Activity2");
startActivity(i);
}
}

kisi doosri activity se link karne ke liye hum Intent ka use karte hain. Hum intent ka object banate hain and then uske constructor mein hume jo activity manifest file mein define ki hai use pass kar dete hain.
After this hum activity ko start karte hain by using

startActivity(i);

alternatively hum isko ek aur method se kar sakte hain:


Intent i = new Intent();
i.setAction("net.learn2develop.Activity2");
startActivity(i);

yahan par hum intent ka object bana rhe hain and then setAction method ke through hum target activity ka name set kar rhe hain

Abhi jo humne code use kiya hai isse hum activity ko within the application as well as outside the application dono mein call kara sakte hain par agar hum chahte hain ki hum kewal within the application hi call karein
to hum activity ko direct class name se bhi call kar sakte hain.


//---link to Activity2---
Intent i = new Intent(this, Activity2.class);



 iske saath hi hamein manifest file mein bhi modification karna padega


<activity
android:name=".Activity2"
android:label="@string/app_name" >
<intent-filter>
<!--
<action android:name=com.example.linking.Activity2" />
-->
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>

hamein intent filter se action element ko remove karna hoga.

Agar Hum jo activity call kar rhe hain and vo activity crash kar gyi hai tab hamein screen par aisa msg dekhne ko milega :




ise avoid karne ke liye hum startactivity ko hum intentCreator ke saath call karte hain jismein hum intent ka object pass karte hain and string pass karte hain jo ki display hogi application ke crash hone par .

   Intent i = new Intent(this, Activity2.class);
startActivity(Intent.createChooser(i, "Choose an application"));

now the screen will be :


note:  Agar createChooser() use kar rhe hain tab hum activity ko is tarah se define ni kar sakte



  Intent i = new Intent(this, Activity2.class);
  startActivity(Intent.createChooser(i, "Choose an  
application"));

      




agar more than one activites indicate ho rhi hain then the screen will be :






       
















jquery simple codes

0
jquery codes(scrolldown/onfocus/onblur)

What is jquery..?

jquery javascript ka advanced version hai jo ki basically animation ke liye use kar jaati hai.

simplest code for onfocus and onblur.

function clearText(field) {

    if (field.defaultValue == field.value) field.value = '';
    else if (field.value == '') field.value = field.defaultValue;
}

simplest code of targetoffset for scrolldown. 

function cat_click(){
var targetOffset = $('.category_list').offset().top;
      $('html,body').animate({ scrollTop: targetOffset }, 1000);
}

php mail explanation with example

0
php mail attachment example <!-- Metadata generated by http://vancouver-webpages.com/META/mk-metas.html --> -->
php mail attachment WITH A ATTACHMENT IN PHP.

For this u need to install  post card(Local SMTP mail server)

/* form */

<html>
<body>

<form action="romit.php" method="post"
enctype="multipart/form-data">
<label for="file">Filename:</label>
<input type="file" name="file[]" multiple="multiple" id="file"><br>
<input type="submit" name="submit" value="Submit">
</form>
</body>
</html> 


*These 3 line code will remove before uploading server, this is use for only local server  Ends*/

romit.php
 
<?php
ini_set("SMTP","mail.AAAA.com"); //mail.yoursite.com should be your local smtp
ini_set("smtp_port","25"); //25 should be your smtp port
ini_set("sendmail_from","drrfiv.sh7@gmail.com");

?>

<?php

/* code for getting files from form */
if ($_FILES["file"]["error"] > 0)
  {
  echo "Error: " . $_FILES["file"]["error"] . "<br>";
  }
else
  {
 // echo "Upload: " . $_FILES["file"]["name"] . "<br>";
 // echo "Type: " . $_FILES["file"]["type"] . "<br>";
 // echo "Size: " . ($_FILES["file"]["size"] / 1024) . " kB<br>";
 // echo "Stored in: " . $_FILES["file"]["tmp_name"];
 
    $fileName =  $_FILES["file"]["name"] ;
    $fileType = $_FILES["file"]["type"];
    $fileSize = $_FILES["file"]["size"];
    $tmpName = $_FILES["file"]["tmp_name"];
  
    $tmpFilePath = $_FILES['file']['tmp_name'];
    //if (file_exists("upload/" . $_FILES["file"]["name"]))
      //{
      //echo $_FILES["file"]["name"] . " already exists. ";
      //}
    //else
      //{
     // move_uploaded_file($_FILES["file"]["tmp_name"],
     // "upload/" . $_FILES["file"]["name"]);
      move_uploaded_file($tmpFilePath,
      "C:/wamp/www/folder/" . $_FILES["file"]["name"]);
      echo "Stored in: " . "folder/" . $_FILES["file"]["name"];
      //echo "Stored in: " . "upload/" . $_FILES["file"]["tmp_name"];
      //}
  
  }

 
  $subject1 = '! Thanks for your assignment submission';
 /******* ‘Please replace the details with the originals credentials [Replace Form Email address with the senders Email address] *******/
    $from1 = trim('AAAAA@kkk.com') ;
    $to1 = 'hromits@srivastava.com';
    $date1 = date('D, d M Y H:i:s T');
    $text1 = "hello";
    $html1 = "Dear Thanks for submitting the assignment for evaluation.";

 $userfile=$_FILES["file"]["name"] ;
 $uid=md5(uniqid( time()));

    $headers1 = 'MIME-Version: 1.0' . "\r\n";

    $headers1 .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"".$uid."\"\r\n\r\n";

  
  
$attachment = chunk_split(base64_encode(file_get_contents($userfile)));

    $headers1 .= "--" . $uid."\r\n";
    $headers1 .= "Content-Type: text/plain; charset=iso-8859-1\r\n";
    $headers1 .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
    $headers1 .= $html1."\r\n\r\n";
  
    $headers1 .= "--" . $uid."\r\n";
    $headers1 .= "Content-Type:".$fileType."; name=\"".$fileName."\"\r\n";
    $headers1 .= "Content-Transfer-Encoding: base64\r\n";
    $headers1 .= "Content-Disposition: attachment;filename=\"".$fileName."\"\r\n";
    $headers1 .= $attachment."\r\n\r\n";
  
    $headers1 .="From:".$from1;

?>

<?php


//send the email
$mail_sent = @mail( $to1, $html1, "", $headers1 );
//if the message is sent successfully print "Mail sent". Otherwise print "Mail failed"
echo $mail_sent ? "Mail sent" : "Mail failed";

?>

 
if this helps u leave a comment...

Copyright © eAZy EnginEEriNG