Posts

Showing posts from 2014

Creating Simple Horizontal graph in android using android Weight property without any External Libraries

Image
Hi Coders , This a simple example for how to make simple graph in android without using any external library this a small part of the my xml file wich is used make the graph part,Hope you guys can do the rest.. the out put of the graph is given at the bottom.. Initially i set the weight of each text view to 50 dp this my java code  friend there might me some extra codes because its part of my project, so i cant show the entire project ...  The libary name Ion is used for getting the json data from the web,and according to that value graph is set TextView c1gtexy=(TextView )FindViewById(R.id.country1_bar); TextView c2gtexy=(TextView )FindViewById(R.id.country2_bar); TextView c1gtexy=(TextView )FindViewById(R.id.country1_bar); TextView c2gtexy=(TextView )FindViewById(R.id.country2_bar); public void getPredictions() { if (new NetworkData().isNetworkAvailable(this)) { Ion.with(getApplicationContext())

Reading and Writing data from Android Device's storage using java

Hello guys  In this blog im going to explain how to read and write data from and to an android device's storage using java Step 1: Create An Android Project Step 2: Add the following permissions :  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> Step 3: I used the following codes for Reading as well as Writing for writing: What i have done  is create a folder is the folder doesn't exists and create a file what i have to read if the file doesn't exit. if the above part is clear then you are ready to write. public void writeFile() { final File dir = new File(Environment.getExternalStorageDirectory() .getPath() + "/Android/data/" + getPackageName() + "/"); //first method for specifying the directory structure try { try { if (!dir.exists()) { dir