Solutions

Solutions for different problems, might not contain code

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”);

, , , ,
Solutions, Tutorials

Android AdMob Banner XML

In the preview tutorial I explained how to add AdMob to your project, but we created the AdView in Java. So in this tutorial I will show you how to set it up in XML. Actually it’s more simple this way, at least in my opinion :) 1. Create a new project (or use an

, ,
Solutions, Tutorials

How to Add AdMob to Android [Deprecated]

NOTE 1: This tutorial is now deprecated. See this one instead! NOTE 2:  This project is made in Intellij. For those who use Eclipse or other IDE the integration of AdMob library will differ. You can use AdMob lib only on at least Android v3.2 (Api Level 13), so you must compile your project on

, ,
Solutions, Tutorials

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

, ,
Solutions, Tutorials

Android SQLite Ignore Case from Database

If you want to select data from Database and you want to ignore the case of letters you should use COLLATE NOCASE in your query: “SELECT * FROM  myDataBaseName WHERE some_column= some_value COLLATE NOCASE” It’s not exactly an android issue but you might need some day in your android projects, so I hope it helps

, , ,
Solutions, Tutorials

Run Android Lint from command line

Not many of us use android Lint tool to scan the projects for possible performance or best practices tips. Eclipse has the Lint tool included into adt plugin so Eclipse users can take advantages of this. Ok but what about developers that use intellij IDEA or other IDE for android projects? The answer is simple,

, ,
Solutions, Tutorials

Android How to put markers/pins on the map

We’ve already explained how to make an application with a map here. So, now we will try to put markers or pins (or however are they called) on the map, by knowing the Latitude and Longitude, in case you will ever need it and someday you will :) . So lets start: 1. After you

, ,
Snippets, Solutions

Android: PreferenceActivity Custom Title

If you want to make a custom title in a class that extends PreferenceActivity you must put requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); BEFORE super.onCreate(savedInstanceState); Otherwise you will get a Force Close

Solutions

Android PreferenceScreen

If you encounter this problem: “CheckBoxPreference is not allowed here” or other preference tag and your xml file is all red is because you create the xml in res/layout and you must create it in res/xml. So you have to make a new directory in res called “xml” and this is where your preferences xml

,
Snippets, Solutions

Android: Scrolling to the bottom of a ScrollView

Iv’e had a lot of trouble scrolling a ScrollView all the way to the bottom in android and I finally got the way to do it ! Here is the code: scrollView.post(new Runnable() { public void run() { scrollView.fullScroll(View.FOCUS_DOWN); } }); Hope it helps somebody !

,
Solutions, Tutorials

How to import an Intellij project in android after you reinstalled your Intellij

If it happened to reinstall your Intelij and you don’t remember how to import your android projects maybe this post will help you, even a little at least. So, lets begin. Step 1: Press CTRL+SHIFT+ALT+S and the Project Structure window will open. On the left click on the project and then press the new button

,
Scroll to Top