Java.lang.IllegalArgumentException: Ziel darf nicht null seinAndroid

Forum für diejenigen, die für Android programmieren
Anonymous
 Java.lang.IllegalArgumentException: Ziel darf nicht null sein

Post by Anonymous »

Wenn ich eine Bild-URL an Picasso übergebe, wird mir die Fehlermeldung „Ziel darf nicht null sein“ angezeigt. Wenn ich mit Picasso ein Bild von einer URL abrufe, wird mir ein Fehler angezeigt. Sogar meine dem Bild zugewiesene ID ist korrekt. Zuletzt habe ich die Bild-URL durch ein statisches Bild ersetzt, obwohl ich die gleiche Fehlermeldung erhalte.

Hier ist mein Code:

Code: Select all

public class MainScreen extends AppCompatActivity {

private ImageView user_profile_pic,img2;
private ImageView like_button,dislike_button,location_button,refresh;

private ArrayList al;
private ArrayAdapter arrayAdapter;
private int i;

private SwipeFlingAdapterView flingContainer;

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

//Setting
user_profile_pic=(ImageView)findViewById(R.id.profile_image);
img2=(ImageView)findViewById(R.id.img2);

//Picasso.with(getApplicationContext()).load("https://pbs.twimg.com/profile_images/596282530652753921/bPf8NmOs.jpg").into(user_profile_pic);

//Picasso.with(getApplicationContext()).load(android.R.drawable.btn_star).into(img);

Picasso.with(getApplicationContext()).load("https://pbs.twimg.com/profile_images/596282530652753921/bPf8NmOs.jpg")
.placeholder(android.R.drawable.btn_star)
.error(android.R.drawable.btn_star)
.into(img2);

flingContainer = (SwipeFlingAdapterView) findViewById(R.id.frame);

al = new ArrayList();
al.add("php");
al.add("c");
al.add("python");
al.add("java");
al.add("html");
al.add("c++");
al.add("css");
al.add("javascript");

arrayAdapter = new ArrayAdapter(this, R.layout.custom_user_details, R.id.helloText, al );

flingContainer.setAdapter(arrayAdapter);

flingContainer.setFlingListener(new SwipeFlingAdapterView.onFlingListener() {
@Override
public void removeFirstObjectInAdapter() {

Log.d("LIST", "removed object!");
al.remove(0);
arrayAdapter.notifyDataSetChanged();
}

@Override
public void onLeftCardExit(Object dataObject) {

Toast.makeText(getApplicationContext(),"Left !",Toast.LENGTH_SHORT).show();
}

@Override
public void onRightCardExit(Object dataObject) {

Toast.makeText(getApplicationContext(),"Right !",Toast.LENGTH_SHORT).show();
}

@Override
public void onAdapterAboutToEmpty(int itemsInAdapter) {

al.add("XML ".concat(String.valueOf(i)));
arrayAdapter.notifyDataSetChanged();
Log.d("LIST", "notified");
i++;
}

@Override
public void onScroll(float scrollProgressPercent) {

try
{
View view = flingContainer.getSelectedView();
view.findViewById(R.id.item_swipe_right_indicator).setAlpha(scrollProgressPercent < 0 ? -scrollProgressPercent : 0);
view.findViewById(R.id.item_swipe_left_indicator).setAlpha(scrollProgressPercent > 0 ? scrollProgressPercent : 0);
}
catch (NullPointerException e) {
Log.e("tag", "NullPointerException" + e);
}

}
});

//flingContainer.getTopCardListener().selectRight(); To remove view from right side while pressing button

}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main_screen, menu);
return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here.  The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();

//noinspection SimplifiableIfStatement
if (id == R.id.action_settings) {
return true;
}

return super.onOptionsItemSelected(item);
}

}
Und das ist mein XML:

Code: Select all


















































Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post