This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class FromHtmlImageActivity extends Activity { | |
private TextView sampleTextView; | |
private Spanned spannedValue; | |
private String stringWithHtml; | |
@Override | |
public void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.main); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyFragment extends Fragment { | |
@Override | |
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) { | |
View view = inflater.inflate(R.layout.my_fragment, container, false); | |
// Find your buttons in view, set up onclicks, set up callbacks to your parent fragment or activity here. | |
// You can create ViewHolder or separate method for that. | |
// example of accessing views: TextView textViewExample = (TextView) view.findViewById(R.id.text_view_example); | |
// textViewExample.setText("example"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.github.volley.example.toolbox; | |
import com.android.volley.toolbox.ImageLoader.ImageCache; | |
import android.graphics.Bitmap; | |
import android.support.v4.util.LruCache; | |
public class BitmapLruCache extends LruCache<String, Bitmap> implements ImageCache { | |
public BitmapLruCache(int maxSize) { | |
super(maxSize); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.github.volley.example.toolbox; | |
import android.content.Context; | |
import com.android.volley.RequestQueue; | |
import com.android.volley.toolbox.ImageLoader; | |
import com.android.volley.toolbox.Volley; | |
import com.github.volley.example.toolbox.BitmapLruCache; | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
imageView = (ImageView) findViewById(R.id.iv_image); | |
// ... | |
String imageUrl = "http://www.example.com/image.jpg"; | |
VolleyHelper.init(this); // we can call this method in other place - e.g. in class extending Application class | |
// and refer to application context insted of activity context | |
ImageLoader imageLoader = VolleyHelper.getImageLoader(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
font-size: 1.0em; | |
color: rgb(0,0,0); | |
text-align: justify; | |
/* background: rgba(217, 217, 217, 1.0); you can set your background here, | |
it's kind of fix for older versions of Android OS */ | |
} | |
@media screen and (-webkit-device-pixel-ratio: 1.5) { | |
/* CSS for high-density screens */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.github.sample.view; | |
import android.content.Context; | |
import android.content.res.TypedArray; | |
import android.graphics.Color; | |
import android.os.Build; | |
import android.text.TextUtils; | |
import android.util.AttributeSet; | |
import android.util.TypedValue; | |
import android.view.View; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<declare-styleable name="JustifiedTextView"> | |
<attr name="text" format="reference" /> | |
</declare-styleable> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<com.github.sample.view.JustifiedTextView | |
android:id="@+id/tv_information" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
private JustifiedTextView tvInformation; | |
public void onCreate() { | |
tvInformation = (JustifiedTextView) findViewById(R.id.tv_information); | |
tVinformation.setText("sample text"); | |
} | |
// ... |