Monday, March 31, 2014

Simulate kill activity to test onSaveInstanceState onCreate

In order to test the lifecycle behaviour of our apps, we always have to leave our apps to move it to background, wait sometime for the system to kill it...and restart it.

Its a alternative to simulate "kill activity" by the Immediately destroy activities (or called Dont keep activities/Do not keep activities) selection Development Settings:

Select Developer options in Setting
Select Developer options in Setting

Select Advanced

Check Dont keep activities


According to the Android Developer document of Using the Dev Tools App:

Immediately destroy activities
Tells the system to destroy an activity as soon as it is stopped (as if Android had to reclaim memory). This is very useful for testing the onSaveInstanceState(Bundle) / onCreate(android.os.Bundle) code path, which would otherwise be difficult to force. Choosing this option will probably reveal a number of problems in your application due to not saving state. For more information about saving an activitys state, see the Activities document.


Notice: This setting for developers only, NOT for general user.



Related: The lifecycle in Activity Killed

Read More..

App in C that calculates the coordinates of an array in canonical base

The screenshot is not very relevant because I use as B1the I3 who is an orthonormal base but the coordinates of the array will be the same. I didnt have time to take another base to see the diference...
----------------------------------------------------------------------------------

main.c


1 /* App that calculates the coordinates of an array V from base B1 to canonical base B if B1 is an orthonormal base.
2 B1= base that user input
3 V= the array with coordinates in base B1
4 C= the array V with coordinates in B base
5 A= the orthogonal matrix if B1 is an orthonormal base ( transition matrix from B to B1)
6 B2=the transposed matrix A ( transition matrix from B1 to B)
7 */
8 #include <stdio.h>
9 #include<stdlib.h>
10 #include <math.h>
11 #include "def.c"
12 #include "functii.c"
13 int main()
14 {printf("Numarul de vectori si de elemente ale vectorilor din B1 este:");scanf("%d %d",&B1.lin,&B1.col);
15 printf("Nr de elemente ale vectorului este:");scanf("%d",&V.elem);
16 B2.lin=B1.lin;
17 B2.col=B1.col;
18 A.lin=B1.lin;
19 A.col=B1.col;
20 C.elem=V.elem;
21 A.matr=(double **)malloc(A.lin*sizeof(double*));
22 B1.matr=(double **)malloc(B1.lin*sizeof(double*));
23 B2.matr=(double **)malloc(B2.lin*sizeof(double*));
24 V.vector=(double *)malloc(V.elem*sizeof(double));
25 C.vector=(double *)malloc(C.elem*sizeof(double));
26 for(i=0;i<B1.lin;i++) // aloca memorie pt elem din linia i
27 if((B1.matr[i]=(double *)malloc(B1.col*sizeof(double)))==NULL || (B2.matr[i]=(double *)malloc(B2.col*sizeof(double)))==NULL || (A.matr[i]=(double *)malloc(A.col*sizeof(double)))==NULL)
28 {
29 printf("
memorie insuficienta"
);
30 exit(1) ;
31 }
32 else
33 if(V.vector==NULL || C.vector==NULL)
34 {
35 printf("
memorie insuficienta"
);
36 exit(1) ;
37 }
38 printf("Elementele bazei sunt:
"
);
39 citire_matrice(B1);
40 printf("Elementele vectorului sunt:
"
);
41 citire_vector(V);
42 printf("Baza este:
"
);
43 afisare_matrice(B1);printf("
"
);
44 printf("vectorul este:
"
);
45 afisare_vector(V);printf("
"
);
46 matrice_ortogonala(A,B1);
47 transpunere(A,B2);
48 vector_matrice(V,C,B2);
49
50 free(A.matr);
51 free(B1.matr);
52 free(B2.matr);
53 free(V.vector);
54 free(C.vector);
55 system("pause");
56 return 0;
57 }

----------------------------------------------------------------------------------

def.c


 1 typedef struct{
2 double **matr;
3 int lin;
4 int col;
5 }Matrice;
6 Matrice A,B1,B2;
7 typedef struct{
8 double *vector;
9 int elem;
10 }Array;
11 Array V,C;
12 int i,j;
13
14

----------------------------------------------------------------------------------

functii.c

 1 // citire matrice
