Showing posts with label Android. Show all posts
Showing posts with label Android. Show all posts

Wednesday, 23 November 2011

Progress Dialog


import android.app.Activity;

import android.app.ProgressDialog;

import android.content.pm.ActivityInfo;

import android.os.Bundle;


public class ProgressDialogActivity extends Activity {

/** Called when the activity is first created. */

ProgressDialog pro;

@Override

public void onCreate(Bundle savedInstanceState)

{

super.onCreate(savedInstanceState);

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_USER);

setContentView(R.layout.main);

pro=new ProgressDialog(this);

pro.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);

pro.setMax(300);

pro.setCancelable(true);

pro.setMessage("Loading data..");

pro.show();

Threadex t=new Threadex();

t.start(); //start thread

}//This is Oncreate method

class Threadex extends Thread

{


public void run()

{

for(int i=10;i<=pro.getMax();i=i+10)

{

pro.incrementProgressBy(10);

try

{

sleep(1000); //sleep for 1 seconds

}

catch(Exception e)

{

e.printStackTrace();

}

} //this is for loop ends

pro.dismiss();

} //this is end of Run

}//This is End of Threadex

} //This is End of Activity


Here Update the 10 distance continues Upto 300 distance because we have set 300 distance as max .




This is after the Dismiss the ProgressDialog





This is for ProgressDialog.STYLE_HORIZONTAL.

we can set Another Style ProgressDialog.STYLE_SPINNER but view is different

Monday, 14 November 2011

Getting SMS in your Activity

import android.app.Activity;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.widget.TextView;

public class SMSActivity extends Activity
{
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView textview = new TextView(this);
Uri url = Uri.parse("content://sms/inbox");
Cursor cursor = getContentResolver().query(url, null, null, null,null);
String smsdisplay = "";
while (cursor.moveToNext()) {
smsdisplay += "From :" + cursor.getString(2) + " : " + cursor.getString(11)+"\n";
}
textview.setText(smsdisplay);
setContentView(textview);
}
}

in the AndroidManifest.xml

android.permission.READ_SMS

Gives this Permission for Reading SMS in your activity.




Friday, 8 July 2011

How to decompile Android application to get sourcecode

Hi Friends,
reverse engineering is everywhere. but reverse engineering is meant for  code review of  vulnerable application. so I hope you guys will not  use this reverse engineering  tricks to do any illegal things.
all android application are running  on Dalvik , which is a Virtual Machine having register-base  architecture and different from Java Virtual Machine by sun-microsystem (and now by oracle ) which is stack machine.
hence all android application is consist of Dalvik Executable (.dex).  hence to convert those  android application( *.apk) to source code we have to follow below steps

(Note : apk is packing of  .dex  file and other resources.)

step to decompile

1) convert  .dex file format to  .class file
2) convert  .class file format to  java code file

1) android application will come with .apk file format. which contains  .dex file .
hence  to convert .dex file in to .class file ( and those compress .class files  are placed in .jar file)
one need to have .dex  to  .class file converter .(both are binary format)
you can download such  tool from below link.


 after downloading you need to extract them and it will have following files in you  file system.




















Tuesday, 28 June 2011

Create Android Apps For Your Favorite Websites In Just A Few Clicks!


Disappointed that your favorite website does not have a mobile web variant? Looking for a way to create an app for your own website without having to learn how to code? Look no further. AppYet is a web service that allows you to create, in just a few clicks, reasonably feature-rich and presentable Android RSS feed readers for websites of your choice.


Saturday, 25 June 2011

Customized Android ROM Build


Dear Friends,
Android is booming in mobile market now days. And you will find varieties of mobile device with android OS. Moreover it is open source OS, so one can customize this Android OS for targeting any OEM’s device. By customizing the Android, one can add or subtract some features to OS which may not be provided or disable by OEM of that particular mobile device.

Monday, 20 June 2011

Prepare Android Development Enviroment

Hi friends,
Google Android is booming platform on mobile and table device..,so,  many armature or beginner programmer need to know that how to setup a android development enviroment(ADE)  for that. 

Best part of Android is that, one can  setup ADE on any platform like Window, Mac or Linux or Unix. For ADE  following  chain toolkit are required