The Glide Image is not visible in the app. How can I fix this?
Error log
MainActivity.java:
public class MainActivity extends AppCompatActivity {
ImageView imh;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
imh=findViewById(R.id.img);
Glide.with(this)
.load("http://www.image.com/img/seatrade_supplier_logo.jpg")
.centerInside()
.override(100,100)
.into(imh);
}
}
Finally this solved my issue.
Thank you all
Network security configuration
Related
i want to use the method (findViewById) but i get an error which i cant solve.
the error is "Type Parameter T has incompatible upperbounds: View and RatingBar".
For fixing this i tried closing the activity and opening another one but it didn't work.
public class RatingBar extends AppCompatActivity {
RatingBar got , bd;
TextView gottxt , bdtxt;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_rating_bar);
init()
}
private void init(){
got = findViewById(R.id.gotrate);
}
}
you are using RatingBar as your activity name. It's the built-in class in Android. Change name of your Activity and try again
Here is Problem : ` got = findViewById(R.id.gotrate); && Also Change Name of Activity becauase it is reserved Word
`
it will like this :
public class MyActivity extends AppCompatActivity {
RatingBar got , bd;
TextView gottxt , bdtxt;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_rating_bar);
init()
}
private void init(){
got = (RatingBar)findViewById(R.id.gotrate);
}
declare RatingBar as final (eg. Final RatingBar or Final TextView)and see if it can solve the issue
I have just started trying out Android Studio, following the instructions on a video tutorial.
Here is my take on what the guy tells me but I keep getting the error message View is deprecated.
How do I fix this? Or what do I use instead?
Here is my code:
public class MainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button sendButton0001 = (Button) findViewById(R.id.buttonSend0001);
EditText welcomeText = (EditText) findViewById(R.id.editTextWelcome);
sendButton0001.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
}
});
}
This is just a warning. I don't know why it shows up, but if it runs fine - don't take care.
My application keeps crashing every time I try to use the PhotoViewAttacher on my application of the PhotoView library. I'm using ION to display images and trying to get the PhotoView library to allow me to zoom into them. My code currently is:
public class massiveImageView extends Activity {
ImageView mImageView;
PhotoViewAttacher mAttacher;
Drawable drawable;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.massive_image_view);
// Any implementation of ImageView can be used!
mImageView = (ImageView) findViewById(R.id.imageViewMassivePage);
Ion.with(this).load("https://pbs.twimg.com/profile_images/522909800191901697/FHCGSQg0.png").withBitmap().asBitmap()
.setCallback(new FutureCallback<Bitmap>() {
#Override
public void onCompleted(Exception e, Bitmap result) {
// do something with your bitmap
drawable=new BitmapDrawable(result);
mImageView.setImageDrawable(drawable);
}
});
mAttacher = new PhotoViewAttacher(mImageView);
}
}
And the error I'm getting is at this line:
mAttacher = new PhotoViewAttacher(mImageView);
Saying:
java.lang.NoClassDefFoundError: uk.co.senab.photoview.PhotoViewAttacher
Any help would be hugely appreciated.
I still don't quite understand why it doesn't work, but I was able to find an answer, where instead of adding the dependency of the library, I just found the jar file online and added that instead, now everything is working perfect.
Library Link
hi I am trying to load an image from an url using novoda Direct ImageLoader method
right now I have this class
public class MainActivity extends Activity {
public class DirectLoading extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageView iv=(ImageView) findViewById(R.id.imageView1);
ImageView ivv=(ImageView) findViewById(R.id.imageView2);
Bitmap b=new DirectLoader()
.download("https://upload.wikimedia.org/wikipedia/commons/a/ad/SmallStellatedDodecahedron.jpg");
Bitmap pic=new DirectLoader()
.download("http://www.coetail.com/mamitakagi1129/wp-content/themes/twentyten/images/headers/cherryblossoms.jpg");
ivv.setImageBitmap(pic);
iv.setImageBitmap(b);
}
private void guiBuilder() {
}
}
}
I should get 2 images into the 2 imageViews, but I am getting a blank screen. There is a "Hello world" string in the layout that is not displayed so I guess I do get the images but they are not displayed graphically.
As it says in readme file https://github.com/novoda/ImageLoader/blob/develop/README.md you should handle threading when using DirectLoader.download(), for example, using AsyncTask.
I am curious to know if screenshots can be disabled when running a android app if I were to design one.
You are welcome to use FLAG_SECURE to block screenshots and thumbnails of your activities:
public class FlagSecureTestActivity extends Activity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(LayoutParams.FLAG_SECURE,
LayoutParams.FLAG_SECURE);
setContentView(R.layout.main);
}
}