2 void citire_matrice(Matrice A){
3 for(i=0;i<A.lin;i++)
4 for(j=0;j<A.col;j++)
5 scanf("%lf",&A.matr[j][i]);
6 }
7 //afisare matrice
8 void afisare_matrice(Matrice A){
9 for(i=0;i<A.lin;i++)
10 {for(j=0;j<A.col;j++)
11 printf(" %.2lf",A.matr[i][j]);
12 printf("

"
);
13 }
14 printf("
"
);
15 }
16
17 //test produs scalar=0
18 int produs_scalar(Matrice B){double suma=0;
19 for(i=0;i<B.lin;i++)
20 for(j=0;j<B.col;j++)
21 suma+=B.matr[i][j]*B.matr[i][j+1];
22 if(abs(suma)==0)
23 return 1;
24 else
25 return 0;
26 }
27 //test norma=1
28 int test_norma(Matrice B1){double norma=0;
29 for(i=0;i<B1.lin;i++)
30 {for(j=0;j<B1.col;j++)
31 norma+=pow(B1.matr[j][i],2);
32 if(sqrt(norma)==0)
33 return 0;
34
35 }
36 return 1;
37
38 }
39
40 //alcatuire matrice ortogonala
41 void matrice_ortogonala(Matrice A, Matrice B1){
42 if(produs_scalar(B1)==1 && test_norma(B1)==1)
43 {for(i=0;i<A.lin;i++)
44 for(j=0;j<A.col;j++)
45 A.matr[i][j]=B1.matr[i][j];
46 printf("matricea ortogonala este:
"
);
47 afisare_matrice(A);
48 }
49 else
50 printf("Matricea nu este ortogonala!");
51 }
52 // citire vector
53 void citire_vector(Array V){
54 for(i=0;i<V.elem;i++)
55 scanf("%lf",&V.vector[i]);
56 }
57 //afisare vector
58 void afisare_vector(Array V){
59 for(i=0;i<V.elem;i++)
60 printf(" %.2lf ",V.vector[i]);
61 printf("
"
);
62 }
63 //transpunere
64 void transpunere(Matrice A,Matrice B2){
65 for(i=0;i<A.lin;i++)
66 {for(j=0;j<A.col;j++)
67 B2.matr[i][j]=A.matr[j][i];
68
69 }
70 printf("
"
);
71 }
72
73
74 //coordonatele unui vector
75 void vector_matrice(Array V,Array C,Matrice B2){
76 if(V.elem!=B2.col)
77 printf("Inmultirea dintre vector si matrice nu se poate realiza!");
78 else{
79 for(i=0;i<B2.lin;i++)
80 for(j=0;j<B2.col;j++)
81 C.vector[i]+=B2.matr[i][j]*V.vector[j];
82 printf("Vectorul in noile coordonate este:");
83 afisare_vector(C);
84 }
85 }
----------------------------------------------------------------------------------
Read More..

Saturday, March 29, 2014

JDK 8 released with new Java document page

Java SE 8 released! Download it from the Java SE Downloads page.


And the Java Documentation page updated with new nice look.


Read More..

Time Picker in android


Open “res/layout/main.xml” file, add time picker, label and button for demonstration.
File : res/layout/main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
 
<Button
android:id="@+id/btnChangeTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Change Time" />
 
<TextView
android:id="@+id/lblTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Current Time (H:M): "
android:textAppearance="?android:attr/textAppearanceLarge" />
 
<TextView
android:id="@+id/tvTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:textAppearance="?android:attr/textAppearanceLarge" />
 
<TimePicker
android:id="@+id/timePicker1"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
 
</LinearLayout>


File : MyAndroidAppActivity.java



package com.mkyong.android;
 
import java.util.Calendar;
import android.app.Activity;
import android.app.Dialog;
import android.app.TimePickerDialog;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.TimePicker;
 
public class MyAndroidAppActivity extends Activity {
 
private TextView tvDisplayTime;
private TimePicker timePicker1;
private Button btnChangeTime;
 
private int hour;
private int minute;
 
static final int TIME_DIALOG_ID = 999;
 
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
 
setCurrentTimeOnView();
addListenerOnButton();
 
}
 
// display current time
public void setCurrentTimeOnView() {
 
tvDisplayTime = (TextView) findViewById(R.id.tvTime);
timePicker1 = (TimePicker) findViewById(R.id.timePicker1);
 
final Calendar c = Calendar.getInstance();
hour = c.get(Calendar.HOUR_OF_DAY);
minute = c.get(Calendar.MINUTE);
 
// set current time into textview
tvDisplayTime.setText(
new StringBuilder().append(pad(hour))
.append(":").append(pad(minute)));
 
// set current time into timepicker
timePicker1.setCurrentHour(hour);
timePicker1.setCurrentMinute(minute);
 
}
 
