Showing posts with label android. Show all posts
Showing posts with label android. Show all posts

How to update WiFi state using BroadcastReceiver

This BroadcastReceiver will trigger anytime "Mobile data" disconnects or connects.
public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
TextView wifistate = (TextView) findViewById(R.id.infowifi);
this.registerReceiver(mWifiStateChangedReceiver,new IntentFilter(WifiManager.WIFI_STATE_CHANGED_ACTION));
}


@Override
public void onBackPressed() {
    
    unregisterReceiver(mWifiStateChangedReceiver); // this will unregister Receiver
    this.finish(); // this will finish ThisActivity
    super.onBackPressed();
}
private BroadcastReceiver mWifiStateChangedReceiver 

How to update "Mobile data" state using a BroadcastReceiver

This BroadcastReceiver will trigger anytime "Mobile data" disconnects or connects.
public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

this.registerReceiver(mDATAStateChangedReceiver,new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
}


@Override
public void onBackPressed() {
    
    unregisterReceiver(mDATAStateChangedReceiver); // this will unregister Receiver
    this.finish(); // this will finish ThisActivity
    super.onBackPressed();
}
private BroadcastReceiver mDATAStateChangedReceiver

How to flash a new ROM on Samsung Galaxy S4 SPH-L720T

In this tutorial you will learn how to Flash a new Firmware on Samsung SPH-L720T or Galaxy S4 .

Note, that this tutorial will work on other devices too, but you wouldn't find the Firmware in this tutorial, so before starting ask Google for you Firmware.

Watch the Video tutorial from bottom of the article or read the Written tutorial.
1. Install USB driver for Samsung SPH-L720T on your computer.
Download Samsung Galaxy S4 driver here
P.S. The drivers that Windows automatically installed doesn't fit our requirements, so you better install those from the link above.

2. Activate USB Debugging from Settings > Developer options > USB debugging, if you don't find Developer options under the System tab, you need to activate it.

How to activate Developer options on Samsung

How to flash ROM on Mediatek Tablets

In this tutorial you will learn how to flash a new Firmware on and not only:
- Samsung N9106
- Samsung N9106 - HD
- Jlinksz D-101BA
- D101
- Rover Pad 10.1 Tesla
- Moze
- Lenovo A101
- Lenovo S6000D
- Samsung & Lenovo T950s
- Samsung & Lenovo i960

Researching i found that all traces lead to this manufacturer Jlinksz, so they are producing this tablets and some intermediaries just print the Samsung/Lenovo or other brand logo on it and organizes the selling.
Tablets are based on different circuit boards, the

How to flash a new Firmware on Samsung SM-G313HU Galaxy S 3 Duos

In this tutorial you will learn how to Flash a new Firmware on Samsung SM-G313HU or Galaxy S 3 Duos.
Note, that this tutorial will work on other devices too, but you wouldn't find the Firmware in this tutorial, so before starting ask Google for you Firmware.

Watch the Video tutorial from bottom of the article or read the Written tutorial.
1. Install USB driver for Samsung SM-G313HU on your computer.
Download SM-G313HU driver here

2. Activate USB Debugging from Settings > Developer options > USB debugging, if you don't find Developer options under the System tab, you need to activate it.

How to activate Developer options on Samsung

How to indicate JAVA_HOME variable [error]



Watch video tutorial or check the written tutorial below the video.


1. Navigate to C:/Program Files/Java
Look for any JDK folders and find the last version if you don't have any of them then Download and install from Java official website HERE

2. On your Desktop, right-click on My Computer and open Properties
From the left side choose Advanced system settings

3. At the bottom of the window, press the Environment variables button.
Now we got to add the variable in the both: User and System variable

How to better support multiple screen size


In this tutorial i will show you how to make your apps to feet better on more device’s screens. Usually our projects are based on 4 layouts:
  • Layout-small (0dp to 470dp)
  • Layout-normal (471dp to 640dp)
  • Layout-large (641dp to 960dp)
  • Layout-xlarge (961dp and bigger)

Now i will show you a more specific way of fitting device screens based on „dp” and the newest information about the screen size of the manufactured

How to navigate to another Activity (screen)


In this tutorial you'll learn how to navigate from Activity1 to Activity2 using a button.

1. Create 2 activities. (MainActivity & SecondActivity)
2. In the first Activity layout create a button.
3. In MainActivity.java add below bold codes:

public class MainActivity extends Activity implements OnClickListener {

Button next;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

next = (Button) findViewById(R.id.button1);
next.setOnClickListener(this);

How to Boost Android App Installs through Facebook

