Subscribe via email

Enter your email address and get Latest Material :

Tag

%temp% Android Application to understand Activity Android Applicaton login button should remain disabled Android Program C Language GTU MCA Syllabus PPT/Notes C full ppt by keval nagaria C++ GTU MCA CPI/CGPA To Percentage Calculator Core JAVA GTU MCA Core Java Create Bootable USB flash Drive Using DISKPART utility Create USB Pen Drive Create an application that will create database with table of User credential. Create an application that will have spinner with list of animation names. On selecting animation name Create an application to call specific entered number by user in the EditText Create an application to make Insert Crimping DBMS GTU MCA Syllabus PPT/Note DISKPART DOS Command to Erase temp file DS GTU MCA Delete and retrieve operation on the database. Erase/Delete Temp file Ethernet FON GTU MCA FON Practical Solution FON Program Fundamental Of Networking GTU MCA PPT GTU Student FInd CPI/CGPA To Percentage Converter Intent Java Chapter Wise Slide Show For GTU MCA Student Sem-3 LAN Cable Online CPI/CGPA Converter/Calculator PL_SQL GTU MCA Syllabus PPT/Note RG45 Connector Read messages from the mobile and display it on the screen. SS(System Software) GTU MCA Understand Menu option. a. Create an application that will change color of the screen Understand resource folders : a. Create spinner with strings taken from resource folder b. On changing spinner value WTAD GTU MCA WTAD Practical Solution Web Technology And Application Development (WTAD) Windwos 7 USB Pen Drive application that will play a media file from the memory car application to send message between two emulators based on selected options from the menu. change image. delete temp file into C drive draw line on the screen as user drag his finger gtu mca android program open any URL inside the application and clicking on any link from that URl should not open Native browser but that URL should open the same screen. read file from asset folder and copy it in memory card. take picture using native application that animation should affect on the images displayed below. to pick up any image from the native application gallery and display it on the screen. update

How to Erase/Delete the windows temporary files folder using DOS command
Windows stores the temporary file and folder in your system. It is a collection of files and folder that you install software on your system previously. This temporary file and folder contain an enormous amount of space. Temporary file creates a trouble shot like system is slow down and sometime a threat to the privacy of the user by the other users of the computer.

·         What is a temporary file?
The temporary file is created by software for many reasons, like when you are downloading any document such as DOC and PDF file, and the file is saved as a temp file while you are using it.

·         Are this temp file is dangerous for computer?
Normally the temp file is not dangerous for computer until someone put malware and Trojan code into the system. Putting too many files into temp folder they will affect on any computer operation.

·         How to you protect against temporary file?
Temp file can be deleted either manually or by software. The manually you delete temp file using run disk cleanup.

·         Step to run disk cleanup

§  Click on ‘Start’ menu
§  Click my computer
§  Right click on C drive and select properties
§  Click on general tab
§  Click the disk cleanup tab
§  A new dialog box appears on screen and select the check box which temp file you want to delete.
§  Click yes to continue and finally click ok to delete the temp file into your system.

Note: - you may give the administrative permission to delete the file.

Or
§  Click on ‘Start’ menu
§  Click on run
§  Type the keyword ‘%temp%’ and hit enter
§  List of temp files will appear on the window
§  Select all the files and delete them.

·         Delete temp file using the software.

Rather than downloading any paid software for erasing temp files I suggest you to create your own code with DOS command and save it for life time in your system.

·         Step to create temp remover manually.

§  Click on ‘Start’ menu
§  Click on run command and type ‘notepad’ and hit enter
§  Type the following line into notepad


§  Save file with the extension (.bat) like temp_remover.bat
§  Put this file into your ‘startup’ folder.



Exercise : 20

Create an application to open any URL inside the application and clicking on any link from that URl should not open Native browser but that URL should open the same screen.
Screen Shot:

XML :
main.xml :




	 

JAVA :

TwentyFourActivity.java :
package kmn.TwentyFour;
import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;

public class TwentyFourActivity extends Activity 
{	@Override
	public void onCreate(Bundle savedInstanceState) 
	{
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);
		WebView webView = (WebView) findViewById(R.id.webview);
		webView.getSettings().setJavaScriptEnabled(true);
		webView.loadUrl("http://www.gtumcappt.com");
		webView.setWebViewClient(new HelloWebViewClient());
	}
}
HelloWebViewClient.java :

package kmn.TwentyFour;

import android.webkit.WebView;
import android.webkit.WebViewClient;

public class HelloWebViewClient extends WebViewClient
{	@Override
	public boolean shouldOverrideUrlLoading(WebView view, String url)
	{
		view.loadUrl(url);
		return true;
	}

}