public void addListenerOnButton() {
 
btnChangeTime = (Button) findViewById(R.id.btnChangeTime);
 
btnChangeTime.setOnClickListener(new OnClickListener() {
 
@Override
public void onClick(View v) {
 
showDialog(TIME_DIALOG_ID);
 
}
 
});
 
}
 
@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case TIME_DIALOG_ID:
// set time picker as current time
return new TimePickerDialog(this,
timePickerListener, hour, minute,false);
 
}
return null;
}
 
private TimePickerDialog.OnTimeSetListener timePickerListener =
new TimePickerDialog.OnTimeSetListener() {
public void onTimeSet(TimePicker view, int selectedHour,
int selectedMinute) {
hour = selectedHour;
minute = selectedMinute;
 
// set current time into textview
tvDisplayTime.setText(new StringBuilder().append(pad(hour))
.append(":").append(pad(minute)));
 
// set current time into timepicker
timePicker1.setCurrentHour(hour);
timePicker1.setCurrentMinute(minute);
 
}
};
 
private static String pad(int c) {
if (c >= 10)
return String.valueOf(c);
else
return "0" + String.valueOf(c);
}
}


1. Result, “time picker” and “textview” are set to current time.


android timepicker demo1


2. Click on the “Change Time” button, it will prompt a time picker component in a dialog box via TimePickerDialog.


android timepicker demo2


3. Both “time picker” and “textview” are updated with selected time.


android timepicker demo3

Read More..

Wednesday, March 26, 2014

Dolphin Browser HD v8 5 1 Apk

dolphin browser apk

Download Dolphin Browser HD For Android

Dolphin Browser HD is the most popular browser on Android, targeting at android 2.0+ devices.
It is Powerful, Fast & Elegant.
* Powerful add-ons
* Bookmarks folder
* Multi-touch pinch zoom
* Tabbed browsing
* Gesture commander
* RSS feed Detector
* Theme pack support
* Multi-languages support
* Force close tab recovery
* And many more!

Supported languages:
Czech, Danish, German, Greek, Spanish, Spanish, French, Italian, Japanese, Korean, Norwegian Bokmål, Dutch, Polish, Portuguese, Russian, Swedish, Turkish, Chinese.

Download Dolphin Browser HD v8.5.1 Apk
download now

Read More..

Tuesday, March 25, 2014

Robotek 2 03 v2 03 Android Apk Game



The humanity had fallen. In the great robot uprising machines took the planet over. Empire of Machine is the new world order. Its time to take it back! One node at a time.

Rip through your enemies with lasers, electrocute them or fry them with microwaves. Deploy your own robots to fight for you or steal them from your enemy. Protect and upgrade your forces or throw them away in a ruthless wave of destruction.
Get experience from every battle, level up, gain power and crush the Empire of Machine!

