Post has attachment
Android Application Size really matters when going live to the play store. There are few approaches which you can use to reduce apk size without impacting the quality of your app.

These are small things and I am sure it won’t take much of your time to implement. But, in the end, you would end with a leaner app size and definitely a smile on your face.

#android #developer_android #reduce_size #apk #size #android_developer

http://www.androidtutorialshub.com/how-to-reduce-android-apk-size/

Post has attachment
My SharedPreferences is not working as I am expecting it to do,

I want to show input text in edittext to textview even after exit

Please help

Code:

import android.app.;
import android.os.;
import android.content.;
import android.view.;
import android.widget.;
import android.text.;

public class MainActivity extends Activity
{
TextView subah;
TextView fajr;
TextView tulu;
TextView chaasht;
TextView zawaal;
TextView zuhr;
TextView jumaa;
TextView asr;
TextView ghuroob;
TextView maghrib;
TextView isha;

EditText subahTime;
EditText fajrTime;
EditText tuluTime;
EditText chaashtTime;
EditText zawaalTime;
EditText zuhrTime;
EditText jumaaTime;
EditText asrTime;
EditText ghuroobTime;
EditText maghribTime;
EditText ishaTime;

Button UpdateNew;
Button UpdateThis;

public static final String myPreference = "myPrefs";
public static final String subahString = "subahKey";
public static final String fajrString = "fajrKey";
public static final String tuluString = "tuluKey";
public static final String chaashtString = "chaashtKey";
public static final String zawaalString = "zawaalKey";
public static final String zuhrString = "zuhrKey";
public static final String jumaaString = "jumaaKey";
public static final String asrString = "asrKey";
public static final String ghuroobString = "ghuroobKey";
public static final String maghribString = "maghribKey";
public static final String ishaString = "ishaKey";

SharedPreferences sharedPreference;

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

subah = (TextView) findViewById(R.id.subahSadiq);
fajr = (TextView) findViewById(R.id.Fajr);
tulu = (TextView) findViewById(R.id.tulu);
chaasht = (TextView) findViewById(R.id.Chaasht);
zawaal = (TextView) findViewById(R.id.Zawaal);
zuhr = (TextView) findViewById(R.id.Zuhr);
jumaa = (TextView) findViewById(R.id.Jumaa);
asr = (TextView) findViewById(R.id.Asr);
ghuroob = (TextView) findViewById(R.id.Ghuroob);
maghrib = (TextView) findViewById(R.id.Maghrib);
isha = (TextView) findViewById(R.id.Isha);

subahTime = (EditText) findViewById(R.id.subah_edit);
fajrTime = (EditText) findViewById(R.id.fajr_edit);
tuluTime = (EditText) findViewById(R.id.tulu_edit);
chaashtTime = (EditText) findViewById(R.id.chaasht_edit);
zawaalTime = (EditText) findViewById(R.id.zawaal_edit);
zuhrTime = (EditText) findViewById(R.id.zuhr_edit);
jumaaTime = (EditText) findViewById(R.id.jumaa_edit);
asrTime = (EditText) findViewById(R.id.asr_edit);
ghuroobTime = (EditText) findViewById(R.id.ghuroob_edit);
maghribTime = (EditText) findViewById(R.id.maghrib_edit);
ishaTime = (EditText) findViewById(R.id.isha_edit);

UpdateNew = (Button) findViewById(R.id.updateNew);
UpdateThis = (Button) findViewById(R.id.updateThis);

sharedPreference = getSharedPreferences(myPreference, Context.MODE_PRIVATE);

UpdateThis.setOnClickListener(new View.OnClickListener(){
public void onClick(View v)
{
subah.setVisibility(View.GONE);
fajr.setVisibility(View.GONE);
tulu.setVisibility(View.GONE);
chaasht.setVisibility(View.GONE);
zawaal.setVisibility(View.GONE);
zuhr.setVisibility(View.GONE);
jumaa.setVisibility(View.GONE);
asr.setVisibility(View.GONE);
ghuroob.setVisibility(View.GONE);
maghrib.setVisibility(View.GONE);
isha.setVisibility(View.GONE);

subahTime.setVisibility(View.VISIBLE);
fajrTime.setVisibility(View.VISIBLE);
tuluTime.setVisibility(View.VISIBLE);
chaashtTime.setVisibility(View.VISIBLE);
zawaalTime.setVisibility(View.VISIBLE);
zuhrTime.setVisibility(View.VISIBLE);
jumaaTime.setVisibility(View.VISIBLE);
asrTime.setVisibility(View.VISIBLE);
ghuroobTime.setVisibility(View.VISIBLE);
maghribTime.setVisibility(View.VISIBLE);
ishaTime.setVisibility(View.VISIBLE);

UpdateNew.setVisibility(View.VISIBLE);
UpdateThis.setVisibility(View.GONE);

//This Button is Visible On The Main Screen, Until it is Pressed
}
});

UpdateNew.setOnClickListener(new View.OnClickListener(){
public void onClick(View v)
{

String subahNew = subahTime.getText().toString();
if(TextUtils.isEmpty(subahNew)){
subahTime.setError("Time Field is Empty");
}
else{
String fajrNew = fajrTime.getText().toString();
if(TextUtils.isEmpty(fajrNew)){
fajrTime.setError("Time Field is Blank");
}
else{

String tuluNew = tuluTime.getText().toString();
if(TextUtils.isEmpty(tuluNew)){
tuluTime.setError("Time Field is Blank");
}
else{

String chaashtNew = chaashtTime.getText().toString();
if(TextUtils.isEmpty(chaashtNew)){
chaashtTime.setError("Time Field is Blank");
}
else{

String zawaalNew = zawaalTime.getText().toString();
if(TextUtils.isEmpty(zawaalNew)){
zawaalTime.setError("Time Field is Blank");
}
else{

String zuhrNew = zuhrTime.getText().toString();
if(TextUtils.isEmpty(zuhrNew)){
zuhrTime.setError("Time Field is Blank");
}
else{

String jumaaNew = jumaaTime.getText().toString();
if(TextUtils.isEmpty(jumaaNew)){
jumaaTime.setError("Time Field is Blank");
}
else{

String asrNew = asrTime.getText().toString();
if(TextUtils.isEmpty(asrNew)){
asrTime.setError("Time Field is Blank");
}
else{

String ghuroobNew = ghuroobTime.getText().toString();
if(TextUtils.isEmpty(ghuroobNew)){
ghuroobTime.setError("Time Field is Blank");
}
else{

String maghribNew = maghribTime.getText().toString();
if(TextUtils.isEmpty(maghribNew)){
maghribTime.setError("Time Field is Blank");
}
else{

String ishaNew = ishaTime.getText().toString();
if(TextUtils.isEmpty(ishaNew)){
ishaTime.setError("Time Field is Blank");
}
else{

subah.setVisibility(View.VISIBLE);
fajr.setVisibility(View.VISIBLE);
tulu.setVisibility(View.VISIBLE);
chaasht.setVisibility(View.VISIBLE);
zawaal.setVisibility(View.VISIBLE);
zuhr.setVisibility(View.VISIBLE);
jumaa.setVisibility(View.VISIBLE);
asr.setVisibility(View.VISIBLE);
ghuroob.setVisibility(View.VISIBLE);
maghrib.setVisibility(View.VISIBLE);
isha.setVisibility(View.VISIBLE);

subahTime.setVisibility(View.GONE);
fajrTime.setVisibility(View.GONE);
tuluTime.setVisibility(View.GONE);
chaashtTime.setVisibility(View.GONE);
zawaalTime.setVisibility(View.GONE);
zuhrTime.setVisibility(View.GONE);
jumaaTime.setVisibility(View.GONE);
asrTime.setVisibility(View.GONE);
ghuroobTime.setVisibility(View.GONE);
maghribTime.setVisibility(View.GONE);
ishaTime.setVisibility(View.GONE);

UpdateThis.setVisibility(View.VISIBLE);
UpdateNew.setVisibility(View.GONE);

subah.setText("Subah Sadiq : " + subahNew + " am");
fajr.setText("Fajr : " + fajrNew + " am");
tulu.setText("Tulu : " + tuluNew + " am");
chaasht.setText("Chaasht : " + chaashtNew + " am");
zawaal.setText("Zawaal : " + zawaalNew + " pm");
zuhr.setText("Zuhr : " + zuhrNew + " pm");
jumaa.setText("Jumaa : " + jumaaNew + " pm");
asr.setText("Asr : " + asrNew + " pm");
ghuroob.setText("Ghuroob : " + ghuroobNew + " pm");
maghrib.setText("Maghrib : " + maghribNew + " pm");
isha.setText("Isha : " + ishaNew + " pm");

SharedPreferences.Editor editor = sharedPreference.edit();

editor.putString(subahString, subahNew);
editor.putString(fajrString, fajrNew);
editor.putString(tuluString, tuluNew);
editor.putString(chaashtString, chaashtNew);
editor.putString(zawaalString, zawaalNew);
editor.putString(zuhrString, zuhrNew);
editor.putString(jumaaString, jumaaNew);
editor.putString(asrString, asrNew);
editor.putString(ghuroobString, ghuroobNew);
editor.putString(maghribString, maghribNew);
editor.putString(ishaString, ishaNew);
editor.commit();

Toast.makeText(getApplicationContext(), "Times Updated", Toast.LENGTH_SHORT).show();

}
}}}}}}}}}}

/*
subah.setText("Subah Sadiq : " + subahNew + " am");
fajr.setText("Fajr : " + fajrNew + " am");
tulu.setText("Tulu : " + tuluNew + " am");
chaasht.setText("Chaasht : " + chaashtNew + " am");
zawaal.setText("Zawaal : " + zawaalNew + " pm");
zuhr.setText("Zuhr : " + zuhrNew + " pm");
jumaa.setText("Jumaa : " + jumaaNew + " pm");
asr.setText("Asr : " + asrNew + " pm");
ghuroob.setText("Ghuroob : " + ghuroobNew + " pm");
maghrib.setText("Maghrib : " + maghribNew + " pm");
isha.setText("Isha : " + ishaNew + " pm");
*/


//This Button is Visibel When Main Screen Button is Pressed

}
});
}
}

