Author name: Catalin Prata

Born in Alba Iulia, a beautiful city from Romania. I like hiking and everything related with electronics and IT . Eager to learn and enhance my knowledge in programming languages. My main specialization is on Mobile Applications development (Android and iOS).

Snippets, Solutions

Android HttpResponse content(body) to String

Usually I use the following code to convert a Http response content to String:   BufferedReader in = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); StringBuilder responseBuilder = new StringBuilder(); String line = “”; while ((line = in.readLine()) != null) { responseBuilder.append(line); } in.close(); Log.e(“WS RESPONSE”, responseBuilder.toString()); It is not a bad idea but I found over the internet that

, , , ,
Snippets

Set the application icon

To set the application icon in Android you have to open the project’s Manifest.xml file and add the following attribute to the application tag: <application android:icon=”drawable resource”> Before you do that make sure you add the icon image in one of your drawable directories.. If you called your icon: app_icon.png then the application tag should look

, ,
Snippets, Solutions

Add image to email intent in Android

How to add image to an email intent in Android: // build a email sending intent Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); emailIntent.setType(“image/png”); // set the email subject emailIntent.putExtra(Intent.EXTRA_SUBJECT, “email subject”); // set the email image path for the attachment emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(“file://” + mEmailImagePath)); // set the body of the email emailIntent.putExtra(Intent.EXTRA_TEXT, “some text message”);

, , , ,
Tutorial

Android simple splash screen

Hi, I have seen that many android starters have problems in implementing their own splash screen in Android (as I had once).UPDATE: As Rafael noticed me, there is also an improvement to be made on the splash screen and this is when the user presses the back button on the splash screen, we should avoid

,
Solutions, Tutorial

Android SSL self signed certificate pass by

This is not my work, I have just found the solution some time ago on the internetUsing the class below you can pass by the ssl certificate error that Android may throw when you are trying to connect to a self signed certified server:First the EasySSLSocketFactory class : import java.io.IOException; import java.net.Socket; import java.net.UnknownHostException; import java.security.KeyManagementException; import

, ,
Snippets, Tutorial

Android How To Make an AlertDialog

To make an AlertDialog you have to write this code: AlertDialog.Builder alertDelete = new AlertDialog.Builder(ListsActivity.this); //HERE YOU WILL WRITE THE MESSAGE YOU WANT alertDelete.setMessage(R.string.delete_confirm); //HERE IS THE POSITIVE BUTTON. YOU HAVE TO SET THE BUTTON NAME AND A CLICK LISTENER alertDelete.setPositiveButton(getString(R.string.yes),new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { //YOUR ACTION } });

sponsored
Exit mobile version