Exercise : 23

Create an application to pick up any image from the native application gallery and display it on the screen.
Screen Shot:

XML :
main.xml :






JAVA :

TwentythreeActivity.java :
package kmn.Twentythree;
import java.io.File;
import java.io.FileInputStream;
import android.app.Activity;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.provider.MediaStore.Images.Media;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
 
public class TwentythreeActivity extends Activity
{
	/** @author Y@@D **/
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
 
        setContentView(R.layout.main);
        try
        {
        	 
            String[] projection={Media.DISPLAY_NAME, Media.DATA, Media.SIZE};
            Cursor c=managedQuery(Media.EXTERNAL_CONTENT_URI, projection, null, null, null);
            ImageView ivImage=(ImageView)findViewById(R.id.myImg);
            File file = null;
            String imgName = null ;            
            
            if(c.getCount()>0)
            {
               	while(c.moveToNext())
            	{
             		file=new File(c.getString(1));	//after completing loop, it take last image from native Gallery to display.
            		imgName=c.getString(0);
             	}
        		c.close();
       			FileInputStream fis=new FileInputStream(file);
       			byte[] buffer=new byte[fis.available()];
       			fis.read(buffer);
       			Bitmap bm=BitmapFactory.decodeByteArray(buffer, 0, buffer.length);
       		  
       			TextView txtTitle=(TextView)findViewById(R.id.txtTitle);
       			txtTitle.setText(imgName.toString());
       			ivImage.setImageBitmap(bm);
            }  
        }
        catch(Exception e)
        {
        	Toast.makeText(TwentythreeActivity.this, "Error: "+e, Toast.LENGTH_LONG).show();
        }   
    }
}

Step To store images on sdcard and scanning in to the emulator.

1)click on push on file onto the device button
2)now select the iamge an upload it
3)goto the "Dev Tools" on your emulator and click on "Media Scanner".
4)now check your image in "gallery"
5)run your program

Enjoy..........

Exercise : 22
Create an application to take picture using native application.
Screen Shot:



XML :
main.xml :




JAVA :

TwentyTwoActivity.java :

package kmn.TwentyTwo;

import java.io.File;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;

public class TwentyTwoActivity extends Activity 
{
    /** @author Y@@D */
    String path;
	@Override
    public void onCreate(Bundle savedInstanceState) 
	{
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        path = Environment.getExternalStorageDirectory() + File.separator +  "make_machine_example.jpg";
        File file = new File( path );
        Uri outputFileUri = Uri.fromFile( file );

        Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE );
        intent.putExtra( MediaStore.EXTRA_OUTPUT, outputFileUri );

        startActivityForResult( intent, 0 );
        
    }
}

Exercise : 21
Create an application to send message between two emulators.
Screen Shot:



XML :
main.xml :


             
    
         
              
    
JAVA :
TwentyOneActivity.java :

package kmn.TwentyOne;
import android.app.Activity;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.telephony.SmsManager;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

public class TwentyOneActivity extends Activity 
{
 /**  @author Y@@D  */
 Button btnSendSMS;
 EditText txtPhoneNo;
 EditText txtMessage;

 //@Override
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        btnSendSMS = (Button) findViewById(R.id.btnSendSMS);
        txtPhoneNo = (EditText) findViewById(R.id.txtPhoneNo);
        txtMessage = (EditText) findViewById(R.id.txtMessage);
        
        /*
        Intent sendIntent = new Intent(Intent.ACTION_VIEW);
        sendIntent.putExtra("sms_body", "Content of the SMS goes here..."); 
        sendIntent.setType("vnd.android-dir/mms-sms");
        startActivity(sendIntent);
        */
                