     Its psychologically demonstrated that if a man walking on a street sees a bunch of people waiting in a line for something, he will necessarily try to find out what awaits them there. From this premise starts the idea that, if an app was already installed and reviewed, other people will look more confident to it and will give it a try.

How to create an Ad on Facebook

Below the video, find a written Step by Step tutorial
1. Copy the link of the App you want to Boost installs

2. Login to your Facebook account

3. From the drop down menu in the right-top corner, choose Create Ads button.

ERROR: In MenuView, unable to find attribute android:preserveIconSpacing

I got this error in Eclipse, and fixed it by changing the API level of the APP from Android 5.1.1 to Android 5.0

How to change API level
Right-lick on the project
Open Properties > Android
Change the API level to an older one.

How to Override Menu Button

You can override the default behavior of system key presses by intercepting them in your Activity. This is done by overriding the onKeyDown event, and returning true if you want to prevent the key from being handled by the system.
The code for your case should look something as follows:

@Override 
public boolean onKeyDown(int keyCode, KeyEvent event) { 
     if ( keyCode == KeyEvent.KEYCODE_MENU ) {

     //Put the code for an action here

     return true;  
  } 

How to write & " ' < > in XML documents - escape characters

Text consists of intermingled character data and markup. In XML documents some characters are used for start-tags, end-tags, entity references, XML declarations and others. This means that if you'll want to use some of those characters in a text writing you'll get errors.

If you want to use these characters in XML documents then you'll need to replace/escape them using numeric character references or using strings.

String replaces:

     "         &quot; 
     '         &apos; 
     <         &lt;   

[Solved] java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity

Recently Android SDK released a new update, and when you create a new application it automaticaly imports a library named Appcompat, when you try to compile and run the App you get this error in LogCat

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.txt2lrn.www/com.txt2lrn.www.LandingActivity}:
 java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
 at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
 at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
 at android.app.ActivityThread.access$1500(ActivityThread.java:117)
 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
 at android.os.Handler.dispatchMessage(Handler.java:99)
 at android.os.Looper.loop(Looper.java:130)
 at android.app.ActivityThread.main(ActivityThread.java:3687)
 at java.lang.reflect.Method.invokeNative(Native Method)
 at java.lang.reflect.Method.invoke(Method.java:507)

(Android) MediaPlayer errors [will update when find others]

java.lang.IllegalStateException in MediaPlayer.isplaying() - the internal player engine has not been initialized or has been released  make sure that you have initialized and/or have not released the player before trying to stop the music.

java.io.IOException: setDataSourceFD failed - seems like the music file is encoded in a strange format for MediaPlayer so just try converting it to OGG format. or you have too much music files and the device can't work them out, converting in a low memory using format save'd me.

IllegalStateException thrown while calling reset()
at android.media.MediaPlayer._reset(Native Method) - 
calling reset() after release() will throw an illegalstateexception, documentation says: When a MediaPlayer object is just created using new or after reset() is called, it is in the Idle state; and after release() is called, it is in the End state. Between these two states is the life cycle of the MediaPlayer object.

Cum facem animații în Android SDK? (ECLIPSE)

Adăugarea animațiilor în interfața aplicației crește șansa ca utilizatorii să o îndrăgească și mai mult, acestea sugerînd o impresie de calitate și o diferențiere de alte sute de aplicații.
Crearea unei animații este defapt foarte simplă, avem nevoie doar de puține bucăți de cod și crearea cîtorva fișiere XML. (utilizînd Eclipse)

Animații GIF

1. Creăm un fișier XML în dosarul drawable. (ex: animation1.xml)
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:oneshot="false">
    <item android:drawable="@drawable/r1" android:duration="120" />

Colecţie - Babe din Zăpadă [creative]

    Pentru că standart-ul e standart şi nu mai e la modă, propun pentru imaginaţia voastră o colecţie de Babe din Zăpadă, adunate din diferite colţuri ale lumii. Ca să vă pregătiţi din timp pentru noul Weekend.

Snoopy

Lego

Om de Zăpadă cu Fundu'

TAXI-urile trec pe Android!

   Nu mai este o noutate pentru nimeni că internetul este viitorul şi în viitor vom face aproape totul cu ajutorul lui.
   Taxi 14222, pe lîngă faptul că este una dintre companiile care prestează servicii la preţuri cît de cît mai mici, acum va fi şi una dintre companiile care trece de la predarea comenzilor prin unde radio la predarea lor prin internet. Acestea vor fi recepţionate pe o aplicaţie din orice Gadget cu sistemul de operare Android instalat în maşina de Taxi. 
   Astfel comenzile vor fi preluate mai rapid şi clienţii vor merge mai în linişte spre destinaţie.