How to save the data to textView

I am using shared preferences object

I have added 11 Textviews
With 1 button

With this first button user will enter input timing

When the button is pressed all text views are hidden and 11 EditText with 1 button is shown

Each EditText are used with Textutils to check if user missed or didn't enter in any of the field.

When this second button is pressed the time is updated with a toast

But when I exit the application and restart, it shows the default value I have given it before, not the updated one,

Even I have used shared preference,

May be I am not utilizing the shared preferences object correctly,

(The code with snap is above)

Please help

Thanx
Photo
Photo
16/05/2016
2 Photos - View album

Post has attachment

How To Make Auto Redial App in Android

Pls Help

Post has attachment
Learn how to gain the best of your #Android app for your business, with #AndroidATC Monetize course goo.gl/9UQTbk
Photo

Post has attachment
Get an app which can help to find out the locations? . Browse @

Post has attachment
Feeling tired… Want to get fresh… 
Well here’s a game that will refresh and energize your tired brain… Its SMACK THAT PUMPKIN…!!! 
Yeah… That’s right… Smack it till you get it…

https://play.google.com/store/apps/details?id=com.satistrum.smackthatpumpkin

Post has attachment
sWallet is a simple secure application that allows you to safely store all your sensitive data such as: bank account details and passwords on your phone. sWallet is also useful for remembering all those bits and pieces of information in one place that are difficult to remember otherwise. Download it here
https://play.google.com/store/apps/details?id=com.satistrum.swallet

Post has attachment
Feeling tired… Want to get fresh… 
Well here’s a game that will refresh and energize your tired brain… Its SMACK THAT PUMPKIN…!!! 
Yeah… That’s right… Smack it till you get it…

https://play.google.com/store/apps/details?id=com.satistrum.smackthatpumpkin

Post has attachment
sWallet is a simple secure application that allows you to safely store all your sensitive data such as: bank account details and passwords on your phone. sWallet is also useful for remembering all those bits and pieces of information in one place that are difficult to remember otherwise. Download it here
https://play.google.com/store/apps/details?id=com.satistrum.swallet
Wait while more posts are being loaded