        btnSendSMS.setOnClickListener(new View.OnClickListener() 
        {
            public void onClick(View v) 
            {             
             String phoneNo = txtPhoneNo.getText().toString();
             String message = txtMessage.getText().toString();              
                if (phoneNo.length()>0 && message.length()>0)                
                    sendSMS(phoneNo, message);                
                else
                 Toast.makeText(getBaseContext(),"Please enter both phone number and message.", Toast.LENGTH_SHORT).show();
            }
        });        
    }
    
    //---sends a SMS message to another device---
    private void sendSMS(String phoneNumber, String message)
    {      
      
     String SENT = "SMS_SENT";
     String DELIVERED = "SMS_DELIVERED";
     
        PendingIntent sentPI = PendingIntent.getBroadcast(this, 0, new Intent(SENT),0);
        
        
        PendingIntent deliveredPI = PendingIntent.getBroadcast(this, 0, new Intent(DELIVERED), 0);
     
        //---when the SMS has been sent---
        registerReceiver(new BroadcastReceiver()
        {
  // @Override
   public void onReceive(Context arg0, Intent arg1) 
   {
    switch (getResultCode())
    {
        case Activity.RESULT_OK:
         Toast.makeText(getBaseContext(), "SMS sent",Toast.LENGTH_SHORT).show();
         break;
        case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
         Toast.makeText(getBaseContext(), "Generic failure", Toast.LENGTH_SHORT).show();
         break;
        case SmsManager.RESULT_ERROR_NO_SERVICE:
         Toast.makeText(getBaseContext(), "No service",Toast.LENGTH_SHORT).show();
         break;
        case SmsManager.RESULT_ERROR_NULL_PDU:
         Toast.makeText(getBaseContext(), "Null PDU",Toast.LENGTH_SHORT).show();
         break;
        case SmsManager.RESULT_ERROR_RADIO_OFF:
         Toast.makeText(getBaseContext(), "Radio off",Toast.LENGTH_SHORT).show();
         break;
    }
   }
        }, new IntentFilter(SENT));
        
        //---when the SMS has been delivered---
        registerReceiver(new BroadcastReceiver()
        {
   //@Override
   public void onReceive(Context arg0, Intent arg1)
   {
    switch (getResultCode())
    {
        case Activity.RESULT_OK:
         Toast.makeText(getBaseContext(), "SMS delivered", Toast.LENGTH_SHORT).show();
         break;
        case Activity.RESULT_CANCELED:
         Toast.makeText(getBaseContext(), "SMS not delivered", Toast.LENGTH_SHORT).show();
         break;         
    }
   }
        }, new IntentFilter(DELIVERED));        
     
        SmsManager sms = SmsManager.getDefault();
        sms.sendTextMessage(phoneNumber, null, message, sentPI, deliveredPI);               
    }    
}
SmsReceiver.java :
package kmn.TwentyOne;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.SmsMessage;
import android.widget.Toast;

public class SmsReceiver extends BroadcastReceiver
{
	/**  @author Y@@D */
	//@Override
	public void onReceive(Context context, Intent intent) 
	{
        //---get the SMS message passed in---
        Bundle bundle = intent.getExtras();        
        SmsMessage[] msgs = null;
        String str = "";            
        if (bundle != null)
        {
            //---retrieve the SMS message received---
            Object[] pdus = (Object[]) bundle.get("pdus");
            msgs = new SmsMessage[pdus.length];            
            for (int i=0; i


Step to Creat two emulator and send sms.

1)goto windows->Android SDK and AVD Mangaer.
2)creat two emulator and give the different name.
3)start emulator by clicking start button
3)now enter the emulator number to phone number and send it.

Note:- see the give OutPut Image..

Enjoy.........

Exercise : 20

Create an application to draw line on the screen as user drag his finger.

Screen Shot:

XML :
main.xml :




JAVA :
TwentyActivity.java :

package kmn.Twenty;
import android.app.Activity;
import android.os.Bundle;
public class TwentyActivity extends Activity 
{
 /**  @author Y@@D  */
    public void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
  super.onCreate(savedInstanceState);
  setContentView(new ExploreTouchEvent(this, null));
 }
}

ExploreTouchEvent.java :
package kmn.Twenty;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Path;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
/**  @author Y@@D  */
public class ExploreTouchEvent extends View 
{
 private Paint paint = new Paint();
 private Path path = new Path();
 public ExploreTouchEvent(Context context, AttributeSet attrs) 
 {
  super(context, attrs);
  paint.setAntiAlias(true);
  paint.setStrokeWidth(6f);
  paint.setColor(Color.WHITE);
  paint.setStyle(Paint.Style.STROKE);
  paint.setStrokeJoin(Paint.Join.ROUND);
 }
 protected void onDraw(Canvas canvas) 
 {
  canvas.drawColor(Color.BLUE);
  canvas.drawPath(path, paint);
  
 }
 public boolean onTouchEvent(MotionEvent event) 
 {
  float eventX = event.getX();
  float eventY = event.getY();
  switch (event.getAction()) 
  {
   case MotionEvent.ACTION_DOWN:
    path.moveTo(eventX, eventY);
    return true;
   case MotionEvent.ACTION_MOVE:
    path.lineTo(eventX, eventY);
    break;
   case MotionEvent.ACTION_UP:
    // nothing to do
    break;
   default:
    return false;
  }
  // Schedules a repaint.
  invalidate();
  return true;
 }
}

Related Posts Plugin for WordPress, Blogger...