I will be happy if you will provide your feedback or follow this blog. Any suggestion and help will be appreciated.
Thank you :)
public class MainActivity extends Activity {
private ImageView image;
private TransitionDrawable trans;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
image = (ImageView) findViewById(R.id.image);
Resources res = this.getResources();
trans = (TransitionDrawable) res.getDrawable(R.drawable.transition);
image.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v) {
image.setImageDrawable(trans);
trans.reverseTransition(1000);
}
});
} }
activity_main.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity" >
<ImageView
android:id="@+id/image"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/ic_launcher"
/>
</LinearLayout>
transition.xml
<?xml version="1.0" encoding="utf-8"?>
<transition xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@drawable/ic_launcher"/>
<item android:drawable="@drawable/hair_advice"/>
</transition>
public String getFilename() {
filepath = Environment.getExternalStorageDirectory().getPath();
file = new File(filepath, "Hair");
if (!file.exists()) {
file.mkdirs();
}
return (file.getAbsolutePath() + "/"
+ String.valueOf(System.currentTimeMillis()) + ".png");
}
public class AppConfig {
Context context;
public AppConfig(Context mxt) {
context = mxt;
}
public static String filepath = null;
public static String imageupload = null;
public static Bitmap abjustbitmap = null;
}
AppConfig config;
Context context;
context = getApplicationContext();
config = new AppConfig(context);