FEATURES
• Unique blend of strategy, action and RPG.
• More than 200 levels spread all around the world.
• Rewarding skill system with more than 30 levels.
• 9 upgradable slot symbols to fit your own style of play.
• 4 special abilities including the devastating Nuke.
• Play thrilling hotseat duels with your friends!
• Online hall of fame - Your scores can only grow.
• Facebook leaderboards - compete with your friends!
• Signature soundtrack by kubatko (http://www.kubatko.info)

SOCIAL FEATURES
• Facebook Single Sign-On support
• Compete on your Facebook leaderboard
• Invite or challenge your Facebook friends
• Share your achievements on your Facebook wall

Whats in this version:
2.0
FREE online MULTIPLAYER mode
DUEL can be played over internet with private groups
animated emoticons for network duels (premium feature)
2.0.3
fixed Honeycomb networking (multiplayer and duel)

Download Instructions:
http://www.filesonic.com/file/1697207231

Mirror:
http://www.wupload.com/file/109679642
http://www.multiupload.com/NG54Q83D9E

Newer PostOlder PostHome0 Responses For : Leave a Reply

Search This BlogLoading... #uds-searchControl .gs-result .gs-title, #uds-searchControl .gs-result .gs-title
Read More..

CamGun Camera Call of Duty 2 21 v2 21 Android Apk App

CamGun (Camera Call of Duty) v2.21
Requirements: Android OS 1.5+
Overview: CamGun is a fun way to use the camera on your phone like a first person shooter - Call of Duty style.

Shoot your friends like an agent with a fully automatic M4 or a SPAS12 and post it on Facebook. Also includes the SOCOM Mark23 a blue Light Saber (star wars), a MiniGun, a GRENADE EASTER EGG and a SR25 sniper rifle with a THERMAL SCOPE -- Headshot!
Start by tapping the gun icon in the upper left corner -- this chooses the gun and it will appear on the screen. Then, tap the screen to fire. Tap the crosshairs icon to sight the gun. You can cycle through the guns any time. Press the camera icon to take a photo vignette of your kill. Simple, but very fun!!! Press the menu button for optional settings for blood, shooter name and target name to be included in the photo. Also records GPS position for Geotagging. Great tool for Humans VS Zombies or other assassin like games. Use foursquare or Google Latititude to find your target and document the shot. Lots of camera fun like picsay except with weapons. Has not been tested on all phones. Photos are stored on the SD card root directory.
Whats in this version:
MAJOR UPGRADE-- Added M249 Light Machine Gun (SAW)
Added Paintball Gun! SPLAT!
Fixed "half-screen" issue on phones with Gingerbread by putting the title-bar back in
ADDED TACTICAL KNIFE!
Added full auto to AK74u
Added a CROSSBOW!!!! BOOYAH! (updated the sound)
Added special Ak74u with a red dot sight and Tiger Camo!!!
Cleaned up light saber and minigun graphics
Allow for moving to SD card.
Longpress on M23 Pistol for DUAL WIELDING
Longpress light saber for double bladed red saber!
Download Instructions:
http://www.filesonic.com/file/1727888084
Mirror:
http://www.wupload.com/file/115437503
http://www.multiupload.com/9PNORPFSK7
Read More..

Monday, March 24, 2014

SportsTracker Pro 3 4 Full APK


SportsTracker Pro 3.4 Full APK.  Share, compare, train and compete in your sport on http://sportstracklive.com. Monitoring of live sporting events from your phone http://sportstracklive.com Superior GPS sports tracking Android application. Running, cycling, mountain biking, skiing, snowboarding, sailing, mountain biking, flying, gliding. The best application of the functions to record your GPS track and monitor your performance and cardio fitness.


Read More..

Gun Bros v1 2 Android Games apk

Play Gun Bros v1.2 Android Games apk on android phone, then you become part of the game is very popular. You will find the New Zombie Planet once can add your facebook friends as a brotherhood that will help you and protect you and destroy the enemy T.O.O.L. There are still many secrets to be revealed with the plays you Gun Bros v1.2 Android Games apk.





Gun Bros v1.2 Android Games apk



Features of Gun Bros v1.2 Android Games apk:

NEW ZOMBIE PLANET - BOKOR!
Infested with all new ZOMBIE T.O.O.L. enemies! Included with an all new SURVIVAL MODE!
OPEN FEINT & FACEBOOK ENABLED!
Form your own Brotherhood: Add your Facebook friends to form your brotherhood- your brothers will help protect you and destroy the T.O.O.L enemies. Every time a friend uses your Brother, you gain valuable experience to help your progress, even if you’re not currently in the game!
HIGH END 3D GRAPHICS
Non-stop 3D Action shooter: The waves of T.O.O.L enemies just keep on coming and you and your brother need to have some serious out-of-this-world shooting skills to take those repugnant space bullies down!
PERFECT WAVE
Complete a wave without taking any damage to receive an explodium bonus for that wave. No pain, you gain!
WEAPON MASTERY
Get ready to become a true master of your awesome weapons. Earn up to a gold ranking for every weapon and get bonus XP each time you increase your weapon’s mastery rank
BROTHERHOOD AUTO-SWITCH
Want to get the most brotherhood rewards? Brotherhood auto-switch allows you to automatically use brothers in combat that will earn you a daily reward for playing!
THE BROS LIKE BIG GUNS
Tons of insanely powerful Guns, Armor and other explosive power-ups to get your hands on in the F.R.A.G.G.E.D Armory.


If you looking for Gun Bros v1.2 Android Games apk, you can go to the source download this apps via the link below.


All information in this blog based on information available at the official website or from other unofficial websites that discuss applications, games, software, themes and manuals for Android.

freedownloadandroidapps.blogspot.com not responsible for the changes, losses, damages or any matter relating to the use of a variety of applications, games, software, themes and manuals that the information contained in this blog.

freedownloadandroidapps.blogspot.com not received any complaints and free from any claims of any party upon the information contained in this blog.
Read More..